From e47413eefd28cab5e4591394b5062dcbcf162ce7 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Tue, 26 Mar 2013 16:57:05 +0000 Subject: [PATCH] Change Select menu entry text for selected windows. Other toggle menu items such as Maximize and Shade change their text labels according to the action which will be performed. A shaded window has its Shade menu item text changed to Unshade, for instance. As well as maintaining consistency with other menu items, changing the Select menu entry's text to Deselect for current selected windows provides another (the only) way of reporting that a window is selected when its border has been disabled. Currently the only indication that a window is selected is that its border colour will change. --- src/winmenu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/winmenu.c b/src/winmenu.c index 96609aa8..7bba1a15 100644 --- a/src/winmenu.c +++ b/src/winmenu.c @@ -551,6 +551,20 @@ static void updateMenuForWindow(WMenu * menu, WWindow * wwin) wMenuSetEnabled(menu, MC_SHADE, !WFLAGP(wwin, no_shadeable) && !wwin->flags.miniaturized); + if (wwin->flags.selected) { + static char *text = NULL; + if (!text) + text = _("Deselect"); + + menu->entries[MC_SELECT]->text = text; + } else { + static char *text = NULL; + if (!text) + text = _("Select"); + + menu->entries[MC_SELECT]->text = text; + } + wMenuSetEnabled(menu, MC_DUMMY_MOVETO, !IS_OMNIPRESENT(wwin)); if (!wwin->flags.inspector_open) { @@ -591,6 +605,7 @@ static WMenu *open_window_menu_core(WWindow *wwin, int x, int y) wfree(scr->window_menu->entries[MC_MINIATURIZE]->text); wfree(scr->window_menu->entries[MC_MAXIMIZE]->text); wfree(scr->window_menu->entries[MC_SHADE]->text); + wfree(scr->window_menu->entries[MC_SELECT]->text); } else { updateWorkspaceMenu(scr->workspace_submenu); } @@ -685,6 +700,7 @@ void DestroyWindowMenu(WScreen *scr) scr->window_menu->entries[MC_MINIATURIZE]->text = NULL; scr->window_menu->entries[MC_MAXIMIZE]->text = NULL; scr->window_menu->entries[MC_SHADE]->text = NULL; + scr->window_menu->entries[MC_SELECT]->text = NULL; wMenuDestroy(scr->window_menu, True); scr->window_menu = NULL; } -- 2.11.4.GIT