From: "Rodolfo García Peñas (kix)" <[email protected]>

The function wWorkspaceRestoreState() creates two Clips:

1. First, calling wWorkspaceNew(), because this function creates
   a new Workspace, with the Clip included.
2. Second, calling wDockRestoreState(), because this function creates
   a new Clip and recover their icon position.

Then, if the function wWorkspaceNew() includes a flag to know if that
function needs create the Clip, we don't need crate the Clip, destroy
it and create it again.

Finally, the code in screen.h creates an extra Clip. This patches removes
this extra Clip, selecting the workspace creation without Clip in that code.

Signed-off-by: Rodolfo García Peñas (kix) <[email protected]>
---
 src/moveres.c   |    2 +-
 src/screen.c    |    2 +-
 src/workspace.c |   13 +++++--------
 src/workspace.h |    2 +-
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/moveres.c b/src/moveres.c
index e3a63b9..4ec96e3 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -879,7 +879,7 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData * 
data, Bool opaqueMov
                        /* create a new workspace */
                        if (abs(data->rubCount) > 2) {
                                /* go to next workspace */
-                               wWorkspaceNew(scr);
+                               wWorkspaceNew(scr, True);
 
                                crossWorkspace(scr, wwin, opaqueMove, 
scr->current_workspace + 1, False);
                                changed = True;
diff --git a/src/screen.c b/src/screen.c
index e8cc5a9..6ae613a 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -661,7 +661,7 @@ WScreen *wScreenInit(int screen_number)
        wNETWMInitStuff(scr);
 
        /* create initial workspace */
-       wWorkspaceNew(scr);
+       wWorkspaceNew(scr, False);
 
        /* create shared pixmaps */
        createPixmaps(scr);
diff --git a/src/workspace.c b/src/workspace.c
index 5bc8ba0..f0a0031 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -80,12 +80,12 @@ static void make_keys(void)
 void wWorkspaceMake(WScreen * scr, int count)
 {
        while (count > 0) {
-               wWorkspaceNew(scr);
+               wWorkspaceNew(scr, True);
                count--;
        }
 }
 
-int wWorkspaceNew(WScreen *scr)
+int wWorkspaceNew(WScreen *scr, Bool with_clip)
 {
        WWorkspace *wspace, **list;
        int i;
@@ -102,7 +102,7 @@ int wWorkspaceNew(WScreen *scr)
                        sprintf(wspace->name, _("Workspace %i"), 
scr->workspace_count);
                }
 
-               if (!wPreferences.flags.noclip)
+               if (!wPreferences.flags.noclip && with_clip)
                        wspace->clip = wDockCreate(scr, WM_CLIP);
 
                list = wmalloc(sizeof(WWorkspace *) * scr->workspace_count);
@@ -637,7 +637,7 @@ static void newWSCommand(WMenu *menu, WMenuEntry *foo)
 {
        int ws;
 
-       ws = wWorkspaceNew(menu->frame->screen_ptr);
+       ws = wWorkspaceNew(menu->frame->screen_ptr, True);
 
        /* autochange workspace */
        if (ws >= 0)
@@ -839,7 +839,7 @@ void wWorkspaceRestoreState(WScreen *scr)
                        pstr = wks_state;
 
                if (i >= scr->workspace_count)
-                       wWorkspaceNew(scr);
+                       wWorkspaceNew(scr, False);
 
                if (scr->workspace_menu) {
                        wfree(scr->workspace_menu->entries[i + 
MC_WORKSPACE1]->text);
@@ -853,9 +853,6 @@ void wWorkspaceRestoreState(WScreen *scr)
                        int added_omnipresent_icons = 0;
 
                        clip_state = WMGetFromPLDictionary(wks_state, dClip);
-                       if (scr->workspaces[i]->clip)
-                               wDockDestroy(scr->workspaces[i]->clip);
-
                        scr->workspaces[i]->clip = wDockRestoreState(scr, 
clip_state, WM_CLIP);
                        if (i > 0)
                                wDockHideIcons(scr->workspaces[i]->clip);
diff --git a/src/workspace.h b/src/workspace.h
index e28c5c2..7985ca6 100644
--- a/src/workspace.h
+++ b/src/workspace.h
@@ -30,7 +30,7 @@ typedef struct WWorkspace {
 } WWorkspace;
 
 void wWorkspaceMake(WScreen *scr, int count);
-int wWorkspaceNew(WScreen *scr);
+int wWorkspaceNew(WScreen *scr, Bool with_clip);
 int wGetWorkspaceNumber(WScreen * scr, char * value);
 Bool wWorkspaceDelete(WScreen *scr, int workspace);
 void wWorkspaceChange(WScreen *scr, int workspace);
-- 
1.7.10.4


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

Reply via email to