The variable last_workspace, that contains the last used workspace is moved to the global workspace properties.
Now the screen is not needed to know the workspace_count. The variable name is changed to last_used_workspace because this variable name is also in the WApplication struct. Signed-off-by: Rodolfo García Peñas (kix) <[email protected]> --- src/event.c | 4 ++-- src/screen.h | 2 -- src/startup.c | 2 +- src/workspace.c | 12 ++++++------ src/workspace.h | 1 + 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/event.c b/src/event.c index f98546d..5de82c0 100644 --- a/src/event.c +++ b/src/event.c @@ -1579,7 +1579,7 @@ static void handleKeyPress(XEvent * event) wWorkspaceRelativeChange(scr, -1); break; case WKBD_LASTWORKSPACE: - wWorkspaceChange(scr, scr->last_workspace); + wWorkspaceChange(scr, wks_info.last_used_workspace); break; case WKBD_MOVE_WORKSPACE1 ... WKBD_MOVE_WORKSPACE10: @@ -1599,7 +1599,7 @@ static void handleKeyPress(XEvent * event) break; case WKBD_MOVE_LASTWORKSPACE: if (wwin) - wWindowChangeWorkspace(wwin, scr->last_workspace); + wWindowChangeWorkspace(wwin, wks_info.last_used_workspace); break; case WKBD_MOVE_NEXTWSLAYER: diff --git a/src/screen.h b/src/screen.h index 4ac9a96..dd13d6c 100644 --- a/src/screen.h +++ b/src/screen.h @@ -124,8 +124,6 @@ typedef struct _WScreen { struct WWorkspace **workspaces; /* workspace array */ int current_workspace; /* current workspace number */ - int last_workspace; /* last used workspace number */ - WReservedArea *reservedAreas; /* used to build totalUsableArea */ diff --git a/src/startup.c b/src/startup.c index c3a5f45..3fc8756 100644 --- a/src/startup.c +++ b/src/startup.c @@ -874,7 +874,7 @@ static void manageAllWindows(WScreen * scr, int crashRecovery) WMNextEvent(dpy, &ev); WMHandleEvent(&ev); } - scr->last_workspace = 0; + wks_info.last_used_workspace = 0; wWorkspaceForceChange(scr, 0); if (!wPreferences.flags.noclip) wDockShowIcons(scr->workspaces[scr->current_workspace]->clip); diff --git a/src/workspace.c b/src/workspace.c index 0b4527f..5f4a9d2 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -193,8 +193,8 @@ Bool wWorkspaceDelete(WScreen * scr, int workspace) if (scr->current_workspace >= wks_info.workspace_count) wWorkspaceChange(scr, wks_info.workspace_count - 1); - if (scr->last_workspace >= wks_info.workspace_count) - scr->last_workspace = 0; + if (wks_info.last_used_workspace >= wks_info.workspace_count) + wks_info.last_used_workspace = 0; return True; } @@ -480,7 +480,7 @@ void wWorkspaceForceChange(WScreen * scr, int workspace) wClipUpdateForWorkspaceChange(scr, workspace); - scr->last_workspace = scr->current_workspace; + wks_info.last_used_workspace = scr->current_workspace; scr->current_workspace = workspace; wWorkspaceMenuUpdate(scr, scr->workspace_menu); @@ -641,9 +641,9 @@ static void switchWSCommand(WMenu * menu, WMenuEntry * entry) wWorkspaceChange(menu->frame->screen_ptr, (long)entry->clientdata); } -static void lastWSCommand(WMenu * menu, WMenuEntry * entry) +static void lastWSCommand(WMenu *menu, WMenuEntry *entry) { - wWorkspaceChange(menu->frame->screen_ptr, menu->frame->screen_ptr->last_workspace); + wWorkspaceChange(menu->frame->screen_ptr, wks_info.last_used_workspace); } static void deleteWSCommand(WMenu *menu, WMenuEntry *entry) @@ -788,7 +788,7 @@ void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu) wMenuSetEnabled(menu, MC_DESTROY_LAST, True); /* back to last workspace */ - if (wks_info.workspace_count && scr->last_workspace != scr->current_workspace) + if (wks_info.workspace_count && wks_info.last_used_workspace != scr->current_workspace) wMenuSetEnabled(menu, MC_LAST_USED, True); else wMenuSetEnabled(menu, MC_LAST_USED, False); diff --git a/src/workspace.h b/src/workspace.h index 48d05e9..44b0e42 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -31,6 +31,7 @@ typedef struct WWorkspace { typedef struct WWorkspace_info { /* Workspace stuff */ int workspace_count; /* number of workspaces */ + int last_used_workspace; /* last used workspace number */ WMFont *workspace_name_font; } WWorkspace_info; -- 1.8.4.rc3 -- To unsubscribe, send mail to [email protected].
