1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Varible session_state moved to global namespace

The variable session_state, defined in screen.h (WScreen), is moved to
the global variable w_global.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix)
2013-10-08 00:56:42 +02:00
committed by Carlos R. Mafra
parent d27ce03780
commit 40e1ea08b8
7 changed files with 44 additions and 44 deletions

View File

@@ -560,6 +560,9 @@ extern struct wmaker_global_variables {
XContext stack;
} context;
/* Session related */
WMPropList *session_state;
/* Application related */
struct WAppIcon *app_icon_list; /* list of all aplication icons */

View File

@@ -1575,8 +1575,7 @@ void wDockSaveState(WScreen *scr, WMPropList *old_state)
WMReleasePropList(keys);
}
WMPutInPLDictionary(scr->session_state, dDock, dock_state);
WMPutInPLDictionary(w_global.session_state, dDock, dock_state);
WMReleasePropList(dock_state);
}
@@ -1586,8 +1585,7 @@ void wClipSaveState(WScreen *scr)
clip_state = make_icon_state(w_global.clip.icon);
WMPutInPLDictionary(scr->session_state, dClip, clip_state);
WMPutInPLDictionary(w_global.session_state, dClip, clip_state);
WMReleasePropList(clip_state);
}
@@ -4896,7 +4894,7 @@ void wDrawersSaveState(WScreen *scr)
WMAddToPLArray(all_drawers, drawer_state);
WMReleasePropList(drawer_state);
}
WMPutInPLDictionary(scr->session_state, dDrawers, all_drawers);
WMPutInPLDictionary(w_global.session_state, dDrawers, all_drawers);
WMReleasePropList(all_drawers);
}
@@ -4908,10 +4906,10 @@ void wDrawersRestoreState(WScreen *scr)
make_keys();
if (scr->session_state == NULL)
if (w_global.session_state == NULL)
return;
all_drawers = WMGetFromPLDictionary(scr->session_state, dDrawers);
all_drawers = WMGetFromPLDictionary(w_global.session_state, dDrawers);
if (!all_drawers)
return;

View File

