From a43f369ec382fee245e7cb10f6e4ea8fc8ab2f4f Mon Sep 17 00:00:00 2001 From: id Date: Sat, 29 May 1999 15:45:19 +0000 Subject: [PATCH] XKB lock relate. Allow you to disable language button in advance setting. --- src/wdefaults.c | 11 +++++++++++ src/window.c | 15 +++++++++++++++ src/winspector.c | 30 ++++++++++++++++++++++++++++++ src/winspector.h | 4 ++++ 4 files changed, 60 insertions(+) diff --git a/src/wdefaults.c b/src/wdefaults.c index dfe51f9d..b6279b74 100644 --- a/src/wdefaults.c +++ b/src/wdefaults.c @@ -83,6 +83,9 @@ static proplist_t AStartHidden; /* app */ static proplist_t ADontSaveSession; /* app */ static proplist_t AEmulateAppIcon; static proplist_t AFullMaximize; +#ifdef XKB_BUTTON_HINT +static proplist_t ANoLanguageButton; +#endif static proplist_t AStartWorkspace; @@ -119,6 +122,9 @@ init_wdefaults(WScreen *scr) ADontSaveSession = PLMakeString("DontSaveSession"); AEmulateAppIcon = PLMakeString("EmulateAppIcon"); AFullMaximize = PLMakeString("FullMaximize"); +#ifdef XKB_BUTTON_HINT + ANoLanguageButton = PLMakeString("NoLanguageButton"); +#endif AStartWorkspace = PLMakeString("StartWorkspace"); @@ -304,6 +310,11 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class, value = get_value(dw, dc, dn, da, AFullMaximize, No, useGlobalDefault); APPLY_VAL(value, full_maximize, AFullMaximize); +#ifdef XKB_BUTTON_HINT + value = get_value(dw, dc, dn, da, ANoLanguageButton, No, useGlobalDefault); + APPLY_VAL(value, no_language_button, ANoLanguageButton); +#endif + /* clean up */ PLSetStringCmpHook(StringCompareHook); } diff --git a/src/window.c b/src/window.c index a01448dc..31dbb6d7 100644 --- a/src/window.c +++ b/src/window.c @@ -2086,6 +2086,9 @@ wWindowConfigureBorders(WWindow *wwin) int newy, oldh; flags = WFF_LEFT_BUTTON|WFF_RIGHT_BUTTON; +#ifdef XKB_BUTTON_HINT + flags |= WFF_LANGUAGE_BUTTON; +#endif if (!WFLAGP(wwin, no_titlebar)) flags |= WFF_TITLEBAR; if (!WFLAGP(wwin, no_resizebar)) @@ -2108,6 +2111,12 @@ wWindowConfigureBorders(WWindow *wwin) && wwin->frame->flags.hide_left_button) flags |= WFF_LEFT_BUTTON; +#ifdef XKB_BUTTON_HINT + if (!WFLAGP(wwin, no_language_button) + && wwin->frame->flags.hide_language_button) + flags |= WFF_LANGUAGE_BUTTON; +#endif + if (!WFLAGP(wwin, no_close_button) && wwin->frame->flags.hide_right_button) flags |= WFF_RIGHT_BUTTON; @@ -2122,6 +2131,12 @@ wWindowConfigureBorders(WWindow *wwin) && !wwin->frame->flags.hide_left_button) flags |= WFF_LEFT_BUTTON; +#ifdef XKB_BUTTON_HINT + if (WFLAGP(wwin, no_language_button) + && !wwin->frame->flags.hide_language_button) + flags |= WFF_LANGUAGE_BUTTON; +#endif + if (WFLAGP(wwin, no_close_button) && !wwin->frame->flags.hide_right_button) flags |= WFF_RIGHT_BUTTON; diff --git a/src/winspector.c b/src/winspector.c index 3853860c..079191ba 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -74,6 +74,9 @@ static proplist_t AStartMaximized; static proplist_t ADontSaveSession; static proplist_t AEmulateAppIcon; static proplist_t AFullMaximize; +#ifdef XKB_BUTTON_HINT +static proplist_t ANoLanguageButton; +#endif static proplist_t AStartWorkspace; @@ -122,6 +125,9 @@ make_keys() ADontSaveSession = PLMakeString("DontSaveSession"); AEmulateAppIcon = PLMakeString("EmulateAppIcon"); AFullMaximize = PLMakeString("FullMaximize"); +#ifdef XKB_BUTTON_HINT + ANoLanguageButton = PLMakeString("NoLanguageButton"); +#endif AStartWorkspace = PLMakeString("StartWorkspace"); @@ -534,6 +540,11 @@ saveSettings(WMButton *button, InspectorPanel *panel) value = (WMGetButtonSelected(panel->moreChk[7])!=0) ? Yes : No; insertAttribute(dict, winDic, AFullMaximize, value, &different, flags); +#ifdef XKB_BUTTON_HINT + value = (WMGetButtonSelected(panel->moreChk[8])!=0) ? Yes : No; + insertAttribute(dict, winDic, ANoLanguageButton, value, &different, flags); +#endif + /* application wide settings for when */ /* the window is the leader, save the attribute with the others */ if (panel->inspected->main_window == panel->inspected->client_win) { @@ -713,6 +724,9 @@ applySettings(WMButton *button, InspectorPanel *panel) WSETUFLAG(wwin, dont_save_session, WMGetButtonSelected(panel->moreChk[5])); WSETUFLAG(wwin, emulate_appicon, WMGetButtonSelected(panel->moreChk[6])); WSETUFLAG(wwin, full_maximize, WMGetButtonSelected(panel->moreChk[7])); +#ifdef XKB_BUTTON_HINT + WSETUFLAG(wwin, no_language_button, WMGetButtonSelected(panel->moreChk[8])); +#endif WSETUFLAG(wwin, always_user_icon, WMGetButtonSelected(panel->alwChk)); if (WFLAGP(wwin, no_titlebar) && wwin->flags.shaded) @@ -885,6 +899,11 @@ revertSettings(WMButton *button, InspectorPanel *panel) case 7: flag = WFLAGP(wwin, full_maximize); break; +#ifdef XKB_BUTTON_HINT + case 8: + flag = WFLAGP(wwin, no_language_button); + break; +#endif } WMSetButtonSelected(panel->moreChk[i], flag); } @@ -1194,7 +1213,11 @@ createInspectorForWindow(WWindow *wwin) WMMoveWidget(panel->moreFrm, 15, 45); WMResizeWidget(panel->moreFrm, frame_width, 250); +#ifdef XKB_BUTTON_HINT + for (i=0; i < 9; i++) { +#else for (i=0; i < 8; i++) { +#endif char *caption = NULL; int flag = 0; char *descr = NULL; @@ -1255,6 +1278,13 @@ createInspectorForWindow(WWindow *wwin) "maximized. The titlebar and resizebar will be moved\n" "to outside the screen."); break; +#ifdef XKB_BUTTON_HINT + case 8: + caption = _("Disable Language Button"); + flag = WFLAGP(wwin, no_language_button); + descr = _("Remove the `toggle language' button of the window."); + break; +#endif } panel->moreChk[i] = WMCreateSwitchButton(panel->moreFrm); WMMoveWidget(panel->moreChk[i], 10, 20*(i+1)); diff --git a/src/winspector.h b/src/winspector.h index eceee289..2550cafe 100644 --- a/src/winspector.h +++ b/src/winspector.h @@ -60,7 +60,11 @@ typedef struct InspectorPanel { /* 3rd page. more attributes */ WMFrame *moreFrm; +#ifdef XKB_BUTTON_HINT + WMButton *moreChk[9]; +#else WMButton *moreChk[8]; +#endif /* 4th page. icon and workspace */ WMFrame *iconFrm;