1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

Variable workspace_menu moved to workspace object in global namespace

The variable workspace_menu, that contains the workspace_menu
is moved to the global workspace properties.

Now the screen is not needed to know the workspace_menu.

This variable is moved to the global workspace struct because it is
related to the workspace system, and not to the screen.
This commit is contained in:
Rodolfo García Peñas (kix)
2013-10-08 00:56:34 +02:00
committed by Carlos R. Mafra
parent f0c5073600
commit 9c252988f8
6 changed files with 22 additions and 20 deletions

View File

@@ -490,6 +490,9 @@ extern struct wmaker_global_variables {
int last_used; /* last used workspace number */ int last_used; /* last used workspace number */
WMFont *font_for_name; /* used during workspace switch */ WMFont *font_for_name; /* used during workspace switch */
/* Menus */
struct WMenu *menu; /* workspace operation */
} workspace; } workspace;
/* definition for X Atoms */ /* definition for X Atoms */

View File

@@ -1202,8 +1202,8 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL); WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL);
if (needs_refresh & REFRESH_WORKSPACE_MENU) { if (needs_refresh & REFRESH_WORKSPACE_MENU) {
if (scr->workspace_menu) if (w_global.workspace.menu)
wWorkspaceMenuUpdate(scr, scr->workspace_menu); wWorkspaceMenuUpdate(scr, w_global.workspace.menu);
if (scr->clip_ws_menu) if (scr->clip_ws_menu)
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu); wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
if (scr->workspace_submenu) if (scr->workspace_submenu)

View File

@@ -2264,9 +2264,9 @@ void wMenuSaveState(WScreen * scr)
if (saveMenuRecurs(menus, scr, scr->root_menu)) if (saveMenuRecurs(menus, scr, scr->root_menu))
save_menus = 1; save_menus = 1;
if (scr->workspace_menu && scr->workspace_menu->flags.buttoned) { if (w_global.workspace.menu && w_global.workspace.menu->flags.buttoned) {
key = WMCreatePLString("WorkspaceMenu"); key = WMCreatePLString("WorkspaceMenu");
saveMenuInfo(menus, scr->workspace_menu, key); saveMenuInfo(menus, w_global.workspace.menu, key);
WMReleasePropList(key); WMReleasePropList(key);
save_menus = 1; save_menus = 1;
} }

View File

@@ -757,8 +757,8 @@ static void constructPLMenuFromPipe(WMenu * menu, WMenuEntry * entry)
} }
static void cleanupWorkspaceMenu(WMenu *menu) static void cleanupWorkspaceMenu(WMenu *menu)
{ {
if (menu->frame->screen_ptr->workspace_menu == menu) if (w_global.workspace.menu == menu)
menu->frame->screen_ptr->workspace_menu = NULL; w_global.workspace.menu = NULL;
} }
static WMenuEntry *addWorkspaceMenu(WScreen *scr, WMenu *menu, const char *title) static WMenuEntry *addWorkspaceMenu(WScreen *scr, WMenu *menu, const char *title)
@@ -776,7 +776,7 @@ static WMenuEntry *addWorkspaceMenu(WScreen *scr, WMenu *menu, const char *title
wsmenu = wWorkspaceMenuMake(scr, True); wsmenu = wWorkspaceMenuMake(scr, True);
wsmenu->on_destroy = cleanupWorkspaceMenu; wsmenu->on_destroy = cleanupWorkspaceMenu;
scr->workspace_menu = wsmenu; w_global.workspace.menu = wsmenu;
entry = wMenuAddCallback(menu, title, NULL, NULL); entry = wMenuAddCallback(menu, title, NULL, NULL);
wMenuEntrySetCascade(menu, entry, wsmenu); wMenuEntrySetCascade(menu, entry, wsmenu);

View File

@@ -209,7 +209,6 @@ typedef struct _WScreen {
struct WMenu *root_menu; /* root window menu */ struct WMenu *root_menu; /* root window menu */
struct WMenu *switch_menu; /* window list menu */ struct WMenu *switch_menu; /* window list menu */
struct WMenu *workspace_menu; /* workspace operation */
struct WMenu *window_menu; /* window command menu */ struct WMenu *window_menu; /* window command menu */
struct WMenu *icon_menu; /* icon/appicon menu */ struct WMenu *icon_menu; /* icon/appicon menu */
struct WMenu *workspace_submenu; /* workspace list for window_menu */ struct WMenu *workspace_submenu; /* workspace list for window_menu */

View File

@@ -114,7 +114,7 @@ int wWorkspaceNew(WScreen *scr)
w_global.workspace.array = list; w_global.workspace.array = list;
wWorkspaceMenuUpdate(scr, scr->workspace_menu); wWorkspaceMenuUpdate(scr, w_global.workspace.menu);
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu); wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
wNETWMUpdateDesktop(scr); wNETWMUpdateDesktop(scr);
WMPostNotificationName(WMNWorkspaceCreated, scr, (void *)(uintptr_t) (w_global.workspace.count - 1)); WMPostNotificationName(WMNWorkspaceCreated, scr, (void *)(uintptr_t) (w_global.workspace.count - 1));
@@ -165,7 +165,7 @@ Bool wWorkspaceDelete(WScreen * scr, int workspace)
w_global.workspace.count--; w_global.workspace.count--;
/* update menu */ /* update menu */
wWorkspaceMenuUpdate(scr, scr->workspace_menu); wWorkspaceMenuUpdate(scr, w_global.workspace.menu);
/* clip workspace menu */ /* clip workspace menu */
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu); wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
@@ -482,7 +482,7 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
w_global.workspace.last_used = w_global.workspace.current; w_global.workspace.last_used = w_global.workspace.current;
w_global.workspace.current = workspace; w_global.workspace.current = workspace;
wWorkspaceMenuUpdate(scr, scr->workspace_menu); wWorkspaceMenuUpdate(scr, w_global.workspace.menu);
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu); wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
@@ -691,11 +691,11 @@ void wWorkspaceRename(WScreen *scr, int workspace, const char *name)
wMenuRealize(scr->clip_ws_menu); wMenuRealize(scr->clip_ws_menu);
} }
} }
if (scr->workspace_menu) { if (w_global.workspace.menu) {
if (strcmp(scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) { if (strcmp(w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) {
wfree(scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text); wfree(w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text);
scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf); w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf);
wMenuRealize(scr->workspace_menu); wMenuRealize(w_global.workspace.menu);
} }
} }
@@ -856,10 +856,10 @@ void wWorkspaceRestoreState(WScreen *scr)
if (i >= w_global.workspace.count) if (i >= w_global.workspace.count)
wWorkspaceNew(scr); wWorkspaceNew(scr);
if (scr->workspace_menu) { if (w_global.workspace.menu) {
wfree(scr->workspace_menu->entries[i + MC_WORKSPACE1]->text); wfree(w_global.workspace.menu->entries[i + MC_WORKSPACE1]->text);
scr->workspace_menu->entries[i + MC_WORKSPACE1]->text = wstrdup(WMGetFromPLString(pstr)); w_global.workspace.menu->entries[i + MC_WORKSPACE1]->text = wstrdup(WMGetFromPLString(pstr));
scr->workspace_menu->flags.realized = 0; w_global.workspace.menu->flags.realized = 0;
} }
wfree(w_global.workspace.array[i]->name); wfree(w_global.workspace.array[i]->name);