From: "Rodolfo García Peñas (kix)" <k...@kix.es> The new function create_new_workspace() creates a workspace when the user request it, using the menu, or using the clip button to the next workspace and is in the last and the flag to create a new workspace is selected.
Then, the code in the functions newWSCommand() and checkWorkspaceChange() is replaced by this function. The function wWorkspaceNew() is now static, because is only used in workspace.c. The call to crossWorkspace() can be removed, because is now done in wWorkspaceForceChange(). Probably, the code in crossWorkspace() can be moved to workspace.c and joined with the code in wWorkspaceForceChange(), but this is other story. --- src/moveres.c | 5 +---- src/workspace.c | 12 ++++++++---- src/workspace.h | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/moveres.c b/src/moveres.c index e3a63b9..7e35887 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -878,10 +878,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); - - crossWorkspace(scr, wwin, opaqueMove, scr->current_workspace + 1, False); + create_new_workspace(scr); changed = True; data->rubCount = 0; } diff --git a/src/workspace.c b/src/workspace.c index 518aafa..8164ed2 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -68,6 +68,7 @@ static WMPropList *dWorkspaces = NULL; static WMPropList *dClip, *dName; static void update_workspace_clip(WScreen *scr, int workspace); +static int wWorkspaceNew(WScreen *scr); static void make_keys(void) { @@ -87,7 +88,7 @@ void wWorkspaceMake(WScreen * scr, int count) } } -int wWorkspaceNew(WScreen *scr) +static int wWorkspaceNew(WScreen *scr) { WWorkspace *wspace, **list; int i; @@ -660,13 +661,16 @@ static void deleteWSCommand(WMenu * menu, WMenuEntry * entry) static void newWSCommand(WMenu *menu, WMenuEntry *foo) { - int ws; + create_new_workspace(menu->frame->screen_ptr); +} - ws = wWorkspaceNew(menu->frame->screen_ptr); +void create_new_workspace(WScreen *scr) +{ + int ws = wWorkspaceNew(scr); /* autochange workspace */ if (ws >= 0) - wWorkspaceChange(menu->frame->screen_ptr, ws); + wWorkspaceChange(scr, ws); } void wWorkspaceRename(WScreen * scr, int workspace, char *name) diff --git a/src/workspace.h b/src/workspace.h index e28c5c2..33f3779 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -30,7 +30,6 @@ typedef struct WWorkspace { } WWorkspace; void wWorkspaceMake(WScreen *scr, int count); -int wWorkspaceNew(WScreen *scr); int wGetWorkspaceNumber(WScreen * scr, char * value); Bool wWorkspaceDelete(WScreen *scr, int workspace); void wWorkspaceChange(WScreen *scr, int workspace); @@ -43,4 +42,5 @@ void wWorkspaceRestoreState(WScreen *scr); void wWorkspaceRename(WScreen *scr, int workspace, char *name); void wWorkspaceRelativeChange(WScreen *scr, int amount); +void create_new_workspace(WScreen *scr); #endif -- 1.7.10.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.