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 last_used_workspace because this
variable name is also in the WApplication struct.
---
 src/event.c     |    4 ++--
 src/screen.h    |    2 --
 src/startup.c   |    2 +-
 src/workspace.c |   10 +++++-----
 src/workspace.h |    1 +
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/event.c b/src/event.c
index 481dc55..2c03a08 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1597,7 +1597,7 @@ static void handleKeyPress(XEvent * event)
                wWorkspaceRelativeChange(scr, -1);
                break;
        case WKBD_LASTWORKSPACE:
-               wWorkspaceChange(scr, scr->last_workspace);
+               wWorkspaceChange(scr, wks_nfo.last_used_workspace);
                break;
 
        case WKBD_MOVE_WORKSPACE1 ... WKBD_MOVE_WORKSPACE10:
@@ -1617,7 +1617,7 @@ static void handleKeyPress(XEvent * event)
                break;
        case WKBD_MOVE_LASTWORKSPACE:
                if (wwin)
-                       wWindowChangeWorkspace(wwin, scr->last_workspace);
+                       wWindowChangeWorkspace(wwin, 
wks_nfo.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 1158eee..46ee752 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -907,7 +907,7 @@ static void manageAllWindows(WScreen * scr, int 
crashRecovery)
                WMNextEvent(dpy, &ev);
                WMHandleEvent(&ev);
        }
-       scr->last_workspace = 0;
+       wks_nfo.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 662a919..b731d22 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -194,8 +194,8 @@ Bool wWorkspaceDelete(WScreen * scr, int workspace)
 
        if (scr->current_workspace >= wks_nfo.workspace_count)
                wWorkspaceChange(scr, wks_nfo.workspace_count - 1);
-       if (scr->last_workspace >= wks_nfo.workspace_count)
-               scr->last_workspace = 0;
+       if (wks_nfo.last_used_workspace >= wks_nfo.workspace_count)
+               wks_nfo.last_used_workspace = 0;
 
        return True;
 }
@@ -485,7 +485,7 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
 
        wClipUpdateForWorkspaceChange(scr, workspace);
 
-       scr->last_workspace = scr->current_workspace;
+       wks_nfo.last_used_workspace = scr->current_workspace;
        scr->current_workspace = workspace;
 
        wWorkspaceMenuUpdate(scr, scr->workspace_menu);
@@ -648,7 +648,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, wks_nfo.last_used_workspace);
 }
 
 static void deleteWSCommand(WMenu * menu, WMenuEntry * entry)
@@ -795,7 +795,7 @@ void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu)
        }
 
        /* back to last workspace */
-       if (wks_nfo.workspace_count && scr->last_workspace != 
scr->current_workspace)
+       if (wks_nfo.workspace_count && wks_nfo.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 28d3727..18492cb 100644
--- a/src/workspace.h
+++ b/src/workspace.h
@@ -24,6 +24,7 @@
 
 typedef struct wks_info {
        int workspace_count;            /* number of workspaces */
+       int last_used_workspace;        /* last used workspace number */
        WMFont *workspace_name_font;
 } wks_info;
 
-- 
1.7.10.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to