On Sun, 14 Apr 2013 at 23:13:31 +0200, Rodolfo García Peñas (kix) wrote:
> 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.
> ---
> src/moveres.c | 2 +-
> src/screen.c | 2 +-
> src/workspace.c | 12 ++++++------
> src/workspace.h | 2 +-
> 4 files changed, 9 insertions(+), 9 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 37e4da3..4b40537 100644
> --- a/src/screen.c
> +++ b/src/screen.c
> @@ -663,7 +663,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 3289b86..b0d6891 100644
> --- a/src/workspace.c
> +++ b/src/workspace.c
> @@ -77,15 +77,15 @@ static void make_keys(void)
> dClip = WMCreatePLString("Clip");
> }
>
> -void wWorkspaceMake(WScreen * scr, int count)
> +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)
This seems redundant.
Why can't you use the noclip flag directly instead of adding the new
with_clip argument? Ie, if the noclip flag is set then that should be
equivalent to your !with_clip case.
> wspace->clip = wDockCreate(scr, WM_CLIP, NULL);
>
> list = wmalloc(sizeof(WWorkspace *) * scr->workspace_count);
> @@ -660,7 +660,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)
> @@ -862,7 +862,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);
> 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].
--
To unsubscribe, send mail to [email protected].