@@ -2273,7 +2273,7 @@ void wMenuSaveState(WScreen * scr)
if (save_menus) {
key = WMCreatePLString("Menus");
WMPutInPLDictionary(scr->session_state, key, menus);
WMPutInPLDictionary(w_global.session_state, key, menus);
WMReleasePropList(key);
}
WMReleasePropList(menus);
@@ -2476,12 +2476,11 @@ void wMenuRestoreState(WScreen * scr)
{
WMPropList *menus, *menu, *key, *skey;
if (!scr->session_state) {
if (!w_global.session_state)
return;
}
key = WMCreatePLString("Menus");
menus = WMGetFromPLDictionary(scr->session_state, key);
menus = WMGetFromPLDictionary(w_global.session_state, key);
WMReleasePropList(key);
if (!menus)

View File

@@ -811,24 +811,25 @@ void wScreenRestoreState(WScreen * scr)
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
path = wdefaultspathfordomain(buf);
}
scr->session_state = WMReadPropListFromFile(path);
w_global.session_state = WMReadPropListFromFile(path);
wfree(path);
if (!scr->session_state && wScreenCount > 1) {
if (!w_global.session_state && wScreenCount > 1) {
path = wdefaultspathfordomain("WMState");
scr->session_state = WMReadPropListFromFile(path);
w_global.session_state = WMReadPropListFromFile(path);
wfree(path);
}
if (!scr->session_state)
scr->session_state = WMCreatePLDictionary(NULL, NULL);
if (!w_global.session_state)
w_global.session_state = WMCreatePLDictionary(NULL, NULL);
if (!wPreferences.flags.nodock) {
state = WMGetFromPLDictionary(scr->session_state, dDock);
state = WMGetFromPLDictionary(w_global.session_state, dDock);
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
}
if (!wPreferences.flags.noclip) {
state = WMGetFromPLDictionary(scr->session_state, dClip);
state = WMGetFromPLDictionary(w_global.session_state, dClip);
w_global.clip.icon = wClipRestoreState(scr, state);
}
@@ -857,8 +858,8 @@ void wScreenSaveState(WScreen * scr)
if (wPreferences.flags.noupdates)
return;
old_state = scr->session_state;
scr->session_state = WMCreatePLDictionary(NULL, NULL);
old_state = w_global.session_state;
w_global.session_state = WMCreatePLDictionary(NULL, NULL);
WMPLSetCaseSensitive(True);
@@ -867,14 +868,14 @@ void wScreenSaveState(WScreen * scr)
wDockSaveState(scr, old_state);
} else {
if ((foo = WMGetFromPLDictionary(old_state, dDock)) != NULL) {
WMPutInPLDictionary(scr->session_state, dDock, foo);
WMPutInPLDictionary(w_global.session_state, dDock, foo);
}
}
if (!wPreferences.flags.noclip) {
wClipSaveState(scr);
} else {
if ((foo = WMGetFromPLDictionary(old_state, dClip)) != NULL) {
WMPutInPLDictionary(scr->session_state, dClip, foo);
WMPutInPLDictionary(w_global.session_state, dClip, foo);
}
}
@@ -884,7 +885,7 @@ void wScreenSaveState(WScreen * scr)
wDrawersSaveState(scr);
} else {
if ((foo = WMGetFromPLDictionary(old_state, dDrawers)) != NULL) {
WMPutInPLDictionary(scr->session_state, dDrawers, foo);
WMPutInPLDictionary(w_global.session_state, dDrawers, foo);
}
}
@@ -893,10 +894,10 @@ void wScreenSaveState(WScreen * scr)
wSessionSaveState(scr);
} else {
if ((foo = WMGetFromPLDictionary(old_state, dApplications)) != NULL) {
WMPutInPLDictionary(scr->session_state, dApplications, foo);
WMPutInPLDictionary(w_global.session_state, dApplications, foo);
}
if ((foo = WMGetFromPLDictionary(old_state, dWorkspace)) != NULL) {
WMPutInPLDictionary(scr->session_state, dWorkspace, foo);
WMPutInPLDictionary(w_global.session_state, dWorkspace, foo);
}
}
@@ -912,7 +913,7 @@ void wScreenSaveState(WScreen * scr)
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
str = wdefaultspathfordomain(buf);
}
if (!WMWritePropListToFile(scr->session_state, str)) {
if (!WMWritePropListToFile(w_global.session_state, str)) {
werror(_("could not save session state in %s"), str);
}
wfree(str);

View File

@@ -240,8 +240,6 @@ typedef struct _WScreen {
/* state and other informations */
short cascade_index; /* for cascade window placement */
WMPropList *session_state;
/* for double-click detection */
Time last_click_time;
Window last_click_window;

View File

@@ -280,9 +280,9 @@ void wSessionSaveState(WScreen * scr)
make_keys();
if (!scr->session_state) {
scr->session_state = WMCreatePLDictionary(NULL, NULL);
if (!scr->session_state)
if (!w_global.session_state) {
w_global.session_state = WMCreatePLDictionary(NULL, NULL);
if (!w_global.session_state)
return;
}
@@ -312,12 +312,13 @@ void wSessionSaveState(WScreen * scr)
}
wwin = wwin->prev;
}
WMRemoveFromPLDictionary(scr->session_state, sApplications);
WMPutInPLDictionary(scr->session_state, sApplications, list);
WMRemoveFromPLDictionary(w_global.session_state, sApplications);
WMPutInPLDictionary(w_global.session_state, sApplications, list);
WMReleasePropList(list);
wks = WMCreatePLString(w_global.workspace.array[w_global.workspace.current]->name);
WMPutInPLDictionary(scr->session_state, sWorkspace, wks);
WMPutInPLDictionary(w_global.session_state, sWorkspace, wks);
WMReleasePropList(wks);
WMFreeArray(wapp_list);
@@ -327,11 +328,11 @@ void wSessionClearState(WScreen * scr)
{
make_keys();
if (!scr->session_state)
if (!w_global.session_state)
return;
WMRemoveFromPLDictionary(scr->session_state, sApplications);
WMRemoveFromPLDictionary(scr->session_state, sWorkspace);
WMRemoveFromPLDictionary(w_global.session_state, sApplications);
WMRemoveFromPLDictionary(w_global.session_state, sWorkspace);
}
static pid_t execCommand(WScreen *scr, char *command)
@@ -431,12 +432,12 @@ void wSessionRestoreState(WScreen *scr)
make_keys();
if (!scr->session_state)
if (!w_global.session_state)
return;
WMPLSetCaseSensitive(True);
apps = WMGetFromPLDictionary(scr->session_state, sApplications);
apps = WMGetFromPLDictionary(w_global.session_state, sApplications);
if (!apps)
return;
@@ -536,12 +537,12 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
make_keys();
if (!scr->session_state)
if (!w_global.session_state)
return;
WMPLSetCaseSensitive(True);
wks = WMGetFromPLDictionary(scr->session_state, sWorkspace);
wks = WMGetFromPLDictionary(w_global.session_state, sWorkspace);
if (!wks || !WMIsPLString(wks))
return;

View File

@@ -827,7 +827,7 @@ void wWorkspaceSaveState(WScreen * scr, WMPropList * old_state)
WMAddToPLArray(parr, wks_state);
WMReleasePropList(wks_state);
}
WMPutInPLDictionary(scr->session_state, dWorkspaces, parr);
WMPutInPLDictionary(w_global.session_state, dWorkspaces, parr);
WMReleasePropList(parr);
}
@@ -838,10 +838,10 @@ void wWorkspaceRestoreState(WScreen *scr)
make_keys();
if (scr->session_state == NULL)
if (w_global.session_state == NULL)
return;
parr = WMGetFromPLDictionary(scr->session_state, dWorkspaces);
parr = WMGetFromPLDictionary(w_global.session_state, dWorkspaces);
if (!parr)
return;