1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Show shortcuts for workspace switching menu entries.

When showing a Workspaces menu entry for switching to a particular
workspace, also show the shortcut if one is bound for switching to that
workspace.
This commit is contained in:
Iain Patterson
2013-03-27 22:50:50 +00:00
committed by Carlos R. Mafra
parent 9b27217b53
commit d25fde4173
2 changed files with 21 additions and 1 deletions

View File

@@ -184,6 +184,8 @@ static int setCursor();
#define REFRESH_ICON_TITLE_COLOR (1<<13) #define REFRESH_ICON_TITLE_COLOR (1<<13)
#define REFRESH_ICON_TITLE_BACK (1<<14) #define REFRESH_ICON_TITLE_BACK (1<<14)
#define REFRESH_WORKSPACE_MENU (1<<15)
#define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
static WOptionEnumeration seFocusModes[] = { static WOptionEnumeration seFocusModes[] = {
@@ -1129,6 +1131,13 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
} }
if (needs_refresh & REFRESH_ICON_TILE) if (needs_refresh & REFRESH_ICON_TILE)
WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL); WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL);
if (needs_refresh & REFRESH_WORKSPACE_MENU) {
if (scr->workspace_menu)
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
if (scr->clip_ws_menu)
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
}
} }
} }
@@ -2840,6 +2849,10 @@ static int setKeyGrab(WScreen * scr, WDefaultEntry * entry, WShortKey * shortcut
wwin = wwin->prev; wwin = wwin->prev;
} }
/* do we need to update window menus? */
if (widx >= WKBD_WORKSPACE1 && widx <= WKBD_WORKSPACE10)
return REFRESH_WORKSPACE_MENU;
return 0; return 0;
} }

View File

@@ -61,6 +61,7 @@ extern int ignore_wks_change;
extern WPreferences wPreferences; extern WPreferences wPreferences;
extern XContext wVEdgeContext; extern XContext wVEdgeContext;
extern void ProcessPendingEvents(); extern void ProcessPendingEvents();
extern WShortKey wKeyBindings[WKBD_LAST];
static WMPropList *dWorkspaces = NULL; static WMPropList *dWorkspaces = NULL;
static WMPropList *dClip, *dName; static WMPropList *dClip, *dName;
@@ -744,12 +745,18 @@ void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu)
wMenuRemoveItem(menu, i); wMenuRemoveItem(menu, i);
} }
} }
wMenuRealize(menu);
for (i = 0; i < scr->workspace_count; i++) { for (i = 0; i < scr->workspace_count; i++) {
/* workspace shortcut labels */
if (i / 10 == scr->current_workspace / 10)
menu->entries[i + MC_WORKSPACE1]->rtext = GetShortcutKey(wKeyBindings[WKBD_WORKSPACE1 + (i % 10)]);
else
menu->entries[i + MC_WORKSPACE1]->rtext = NULL;
menu->entries[i + MC_WORKSPACE1]->flags.indicator_on = 0; menu->entries[i + MC_WORKSPACE1]->flags.indicator_on = 0;
} }
menu->entries[scr->current_workspace + MC_WORKSPACE1]->flags.indicator_on = 1; menu->entries[scr->current_workspace + MC_WORKSPACE1]->flags.indicator_on = 1;
wMenuRealize(menu);
/* don't let user destroy current workspace */ /* don't let user destroy current workspace */
if (scr->current_workspace == scr->workspace_count - 1) { if (scr->current_workspace == scr->workspace_count - 1) {