From 145d1a6561af86ed4c2bf65a3dea908d3bdd59fb Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 25 Feb 2016 20:28:31 -0500 Subject: [PATCH 1/2] Fixed linux side keyboard stuff --- 4ed_linux_keyboard.cpp | 28 +++++++++++++--------------- linux_4ed.cpp | 11 ++++------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/4ed_linux_keyboard.cpp b/4ed_linux_keyboard.cpp index 1a3c1040..5d7dbecf 100644 --- a/4ed_linux_keyboard.cpp +++ b/4ed_linux_keyboard.cpp @@ -12,9 +12,7 @@ #include "4ed_keyboard.cpp" internal void -keycode_init(Display* dpy, Key_Codes *codes){ - set_dynamic_key_names(codes); - +keycode_init(Display* dpy){ #if 0 // NOTE(inso): these are for XInput, currently not used. @@ -46,18 +44,18 @@ keycode_init(Display* dpy, Key_Codes *codes){ KeySym sym; Code code; } sym_table[] = { - { XK_BackSpace, codes->back }, - { XK_Delete, codes->del }, - { XK_Up, codes->up }, - { XK_Down, codes->down }, - { XK_Left, codes->left }, - { XK_Right, codes->right }, - { XK_Insert, codes->insert }, - { XK_Home, codes->home }, - { XK_End, codes->end }, - { XK_Page_Up, codes->page_up }, - { XK_Page_Down, codes->page_down }, - { XK_Escape, codes->esc } + { XK_BackSpace, key_back }, + { XK_Delete, key_del }, + { XK_Up, key_up }, + { XK_Down, key_down }, + { XK_Left, key_left }, + { XK_Right, key_right }, + { XK_Insert, key_insert }, + { XK_Home, key_home }, + { XK_End, key_end }, + { XK_Page_Up, key_page_up }, + { XK_Page_Down, key_page_down }, + { XK_Escape, key_esc } }; const int table_size = sizeof(sym_table) / sizeof(struct SymMapping); diff --git a/linux_4ed.cpp b/linux_4ed.cpp index d5e95266..b0a0a292 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -101,8 +101,7 @@ struct Linux_Vars{ XIM input_method; XIMStyle input_style; XIC input_context; - Key_Codes key_codes; - + Key_Input_Data key_data; Mouse_State mouse_data; @@ -1630,7 +1629,7 @@ main(int argc, char **argv) linuxvars.XDisplay = XOpenDisplay(0); - keycode_init(linuxvars.XDisplay, &linuxvars.key_codes); + keycode_init(linuxvars.XDisplay); #ifdef FRED_SUPER char *custom_file_default = "4coder_custom.so"; @@ -1796,8 +1795,7 @@ main(int argc, char **argv) XSetWMProtocols(linuxvars.XDisplay, linuxvars.XWindow, &WM_DELETE_WINDOW, 1); } - linuxvars.app.init(linuxvars.system, &linuxvars.target, - &memory_vars, &exchange_vars, &linuxvars.key_codes, + linuxvars.app.init(linuxvars.system, &linuxvars.target, &memory_vars, &exchange_vars, linuxvars.clipboard_contents, current_directory, linuxvars.custom_api); @@ -1929,7 +1927,7 @@ main(int argc, char **argv) case MappingNotify: { if(Event.xmapping.request == MappingModifier || Event.xmapping.request == MappingKeyboard){ XRefreshKeyboardMapping(&Event.xmapping); - keycode_init(linuxvars.XDisplay, &linuxvars.key_codes); + keycode_init(linuxvars.XDisplay); } }break; @@ -2057,7 +2055,6 @@ main(int argc, char **argv) u64 start_time = system_time(); linuxvars.app.step(linuxvars.system, - &linuxvars.key_codes, &input_data, &mouse, &linuxvars.target, From d42e1feeb7f11d2b78e10ae8d85a6abddf8199de Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 25 Feb 2016 20:41:09 -0500 Subject: [PATCH 2/2] couple of linux tweaks --- 4coder_custom.cpp | 2 +- linux_4ed.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/4coder_custom.cpp b/4coder_custom.cpp index 4cdb5d96..be76576b 100644 --- a/4coder_custom.cpp +++ b/4coder_custom.cpp @@ -76,7 +76,7 @@ HOOK_SIG(my_file_settings){ push_parameter(app, cmd_context, par_lex_as_cpp_file, treat_as_code); push_parameter(app, cmd_context, par_wrap_lines, !treat_as_code); - push_parameter(app, cmd_context, par_key_mapid, (treat_as_code)?(my_code_map):(mapid_file)); + push_parameter(app, cmd_context, par_key_mapid, (treat_as_code)?((int)my_code_map):((int)mapid_file)); exec_command(cmd_context, cmdid_set_settings); } } diff --git a/linux_4ed.cpp b/linux_4ed.cpp index b0a0a292..0652f7ad 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -22,7 +22,12 @@ #include "4ed_mem.cpp" #include "4ed_math.cpp" -#include "4coder_custom.h" +#include "4coder_custom.cpp" + +#undef exec_command +#undef exec_command_keep_stack +#undef clear_parameters + #include "4ed_system.h" #include "4ed_rendering.h" #include "4ed.h" @@ -1650,6 +1655,10 @@ main(int argc, char **argv) } #endif + if (linuxvars.custom_api.get_bindings == 0){ + linuxvars.custom_api.get_bindings = get_bindings; + } + Thread_Context background[4] = {}; linuxvars.groups[BACKGROUND_THREADS].threads = background; linuxvars.groups[BACKGROUND_THREADS].count = ArrayCount(background);