From 1b18517308fe74f0ef8a43999704803f84807a16 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sun, 12 Feb 2017 01:59:51 -0500 Subject: [PATCH] fixed linux keyboard input to support 2 byte keycodes. --- 4ed_file_view.cpp | 2 +- linux_4ed.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index d4b1d76b..fabea16e 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -4887,7 +4887,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su i32 j = 0; for (j = 0; j < keys.count; ++j){ - i16 key = keys.keys[j].keycode; + Key_Code key = keys.keys[j].keycode; switch (key){ 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; diff --git a/linux_4ed.cpp b/linux_4ed.cpp index c6cb0653..fe5c26df 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -353,6 +353,12 @@ Sys_Set_File_List_Sig(system_set_file_list){ d = opendir(directory); 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; file_count = 0; for (entry = readdir(d); @@ -1909,7 +1915,7 @@ LinuxKeycodeInit(Display* dpy){ struct SymMapping { KeySym sym; - u8 code; + u16 code; } sym_table[] = { { XK_BackSpace, key_back }, { XK_Delete, key_del }, @@ -1972,7 +1978,7 @@ LinuxKeycodeInit(Display* dpy){ } 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; Key_Event_Data *data = linuxvars.input.keys.keys; @@ -2677,14 +2683,14 @@ LinuxHandleX11Events(void) 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){ - LinuxPushKey(special_key, 0, 0, &mods, is_hold); + LinuxPushKey(special_key, 0, 0, &mods); } else if(key < 128){ - LinuxPushKey(key, key, key_no_caps, &mods, is_hold); + LinuxPushKey(key, key, key_no_caps, &mods); } else { - LinuxPushKey(0, 0, 0, &mods, is_hold); + LinuxPushKey(0, 0, 0, &mods); } }break;