mirror of
https://git.checksum.fail/alec/saphir.git
synced 2026-05-01 18:09:42 +03:00
72 lines
1.4 KiB
HolyC
72 lines
1.4 KiB
HolyC
saphir.kd.sys_cbs = keydev.fp_ctrl_alt_cbs;
|
|
saphir.kd.null_cbs = CAlloc(0xd0);
|
|
|
|
I64 saphir_get_char()
|
|
{
|
|
I64 sc = NULL;
|
|
I64 ch = NULL;
|
|
do {
|
|
ch = GetKey(&sc, 0, 0);
|
|
if (!ch) {
|
|
switch (sc & 0xff) {
|
|
case SC_CURSOR_UP:
|
|
case SC_CURSOR_DOWN:
|
|
case SC_CURSOR_LEFT:
|
|
case SC_CURSOR_RIGHT:
|
|
return ((sc & 0xff) << 8);
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
} while (!ch);
|
|
return ch;
|
|
}
|
|
|
|
U0 saphir_handle_prefix_cmd()
|
|
{
|
|
I64 ch = saphir_get_char;
|
|
switch (ch >> 8) {
|
|
case SC_CURSOR_UP:
|
|
case SC_CURSOR_DOWN:
|
|
case SC_CURSOR_LEFT:
|
|
case SC_CURSOR_RIGHT:
|
|
saphir_win_select(ch >> 8);
|
|
return;
|
|
default:
|
|
break;
|
|
}
|
|
switch (ch & 0xff) {
|
|
case '%':
|
|
saphir_split_col;
|
|
return;
|
|
case '"':
|
|
saphir_split_row;
|
|
return;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
Bool saphir_MyPutKey(I64 ch, I64 sc)
|
|
{
|
|
no_warn sc;
|
|
switch (ch) {
|
|
case CH_CTRLB:
|
|
saphir_handle_prefix_cmd;
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
U0 saphir_keydev(Bool enable)
|
|
{
|
|
fn_patch(&MyPutKey, &saphir_MyPutKey, enable);
|
|
switch (enable) {
|
|
case 0:
|
|
keydev.fp_ctrl_alt_cbs = saphir.kd.sys_cbs;
|
|
return;
|
|
default:
|
|
keydev.fp_ctrl_alt_cbs = saphir.kd.null_cbs;
|
|
return;
|
|
}
|
|
} |