From 2db519141865cd504351aabf042db5bdf2ac5d96 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 24 Jun 2018 23:33:33 +0200 Subject: Check nxagentXkbInfo.EventBase before use --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 94480c45c..4c85145a9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2782,7 +2782,8 @@ int nxagentHandleXkbKeyboardStateEvent(XEvent *X) { XkbEvent *xkbev = (XkbEvent *) X; - if (xkbev -> type == nxagentXkbInfo.EventBase + XkbEventCode && + if (nxagentXkbInfo.EventBase != -1 && + xkbev -> type == nxagentXkbInfo.EventBase + XkbEventCode && xkbev -> any.xkb_type == XkbStateNotify) { #ifdef TEST @@ -3815,6 +3816,11 @@ int nxagentInitXkbKeyboardState(void) XkbEvent *xkbev = (XkbEvent *) &X; + if (nxagentXkbInfo.EventBase == -1) + { + return 1; + } + #ifdef TEST fprintf(stderr, "%s: Initializing XKB state.\n", __func__); #endif -- cgit v1.2.3 From 9808c66ec37d5d99f58bdb6136ae96381cb9cfc8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 29 Jun 2018 22:34:32 +0200 Subject: Lift xkb to XORG-1.2.0 state --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 6a146676e..c6998e8be 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -155,7 +155,7 @@ extern Status XkbGetControls( #define XKB_CONFIG_FILE_X2GO "/etc/x2go/x2goagent.keyboard" #endif #ifndef XKB_DFLT_RULES_FILE -#define XKB_DFLT_RULES_FILE "xfree86" +#define XKB_DFLT_RULES_FILE "base" #endif #ifndef XKB_ALTS_RULES_FILE #define XKB_ALTS_RULES_FILE "xorg" -- cgit v1.2.3 From bebdf0990dfbc4ea840717e6f4f777637afbf8a4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 4 Jul 2018 23:15:11 +0200 Subject: Keyboard.c: Remove (now) unused defines --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index c6998e8be..1c6fcaab0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -148,12 +148,6 @@ extern Status XkbGetControls( #ifndef XKB_ALTERNATE_BASE_DIRECTORY #define XKB_ALTERNATE_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb" #endif -#ifndef XKB_CONFIG_FILE_NX -#define XKB_CONFIG_FILE_NX "/etc/nxagent/nxagent.keyboard" -#endif -#ifndef XKB_CONFIG_FILE_X2GO -#define XKB_CONFIG_FILE_X2GO "/etc/x2go/x2goagent.keyboard" -#endif #ifndef XKB_DFLT_RULES_FILE #define XKB_DFLT_RULES_FILE "base" #endif -- cgit v1.2.3 From 0fc53688698d128ac77a998b87e5b0df3d44c622 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 4 Jul 2018 23:16:26 +0200 Subject: Keyboard.c: remove unnecessary includes --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 1c6fcaab0..647a0a823 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -42,15 +42,12 @@ is" without express or implied warranty. #include #include -#include "X.h" -#include "Xproto.h" #include "keysym.h" #include "screenint.h" #include "inputstr.h" #include "misc.h" #include "scrnintstr.h" #include "servermd.h" -#include "dixstruct.h" #include "extnsionst.h" #include "Agent.h" @@ -67,10 +64,6 @@ is" without express or implied warranty. #ifdef XKB -#include "globals.h" -#include "property.h" -#include "Init.h" - #include /* -- cgit v1.2.3 From d54f1fb7360ab2f35d916b53baba3e3aee8d9128 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Jul 2018 23:14:05 +0200 Subject: Keyboard.c: remove unused defines Defines regarding XKB-BASE_DIRECTORY are used only xkb. --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 647a0a823..5abfc70d5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -135,12 +135,6 @@ extern Status XkbGetControls( #endif ); -#ifndef XKB_BASE_DIRECTORY -#define XKB_BASE_DIRECTORY "/usr/share/X11/xkb" -#endif -#ifndef XKB_ALTERNATE_BASE_DIRECTORY -#define XKB_ALTERNATE_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb" -#endif #ifndef XKB_DFLT_RULES_FILE #define XKB_DFLT_RULES_FILE "base" #endif -- cgit v1.2.3 From 11a1f31d70c189bf6c5f4420f196468267755a0d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Jul 2018 23:16:30 +0200 Subject: no more own XkbBaseDirectory handling Just use the existing xkb code --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 33 --------------------------- 1 file changed, 33 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 5abfc70d5..d943ec2c4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -481,37 +481,6 @@ static int nxagentRestoreKeyboardDeviceData(DeviceIntPtr devBackup, DeviceIntPtr static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev); -static void nxagentCheckXkbBaseDirectory(void) -{ - - /* - * Set XkbBaseDirectory global - * variable appropriately. - */ - - #ifdef TEST - fprintf(stderr, "nxagentCheckXkbBaseDirectory: " - "Before calling _NXGetXkbBasePath:\n"); - - fprintf(stderr, "nxagentCheckXkbBaseDirectory: " - "XkbBaseDirectory variable [%s].\n", - XkbBaseDirectory); - #endif - - XkbBaseDirectory = _NXGetXkbBasePath(XkbBaseDirectory); - - #ifdef TEST - fprintf(stderr, "nxagentCheckXkbBaseDirectory: " - "After calling _NXGetXkbBasePath:\n"); - - fprintf(stderr, "nxagentCheckXkbBaseDirectory: " - "XkbBaseDirectory variable [%s].\n", - XkbBaseDirectory); - #endif - - return; -} - static char *nxagentXkbGetRules() { int ret; @@ -820,8 +789,6 @@ N/A * variable is checked. */ - nxagentCheckXkbBaseDirectory(); - if (noXkbExtension) { #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: No XKB extension.\n"); -- cgit v1.2.3 From eb07ed57bb9afdde7bf0f1e501ce08d5fd3de30e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Jul 2018 23:23:11 +0200 Subject: Keyboard.c: do not define own RLMVO defaults use the ones from xkb --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 99 ++------------------------- 1 file changed, 5 insertions(+), 94 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index d943ec2c4..2ffdde1c2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -135,25 +135,6 @@ extern Status XkbGetControls( #endif ); -#ifndef XKB_DFLT_RULES_FILE -#define XKB_DFLT_RULES_FILE "base" -#endif -#ifndef XKB_ALTS_RULES_FILE -#define XKB_ALTS_RULES_FILE "xorg" -#endif -#ifndef XKB_DFLT_KB_LAYOUT -#define XKB_DFLT_KB_LAYOUT "us" -#endif -#ifndef XKB_DFLT_KB_MODEL -#define XKB_DFLT_KB_MODEL "pc102" -#endif -#ifndef XKB_DFLT_KB_VARIANT -#define XKB_DFLT_KB_VARIANT NULL -#endif -#ifndef XKB_DFLT_KB_OPTIONS -#define XKB_DFLT_KB_OPTIONS NULL -#endif - extern int XkbDfltRepeatDelay; extern int XkbDfltRepeatInterval; @@ -180,8 +161,6 @@ XkbWrapperRec nxagentXkbWrapper; extern char *nxagentKeyboard; -static char *nxagentXkbGetRules(void); - unsigned int nxagentAltMetaMask; unsigned int nxagentAltMask; unsigned int nxagentMetaMask; @@ -481,73 +460,6 @@ static int nxagentRestoreKeyboardDeviceData(DeviceIntPtr devBackup, DeviceIntPtr static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev); -static char *nxagentXkbGetRules() -{ - int ret; - char *path; - struct stat buf; - - #ifdef TEST - fprintf(stderr, "nxagentXkbGetRules: XkbBaseDirectory [%s].\n", - XkbBaseDirectory); - #endif - - if (-1 == asprintf(&path, "%s/rules/%s", XkbBaseDirectory, XKB_DFLT_RULES_FILE)) - { - FatalError("nxagentXkbGetRules: malloc failed."); - } - - #ifdef TEST - fprintf(stderr, "nxagentXkbGetRules: checking rules file [%s]\n", path); - #endif - ret = stat(path, &buf); - - if (ret == 0) - { - free(path); - #ifdef TEST - fprintf(stderr, "nxagentXkbGetRules: returning default rules file [%s]\n", XKB_DFLT_RULES_FILE); - #endif - return XKB_DFLT_RULES_FILE; - } - - #ifdef TEST - fprintf(stderr, "nxagentXkbGetRules: WARNING! Failed to stat file [%s]: %s.\n", path, strerror(ret)); - #endif - - free(path); - path = NULL; - - if (-1 == asprintf(&path, "%s/rules/%s", XkbBaseDirectory, XKB_ALTS_RULES_FILE)) - { - FatalError("nxagentXkbGetRules: malloc failed."); - } - - #ifdef TEST - fprintf(stderr, "nxagentXkbGetRules: checking rules file [%s]\n", path); - #endif - ret = stat(path, &buf); - - if (ret == 0) - { - free(path); - #ifdef TEST - fprintf(stderr, "nxagentXkbGetRules: returning alternative rules file [%s]\n", XKB_ALTS_RULES_FILE); - #endif - return XKB_ALTS_RULES_FILE; - } - - #ifdef WARNING - fprintf(stderr, "nxagentXkbGetRules: WARNING! Failed to stat file [%s]: %s.\n", path, strerror(ret)); - #endif - - free(path); - #ifdef TEST - fprintf(stderr, "nxagentXkbGetRules: returning default rules file [%s]\n", XKB_DFLT_RULES_FILE); - #endif - return XKB_DFLT_RULES_FILE; -} - void nxagentBell(int volume, DeviceIntPtr pDev, void * ctrl, int cls) { XBell(nxagentDisplay, volume); @@ -843,8 +755,7 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL"); #endif - - rules = nxagentXkbGetRules(); + rules = NULL; /* use xkb default */ /* from nxagent changelog: @@ -901,8 +812,8 @@ XkbError: } else { - layout = XKB_DFLT_KB_LAYOUT; - model = XKB_DFLT_KB_MODEL; + layout = NULL; /* use xkb default */ + model = NULL; /* use xkb default */ #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using default keyboard: model [%s] layout [%s].\n", @@ -910,8 +821,8 @@ XkbError: #endif } - variants = XKB_DFLT_KB_VARIANT; - options = XKB_DFLT_KB_OPTIONS; + variants = NULL; /* use xkb default */ + options = NULL; /* use xkb default */ #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Init XKB extension.\n"); -- cgit v1.2.3 From b891e5f6859298c3482067752c9e4b2fd19ed617 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 16 Jul 2018 22:07:26 +0200 Subject: Keyboard.c: always ask for remote XKB --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 2ffdde1c2..103a817dd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -693,6 +693,18 @@ N/A keySyms.mapWidth = mapWidth; keySyms.map = keymap; + if (XkbQueryExtension(nxagentDisplay, + &nxagentXkbInfo.Opcode, + &nxagentXkbInfo.EventBase, + &nxagentXkbInfo.ErrorBase, + &nxagentXkbInfo.MajorVersion, + &nxagentXkbInfo.MinorVersion) == 0) + { + ErrorF("Unable to initialize XKEYBOARD extension.\n"); + goto XkbError; + } + + #ifdef XKB /* @@ -828,18 +840,6 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: Init XKB extension.\n"); #endif - if (XkbQueryExtension(nxagentDisplay, - &nxagentXkbInfo.Opcode, - &nxagentXkbInfo.EventBase, - &nxagentXkbInfo.ErrorBase, - &nxagentXkbInfo.MajorVersion, - &nxagentXkbInfo.MinorVersion) == 0) - { - ErrorF("Unable to initialize XKEYBOARD extension.\n"); - - goto XkbError; - } - xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); nxagentKeycodeConversionSetup(); -- cgit v1.2.3 From 6186383e70b56ba0782fae3c851779f2f079cbcd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 16 Jul 2018 22:22:10 +0200 Subject: Keyboard.c: simplify RLMVO string handling --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 46 ++++++--------------------- 1 file changed, 9 insertions(+), 37 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 103a817dd..9c0fd0212 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -570,7 +570,6 @@ int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff) int i, j; XKeyboardState values; char *model = NULL, *layout = NULL; - int free_model = 0, free_layout = 0; XkbDescPtr xkb = NULL; switch (onoff) @@ -726,16 +725,9 @@ XkbError: XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); xkb = NULL; - if (free_model) - { - free_model = 0; - free(model); - } - if (free_layout) - { - free_layout = 0; - free(layout); - } + + free(model); + free(layout); #endif XGetKeyboardControl(nxagentDisplay, &values); @@ -757,7 +749,7 @@ XkbError: #ifdef XKB } else { /* if (noXkbExtension) */ XkbComponentNamesRec names = {0}; - char *rules, *variants, *options; + char *rules = NULL, *variants = NULL, *options = NULL; /* use xkb default */ #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using XKB extension.\n"); @@ -767,8 +759,6 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL"); #endif - rules = NULL; /* use xkb default */ - /* from nxagent changelog: 2.0.22: @@ -791,11 +781,8 @@ XkbError: goto XkbError; } - free_model = 1; - model = strndup(nxagentKeyboard, i); - - free_layout = 1; - layout = strdup(&nxagentKeyboard[i + 1]); + model = strndup(nxagentKeyboard, i); + layout = strdup(&nxagentKeyboard[i + 1]); /* * There is no description for pc105 on Solaris. @@ -824,18 +811,12 @@ XkbError: } else { - layout = NULL; /* use xkb default */ - model = NULL; /* use xkb default */ - #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using default keyboard: model [%s] layout [%s].\n", model, layout); #endif } - variants = NULL; /* use xkb default */ - options = NULL; /* use xkb default */ - #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Init XKB extension.\n"); #endif @@ -900,20 +881,11 @@ XkbEnd: NXShadowInitKeymap(&(pDev->key->curKeySyms)); } - if (free_model) - { - free_model = 0; - free(model); - } - - if (free_layout) - { - free_layout = 0; - free(layout); - } - XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); xkb = NULL; + + free(model); + free(layout); } #endif -- cgit v1.2.3 From 1b05251a02f2fbac09fb267f0c7fcb411c7e0105 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 1 Nov 2018 14:46:54 +0100 Subject: Keyboard.c: simplify over-specific if --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 9c0fd0212..65c4d20fe 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -869,8 +869,7 @@ XkbError: XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); - if (!nxagentKeyboard || - (nxagentKeyboard && (strcmp(nxagentKeyboard, "query") == 0))) + if (!nxagentKeyboard || strcmp(nxagentKeyboard, "query") == 0) { goto XkbError; } -- cgit v1.2.3 From d8bbbcf29c3c0e43ce28d76e52e6a8ad9deeb90f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 16 Jul 2018 22:23:05 +0200 Subject: Keyboard.c: guard XkbFreeKeyboard calls manpage does not tell us if NULL is valid --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 65c4d20fe..84121c1db 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -723,8 +723,11 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: XKB error.\n"); #endif - XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); - xkb = NULL; + if (xkb) + { + XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); + xkb = NULL; + } free(model); free(layout); @@ -874,14 +877,16 @@ XkbError: goto XkbError; } -XkbEnd: if (nxagentOption(Shadow) == 1 && pDev && pDev->key) { NXShadowInitKeymap(&(pDev->key->curKeySyms)); } - XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); - xkb = NULL; + if (xkb) + { + XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); + xkb = NULL; + } free(model); free(layout); -- cgit v1.2.3 From 05e03b965855e13557745d25eabe63698cb61bc1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 16 Jul 2018 22:23:56 +0200 Subject: Keyboard.c: greatly simplify the code in nxagentKeyboardProc most of the code was existing twice --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 44 ++++++++------------------- 1 file changed, 13 insertions(+), 31 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 84121c1db..ff23ba232 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -828,39 +828,16 @@ XkbError: nxagentKeycodeConversionSetup(); - if (xkb == NULL || xkb->geom == NULL) + if (xkb && xkb->geom) { - #ifdef TEST - fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n"); - if (xkb == NULL) - { - fprintf(stderr, "nxagentKeyboardProc: xkb is null.\n"); - } - else - { - fprintf(stderr, "nxagentKeyboardProc: xkb->geom is null.\n"); - } - fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device.\n"); - #endif - #ifdef DEBUG - fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: " - "[rules='%s',model='%s',layout='%s',variants='%s',options='%s'].\n", - rules, model, layout, variants, options); - #endif - - XkbSetRulesDflts(rules, model, layout, variants, options); - XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, - nxagentBell, nxagentChangeKeyboardControl); - - if (!nxagentKeyboard || strcmp(nxagentKeyboard, "query") == 0) - { - goto XkbError; - } - - goto XkbEnd; + XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); } - - XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); +#ifdef TEST + else + { + fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n"); + } +#endif #ifdef DEBUG fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: " @@ -877,6 +854,11 @@ XkbError: goto XkbError; } + if (xkb && xkb->geom) + { + XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); + } + if (nxagentOption(Shadow) == 1 && pDev && pDev->key) { NXShadowInitKeymap(&(pDev->key->curKeySyms)); -- cgit v1.2.3 From b8ae794e47cf2e23f7391856865d4e06c7a61fd1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 18 Jul 2018 19:14:40 +0200 Subject: Keyboard.c: fix keyboard=query logic an empty nxagentKeyboard variable is no reason to fall back to no-XKB mode --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index ff23ba232..eea09a436 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -849,7 +849,7 @@ XkbError: XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); - if (!nxagentKeyboard || strcmp(nxagentKeyboard, "query") == 0) + if (nxagentKeyboard && strcmp(nxagentKeyboard, "query") == 0) { goto XkbError; } -- cgit v1.2.3 From 59524cd062f87874f11d566a32836a97e8426382 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 18 Jul 2018 22:16:48 +0200 Subject: Keyboard.c: simplify even more: free stuff at one place --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index eea09a436..c2c36ad23 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -723,14 +723,6 @@ XkbError: fprintf(stderr, "nxagentKeyboardProc: XKB error.\n"); #endif - if (xkb) - { - XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); - xkb = NULL; - } - - free(model); - free(layout); #endif XGetKeyboardControl(nxagentDisplay, &values); @@ -863,16 +855,16 @@ XkbError: { NXShadowInitKeymap(&(pDev->key->curKeySyms)); } + } - if (xkb) - { - XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); - xkb = NULL; - } - - free(model); - free(layout); + if (xkb) + { + XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); + xkb = NULL; } + + free(model); + free(layout); #endif #ifdef WATCH -- cgit v1.2.3 From 1ca0aee93d5ab4f4e95f78a1935c7763931f0182 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 25 Jul 2018 22:27:47 +0200 Subject: Event.c: improve DEBUG output --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'nx-X11/programs/Xserver/hw') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 4c85145a9..5281b4b5c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2891,9 +2891,21 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) XFixesSelectionEvent *xfixesEvent = (XFixesSelectionEvent *) X; - if (nxagentXFixesInfo.Initialized == 0 || - xfixesEvent -> type != (nxagentXFixesInfo.EventBase + XFixesSelectionNotify)) - return 0; + if (nxagentXFixesInfo.Initialized == 0) + { + #ifdef DEBUG + fprintf(stderr, "nxagentHandleXFixesSelectionNotify: XFixes not initialized - doing nothing.\n"); + #endif + return 0; + } + + if (xfixesEvent -> type != (nxagentXFixesInfo.EventBase + XFixesSelectionNotify)) + { + #ifdef DEBUG + fprintf(stderr, "nxagentHandleXFixesSelectionNotify: event type is [%d] - doing nothing.\n", xfixesEvent->type); + #endif + return 0; + } #ifdef TEST fprintf(stderr, "nxagentHandleXFixesSelectionNotify: Handling event.\n"); -- cgit v1.2.3