On Thu, 04 Apr 2013, Daniel Déchelotte escribió: > > 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. > > Yep, good catch. Let's try to avoid that. > > > 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. > > Adding a boolean controling whether a clip should > be created when creating a workspace is a sensible solution, but I > wonder if a better solution could be to make wDockRestoreState _not_ > create a new dock. In Object-Oriented words, it would stopping being a > constructor, it would just be a member function that fills an existing > dock with the provided information. I'm not sure it will prevent the > clip from flashing at the top left corner on startup, but it might.
I tried to avoid the clip creation in the wDockRestore, try it :-) wmaker crash. Why? Because the first clip sets the values for scr->clip* (yes, the clip_icon too), and the clip_icon is used later to create the dock used by the clip, then crash. Probably is not the better way, but... is a way. Now you know the problem (double Clip creation), feel free to think in other patches. I could help you with them. Sometimes my patches are not the best,... and sometimes is better to include a dirty patch, remove the extra-code and then re-patch with a smart code. Cheers, kix > -- Daniel > > > 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]. > > -- ||// //\\// Rodolfo "kix" Garcia ||\\// //\\ http://www.kix.es/ -- To unsubscribe, send mail to [email protected].
