diff --git a/src/dialog.c b/src/dialog.c index 06d35542..6e9e7648 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -1143,7 +1143,7 @@ wShowInfoPanel(WScreen *scr) WSETUFLAG(wwin, no_closable, 0); WSETUFLAG(wwin, no_close_button, 0); #ifdef XKB_BUTTON_HINT - wFrameWindowHideButton(wwin->frame, WFF_XKB_BUTTON); + wFrameWindowHideButton(wwin->frame, WFF_LANGUAGE_BUTTON); #endif wWindowUpdateButtonImages(wwin); wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON); @@ -1262,7 +1262,7 @@ wShowLegalPanel(WScreen *scr) wWindowUpdateButtonImages(wwin); wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON); #ifdef XKB_BUTTON_HINT - wFrameWindowHideButton(wwin->frame, WFF_XKB_BUTTON); + wFrameWindowHideButton(wwin->frame, WFF_LANGUAGE_BUTTON); #endif wwin->frame->on_click_right = destroyLegalPanel; @@ -1682,7 +1682,7 @@ wShowGNUstepPanel(WScreen *scr) wWindowUpdateButtonImages(wwin); wFrameWindowShowButton(wwin->frame, WFF_RIGHT_BUTTON); #ifdef XKB_BUTTON_HINT - wFrameWindowHideButton(wwin->frame, WFF_XKB_BUTTON); + wFrameWindowHideButton(wwin->frame, WFF_LANGUAGE_BUTTON); #endif wwin->frame->on_click_right = destroyGNUstepPanel; diff --git a/src/event.c b/src/event.c index 99b4a4de..798d6e78 100644 --- a/src/event.c +++ b/src/event.c @@ -450,10 +450,8 @@ saveTimestamp(XEvent *event) static void handleExtensions(XEvent *event) { -#ifdef KEEP_XKB_LOCK_STATUS XkbEvent *xkbevent; xkbevent = (XkbEvent *)event; -#endif /*KEEP_XKB_LOCK_STATUS*/ #ifdef SHAPE if (wShapeSupported && event->type == (wShapeEventBase+ShapeNotify)) { handleShapeNotify(event); diff --git a/src/framewin.c b/src/framewin.c index c90b5646..8ff9c2ab 100644 --- a/src/framewin.c +++ b/src/framewin.c @@ -253,7 +253,7 @@ wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags) } #ifdef XKB_BUTTON_HINT - if (flags & WFF_XKB_BUTTON) { + if (flags & WFF_LANGUAGE_BUTTON) { fwin->flags.language_button = 1; if (wPreferences.new_style) { fwin->language_button = wCoreCreate(fwin->core, @@ -545,7 +545,7 @@ wFrameWindowHideButton(WFrameWindow *fwin, int flags) } #ifdef XKB_BUTTON_HINT - if ((flags & WFF_XKB_BUTTON) && fwin->language_button) { + if ((flags & WFF_LANGUAGE_BUTTON) && fwin->language_button) { XUnmapWindow(dpy, fwin->language_button->window); fwin->flags.hide_language_button = 1; } @@ -580,7 +580,7 @@ wFrameWindowShowButton(WFrameWindow *fwin, int flags) } #ifdef XKB_BUTTON_HINT - if ((flags & WFF_XKB_BUTTON) && fwin->language_button + if ((flags & WFF_LANGUAGE_BUTTON) && fwin->language_button && fwin->flags.hide_language_button) { if (!fwin->flags.languagebutton_dont_fit) diff --git a/src/framewin.h b/src/framewin.h index 4dd98f33..2e1a5a58 100644 --- a/src/framewin.h +++ b/src/framewin.h @@ -37,7 +37,7 @@ #define WFF_BORDER (1<<4) #define WFF_SINGLE_STATE (1<<5) #ifdef XKB_BUTTON_HINT -#define WFF_XKB_BUTTON (1<<6) +#define WFF_LANGUAGE_BUTTON (1<<6) #endif diff --git a/src/main.c b/src/main.c index 5d260337..231b23c3 100644 --- a/src/main.c +++ b/src/main.c @@ -127,6 +127,10 @@ Bool wShapeSupported; int wShapeEventBase; #endif +#ifdef KEEP_XKB_LOCK_STATUS +Bool wXkbSupported; +int wXkbEventBase; +#endif /* special flags */ char WProgramState = WSTATE_NORMAL; diff --git a/src/startup.c b/src/startup.c index 3dc3d419..258a6d55 100644 --- a/src/startup.c +++ b/src/startup.c @@ -97,6 +97,11 @@ extern Bool wShapeSupported; extern int wShapeEventBase; #endif +#ifdef KEEP_XKB_LOCK_STATUS +extern Bool wXkbSupported; +extern int wXkbEventBase; +#endif + /* contexts */ extern XContext wWinContext; extern XContext wAppWinContext; @@ -793,6 +798,14 @@ StartUp(Bool defaultScreenOnly) /* ignore j */ wShapeSupported = XShapeQueryExtension(dpy, &wShapeEventBase, &j); #endif + +#ifdef KEEP_XKB_LOCK_STATUS + wXkbSupported = XkbQueryExtension(dpy, NULL, &wXkbEventBase, NULL, NULL, NULL); + if(wPreferences.modelock && !wXkbSupported) { + wwarning(_("XKB is not supported. KbdModeLock is automatically disabled.")); + wPreferences.modelock = 0; + } +#endif if (defaultScreenOnly) { max = 1; diff --git a/src/window.c b/src/window.c index 8f9436c9..06d4f682 100644 --- a/src/window.c +++ b/src/window.c @@ -893,7 +893,7 @@ wManageWindow(WScreen *scr, Window window) foo = WFF_LEFT_BUTTON | WFF_RIGHT_BUTTON; #ifdef XKB_BUTTON_HINT if (wPreferences.modelock) - foo |= WFF_XKB_BUTTON; + foo |= WFF_LANGUAGE_BUTTON; #endif if (!WFLAGP(wwin, no_titlebar)) foo |= WFF_TITLEBAR; @@ -920,6 +920,10 @@ wManageWindow(WScreen *scr, Window window) foo |= WFF_RIGHT_BUTTON; if (WFLAGP(wwin, no_miniaturize_button)) foo |= WFF_LEFT_BUTTON; +#ifdef XKB_BUTTON_HINT + if (WFLAGP(wwin, no_language_button) || WFLAGP(wwin, no_focusable)) + foo |= WFF_LANGUAGE_BUTTON; +#endif if (foo!=0) wFrameWindowHideButton(wwin->frame, foo); @@ -1254,7 +1258,7 @@ wManageInternalWindow(WScreen *scr, Window window, Window owner, foo = WFF_RIGHT_BUTTON; foo |= WFF_TITLEBAR; #ifdef XKB_BUTTON_HINT - foo |= WFF_XKB_BUTTON; + foo |= WFF_LANGUAGE_BUTTON; #endif wwin->frame = wFrameWindowCreate(scr, WMFloatingLevel,