mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
WindowMaker: New function wGetWorkspaceNumber
The new function wGetWorkspaceNumber returns the workspace number for a given workspace name. The code of this function is already used in session.c and wdefaults.c and now is moved to workspace.c In wSessionRestoreLastWorkspace the char value is checked before calling the function, because without string, the function don't do nothing.
This commit is contained in:
committed by
Carlos R. Mafra
parent
761fd37e51
commit
ad373ef0dd
@@ -433,7 +433,7 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_s
|
||||
int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
|
||||
{
|
||||
WMPropList *value;
|
||||
int w, i;
|
||||
int w;
|
||||
char *tmp;
|
||||
|
||||
if (!ANoTitlebar)
|
||||
@@ -452,17 +452,10 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
|
||||
if (!tmp || strlen(tmp) == 0)
|
||||
return -1;
|
||||
|
||||
if (sscanf(tmp, "%i", &w) != 1) {
|
||||
w = -1;
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (strcmp(scr->workspaces[i]->name, tmp) == 0) {
|
||||
w = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
w--;
|
||||
}
|
||||
/* Get the workspace number for the workspace name */
|
||||
w = wGetWorkspaceNumber(scr, tmp);
|
||||
|
||||
wfree(value);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user