fixed linux keyboard input to support 2 byte keycodes.

This commit is contained in:
Allen Webster 2017-02-12 01:59:51 -05:00
parent 48bcb06893
commit 1b18517308
2 changed files with 13 additions and 7 deletions

View File

@ -4887,7 +4887,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
i32 j = 0; i32 j = 0;
for (j = 0; j < keys.count; ++j){ for (j = 0; j < keys.count; ++j){
i16 key = keys.keys[j].keycode; Key_Code key = keys.keys[j].keycode;
switch (key){ switch (key){
case key_left: --view->color_cursor; r = 1; result.consume_keys = 1; break; case key_left: --view->color_cursor; r = 1; result.consume_keys = 1; break;
case key_right: ++view->color_cursor; r = 1; result.consume_keys = 1; break; case key_right: ++view->color_cursor; r = 1; result.consume_keys = 1; break;

View File

@ -353,6 +353,12 @@ Sys_Set_File_List_Sig(system_set_file_list){
d = opendir(directory); d = opendir(directory);
if (d){ if (d){
if (canon_directory_out != 0){
u32 length = copy_fast_unsafe_cc(canon_directory_out, directory);
canon_directory_out[length] = 0;
*canon_directory_size_out = length;
}
character_count = 0; character_count = 0;
file_count = 0; file_count = 0;
for (entry = readdir(d); for (entry = readdir(d);
@ -1909,7 +1915,7 @@ LinuxKeycodeInit(Display* dpy){
struct SymMapping { struct SymMapping {
KeySym sym; KeySym sym;
u8 code; u16 code;
} sym_table[] = { } sym_table[] = {
{ XK_BackSpace, key_back }, { XK_BackSpace, key_back },
{ XK_Delete, key_del }, { XK_Delete, key_del },
@ -1972,7 +1978,7 @@ LinuxKeycodeInit(Display* dpy){
} }
internal void internal void
LinuxPushKey(u8 code, u8 chr, u8 chr_nocaps, b8 (*mods)[MDFR_INDEX_COUNT], b32 is_hold) LinuxPushKey(Key_Code code, Key_Code chr, Key_Code chr_nocaps, b8 (*mods)[MDFR_INDEX_COUNT])
{ {
i32 *count = &linuxvars.input.keys.count; i32 *count = &linuxvars.input.keys.count;
Key_Event_Data *data = linuxvars.input.keys.keys; Key_Event_Data *data = linuxvars.input.keys.keys;
@ -2677,14 +2683,14 @@ LinuxHandleX11Events(void)
mods[MDFR_SHIFT_INDEX] = 1; mods[MDFR_SHIFT_INDEX] = 1;
} }
u8 special_key = keycode_lookup_table[(u8)Event.xkey.keycode]; Key_Code special_key = keycode_lookup_table[(u8)Event.xkey.keycode];
if(special_key){ if(special_key){
LinuxPushKey(special_key, 0, 0, &mods, is_hold); LinuxPushKey(special_key, 0, 0, &mods);
} else if(key < 128){ } else if(key < 128){
LinuxPushKey(key, key, key_no_caps, &mods, is_hold); LinuxPushKey(key, key, key_no_caps, &mods);
} else { } else {
LinuxPushKey(0, 0, 0, &mods, is_hold); LinuxPushKey(0, 0, 0, &mods);
} }
}break; }break;