1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +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 */
WMFont *font_for_name; /* used during workspace switch */
/* Menus */
struct WMenu *menu; /* workspace operation */
} workspace;
/* definition for X Atoms */

View File

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

View File

@@ -2264,9 +2264,9 @@ void wMenuSaveState(WScreen * scr)
if (saveMenuRecurs(menus, scr, scr->root_menu))
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");
saveMenuInfo(menus, scr->workspace_menu, key);
saveMenuInfo(menus, w_global.workspace.menu, key);
WMReleasePropList(key);
save_menus = 1;
}

View File

@@ -757,8 +757,8 @@ static void constructPLMenuFromPipe(WMenu * menu, WMenuEntry * entry)
}
static void cleanupWorkspaceMenu(WMenu *menu)
{
if (menu->frame->screen_ptr->workspace_menu == menu)
menu->frame->screen_ptr->workspace_menu = NULL;
if (w_global.workspace.menu == menu)
w_global.workspace.menu = NULL;
}
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->on_destroy = cleanupWorkspaceMenu;
scr->workspace_menu = wsmenu;
w_global.workspace.menu = wsmenu;
entry = wMenuAddCallback(menu, title, NULL, NULL);
wMenuEntrySetCascade(menu, entry, wsmenu);

View File

@@ -209,7 +209,6 @@ typedef struct _WScreen {
struct WMenu *root_menu; /* root window menu */
struct WMenu *switch_menu; /* window list menu */
struct WMenu *workspace_menu; /* workspace operation */
struct WMenu *window_menu; /* window command menu */
struct WMenu *icon_menu; /* icon/appicon 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;
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
wWorkspaceMenuUpdate(scr, w_global.workspace.menu);
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
wNETWMUpdateDesktop(scr);
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--;
/* update menu */
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
wWorkspaceMenuUpdate(scr, w_global.workspace.menu);
/* clip workspace 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.current = workspace;
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
wWorkspaceMenuUpdate(scr, w_global.workspace.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);
}
}
if (scr->workspace_menu) {
if (strcmp(scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) {
wfree(scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text);
scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf);
wMenuRealize(scr->workspace_menu);
if (w_global.workspace.menu) {
if (strcmp(w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) {
wfree(w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text);
w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf);
wMenuRealize(w_global.workspace.menu);
}
}
@@ -856,10 +856,10 @@ void wWorkspaceRestoreState(WScreen *scr)
if (i >= w_global.workspace.count)
wWorkspaceNew(scr);
if (scr->workspace_menu) {
wfree(scr->workspace_menu->entries[i + MC_WORKSPACE1]->text);
scr->workspace_menu->entries[i + MC_WORKSPACE1]->text = wstrdup(WMGetFromPLString(pstr));
scr->workspace_menu->flags.realized = 0;
if (w_global.workspace.menu) {
wfree(w_global.workspace.menu->entries[i + MC_WORKSPACE1]->text);
w_global.workspace.menu->entries[i + MC_WORKSPACE1]->text = wstrdup(WMGetFromPLString(pstr));
w_global.workspace.menu->flags.realized = 0;
}
wfree(w_global.workspace.array[i]->name);