|
XenevaOS
|
#include <_xeneva.h>#include <sys/_keproc.h>#include <sys/_kefile.h>#include <sys/iocodes.h>#include <ctype.h>#include <chitralekha.h>#include <widgets/window.h>#include <keycode.h>#include "term.h"#include "arrayfont.h"#include <sys/mman.h>#include "esccode.h"#include <sys/_ketty.h>#include <sys/_ketime.h>#include <signal.h>#include <sys/time.h>#include <unistd.h>#include <time.h>
Macros | |
| #define | TERMINAL_BLACK 0xCC373434 |
| #define | TERMINAL_BLACK_SOLID 0xFF373434 |
| #define | TERMINAL_GLASS_ALPHA 0xC8 |
| #define | TERMINAL_CLIP_MAX 4096 |
| #define | TERMINAL_SCANCODE_RELEASE 0x80 |
| #define | TERMINAL_SCANCODE_MASK 0x7f |
| #define | TERMINAL_SCANCODE_UP 0x48 |
| #define | TERMINAL_SCANCODE_LEFT 0x4b |
| #define | TERMINAL_SCANCODE_RIGHT 0x4d |
| #define | TERMINAL_SCANCODE_PGUP 0x49 |
| #define | TERMINAL_SCANCODE_PGDN 0x51 |
Variables | |
| ChWindow * | win |
| ChitralekhaApp * | app |
| ChFont * | consolas |
| int | master_fd |
| int | slave_fd |
| Terminal | term |
| bool | dirty = false |
| bool | _escape_seq = false |
| bool | _seq_csi = false |
| bool | _seq_osc = false |
| bool | _cursor_blink = 0 |
| bool | _update_terminal_ = false |
| bool | _first_time = false |
| uint32_t | backColor |
| uint32_t | fgColor |
| char * | escBuf |
| char | oscBuf [64] |
| int | oscLen |
| int | shell_id |
| #define TERMINAL_BLACK 0xCC373434 |
| #define TERMINAL_BLACK_SOLID 0xFF373434 |
| #define TERMINAL_CLIP_MAX 4096 |
| #define TERMINAL_GLASS_ALPHA 0xC8 |
| #define TERMINAL_SCANCODE_LEFT 0x4b |
| #define TERMINAL_SCANCODE_MASK 0x7f |
| #define TERMINAL_SCANCODE_PGDN 0x51 |
| #define TERMINAL_SCANCODE_PGUP 0x49 |
| #define TERMINAL_SCANCODE_RELEASE 0x80 |
| #define TERMINAL_SCANCODE_RIGHT 0x4d |
| #define TERMINAL_SCANCODE_UP 0x48 |
| int main | ( | int | argc, |
| char * | arv[] | ||
| ) |
| void ProcessControlSequence | ( | Terminal * | term_, |
| char | ch | ||
| ) |
| void ProcessOSCSequence | ( | Terminal * | t, |
| const char * | payload | ||
| ) |
| void TerminalApplySGR | ( | int | code | ) |
| void TerminalClearLine | ( | Terminal * | t | ) |
| void TerminalClearLineFromCursor | ( | Terminal * | t | ) |
| void TerminalClearLineToCursor | ( | Terminal * | t | ) |
| void TerminalClearScreen | ( | Terminal * | t | ) |
| void TerminalDrawAllCells | ( | ) |
| void TerminalDrawArrayFont | ( | ChCanvas * | canv, |
| unsigned | x, | ||
| unsigned | y, | ||
| unsigned char | c, | ||
| uint32_t | color | ||
| ) |
| void TerminalDrawCell | ( | Terminal * | t, |
| int | col, | ||
| int | row | ||
| ) |
| void TerminalDrawCursor | ( | ) |
| void TerminalFlush | ( | Terminal * | t | ) |
| void TerminalHandleMessage | ( | PostEvent * | e | ) |
check from extended key code map (scancode 0x48: Up / keypad 8)
chec from extended key code map
if (rawkey == KEY_KP_2) { TerminalHistoryDown(&term); memset(e, 0, sizeof(PostEvent)); return; }
CTRL + SHIFT + C/V – the host<->VM clipboard, on the same /dev/clipboard node the tty shell uses, so a copy here reaches the host and a paste here reads whatever the host last copied. Shift has to be part of the binding: on its own Ctrl+C is SIGINT, which is what people already use below. Only Ctrl+X and Ctrl+A are taken by the compositor's own keybinds, so this arrives as a raw scancode. ChitralekhaKeyToASCII uppercases while shift is held, hence both letters are matched.
handle CTRL + combined keys
| void TerminalHandleMouseClick | ( | Terminal * | t, |
| int | mouseX, | ||
| int | mouseY, | ||
| int | button | ||
| ) |
skip the titlebar
| void TerminalHistoryDown | ( | Terminal * | t | ) |
| void TerminalHistoryPush | ( | Terminal * | t, |
| const char * | cmd | ||
| ) |
| void TerminalHistoryUp | ( | Terminal * | t | ) |
| void TerminalProcessLine | ( | Terminal * | t, |
| char | ch | ||
| ) |
| void TerminalReplaceInput | ( | Terminal * | t, |
| const char * | newText | ||
| ) |
drain the last character passed to slave buffer
| void TerminalScroll | ( | Terminal * | t, |
| int | lines | ||
| ) |
| void TerminalThread | ( | ) |
| void TerminalViewScroll | ( | Terminal * | t, |
| int | delta | ||
| ) |
| bool _cursor_blink = 0 |
| ChitralekhaApp* app |
| uint32_t backColor |
| ChFont* consolas |
| char* escBuf |
| uint32_t fgColor |
| int master_fd |
| char oscBuf[64] |
| int oscLen |
| int shell_id |
| int slave_fd |
| Terminal term |
| ChWindow* win |
BSD 2-Clause License
Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.