From: Rodolfo García Peñas (kix) <[email protected]>
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 workspace.last_used because a similar
variable name is also in the WApplication struct.
---
src/WindowMaker.h | 1 +
src/event.c | 4 ++--
src/screen.h | 2 --
src/startup.c | 2 +-
src/workspace.c | 10 +++++-----
5 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index a3cd080..6ea8085 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -484,6 +484,7 @@ extern struct wmaker_global_variables {
/* Workspace related */
struct {
int count; /* number of workspaces */
+ int last_used; /* last used workspace number */
WMFont *font_for_name; /* used during workspace switch */
} workspace;
diff --git a/src/event.c b/src/event.c
index 6cf90a9..9f76a4f 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1578,7 +1578,7 @@ static void handleKeyPress(XEvent * event)
wWorkspaceRelativeChange(scr, -1);
break;
case WKBD_LASTWORKSPACE:
- wWorkspaceChange(scr, scr->last_workspace);
+ wWorkspaceChange(scr, w_global.workspace.last_used);
break;
case WKBD_MOVE_WORKSPACE1 ... WKBD_MOVE_WORKSPACE10:
@@ -1598,7 +1598,7 @@ static void handleKeyPress(XEvent * event)
break;
case WKBD_MOVE_LASTWORKSPACE:
if (wwin)
- wWindowChangeWorkspace(wwin, scr->last_workspace);
+ wWindowChangeWorkspace(wwin,
w_global.workspace.last_used);
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 5015342..53f5978 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -873,7 +873,7 @@ static void manageAllWindows(WScreen * scr, int
crashRecovery)
WMNextEvent(dpy, &ev);
WMHandleEvent(&ev);
}
- scr->last_workspace = 0;
+ w_global.workspace.last_used = 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 de8388f..425421f 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -192,8 +192,8 @@ Bool wWorkspaceDelete(WScreen * scr, int workspace)
if (scr->current_workspace >= w_global.workspace.count)
wWorkspaceChange(scr, w_global.workspace.count - 1);
- if (scr->last_workspace >= w_global.workspace.count)
- scr->last_workspace = 0;
+ if (w_global.workspace.last_used >= w_global.workspace.count)
+ w_global.workspace.last_used = 0;
return True;
}
@@ -479,7 +479,7 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
wClipUpdateForWorkspaceChange(scr, workspace);
- scr->last_workspace = scr->current_workspace;
+ w_global.workspace.last_used = scr->current_workspace;
scr->current_workspace = workspace;
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
@@ -642,7 +642,7 @@ static void switchWSCommand(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, w_global.workspace.last_used);
}
static void deleteWSCommand(WMenu *menu, WMenuEntry *entry)
@@ -787,7 +787,7 @@ void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu)
wMenuSetEnabled(menu, MC_DESTROY_LAST, True);
/* back to last workspace */
- if (w_global.workspace.count && scr->last_workspace !=
scr->current_workspace)
+ if (w_global.workspace.count && w_global.workspace.last_used !=
scr->current_workspace)
wMenuSetEnabled(menu, MC_LAST_USED, True);
else
wMenuSetEnabled(menu, MC_LAST_USED, False);
--
1.8.4.rc3
--
To unsubscribe, send mail to [email protected].