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

wmaker: Moved variable Screen Count into the global namespace

This commit is contained in:
Christophe CURIS
2013-10-10 20:38:21 +02:00
committed by Carlos R. Mafra
parent 6d65daf1be
commit b6423a7b4f
7 changed files with 28 additions and 32 deletions

View File

@@ -481,6 +481,9 @@ extern struct wmaker_global_variables {
} timestamp;
/* Screens related */
int screen_count;
/* Workspace related */
struct {
struct WWorkspace **array; /* data for the workspaces */

View File

@@ -75,7 +75,6 @@
extern WDDomain *WDWindowMaker;
extern WDDomain *WDWindowAttributes;
extern WDDomain *WDRootMenu;
extern int wScreenCount;
extern WShortKey wKeyBindings[WKBD_LAST];
typedef struct _WDefaultEntry WDefaultEntry;
@@ -995,7 +994,7 @@ void wDefaultsCheckDomains(void* arg)
shared_dict = NULL;
}
for (i = 0; i < wScreenCount; i++) {
for (i = 0; i < w_global.screen_count; i++) {
scr = wScreenWithNumber(i);
if (scr)
wReadDefaults(scr, dict);
@@ -1038,7 +1037,7 @@ void wDefaultsCheckDomains(void* arg)
WMReleasePropList(WDWindowAttributes->dictionary);
WDWindowAttributes->dictionary = dict;
for (i = 0; i < wScreenCount; i++) {
for (i = 0; i < w_global.screen_count; i++) {
scr = wScreenWithNumber(i);
if (scr) {
wDefaultUpdateIcons(scr);

View File

@@ -78,7 +78,6 @@
/******** Global Variables **********/
extern WShortKey wKeyBindings[WKBD_LAST];
extern int wScreenCount;
#define MOD_MASK wPreferences.modifier_mask
@@ -1198,7 +1197,7 @@ static void handleXkbIndicatorStateNotify(XEvent *event)
XkbStateRec staterec;
int i;
for (i = 0; i < wScreenCount; i++) {
for (i = 0; i < w_global.screen_count; i++) {
scr = wScreenWithNumber(i);
wwin = scr->focused_window;
if (wwin && wwin->flags.focused) {
@@ -1697,17 +1696,17 @@ static void handleKeyPress(XEvent * event)
break;
case WKBD_SWITCH_SCREEN:
if (wScreenCount > 1) {
if (w_global.screen_count > 1) {
WScreen *scr2;
int i;
/* find index of this screen */
for (i = 0; i < wScreenCount; i++) {
for (i = 0; i < w_global.screen_count; i++) {
if (wScreenWithNumber(i) == scr)
break;
}
i++;
if (i >= wScreenCount) {
if (i >= w_global.screen_count) {
i = 0;
}
scr2 = wScreenWithNumber(i);

View File

@@ -79,8 +79,6 @@ int inotifyFD;
int inotifyWD;
#endif
int wScreenCount = 0;
struct WPreferences wPreferences;
WShortKey wKeyBindings[WKBD_LAST];
@@ -423,7 +421,7 @@ noreturn void wAbort(Bool dumpCore)
int i;
WScreen *scr;
for (i = 0; i < wScreenCount; i++) {
for (i = 0; i < w_global.screen_count; i++) {
scr = wScreenWithNumber(i);
if (scr)
RestoreDesktop(scr);
@@ -792,7 +790,7 @@ static int real_main(int argc, char **argv)
wXModifierInitialize();
StartUp(!multiHead);
if (wScreenCount == 1)
if (w_global.screen_count == 1)
multiHead = False;
execInitScript();

View File

@@ -70,7 +70,6 @@
|KeyPressMask|KeyReleaseMask)
/**** Global variables ****/
extern int wScreenCount;
#ifdef KEEP_XKB_LOCK_STATUS
extern int wXkbSupported;
@@ -804,7 +803,7 @@ void wScreenRestoreState(WScreen * scr)
make_keys();
if (wScreenCount == 1) {
if (w_global.screen_count == 1) {
path = wdefaultspathfordomain("WMState");
} else {
char buf[16];
@@ -814,7 +813,7 @@ void wScreenRestoreState(WScreen * scr)
w_global.session_state = WMReadPropListFromFile(path);
wfree(path);
if (!w_global.session_state && wScreenCount > 1) {
if (!w_global.session_state && w_global.screen_count > 1) {
path = wdefaultspathfordomain("WMState");
w_global.session_state = WMReadPropListFromFile(path);
wfree(path);
@@ -915,7 +914,7 @@ void wScreenSaveState(WScreen * scr)
wMenuSaveState(scr);
if (wScreenCount == 1) {
if (w_global.screen_count == 1) {
str = wdefaultspathfordomain("WMState");
} else {
char buf[16];

View File

@@ -38,7 +38,6 @@
#include "colormap.h"
#include "shutdown.h"
extern int wScreenCount;
static void wipeDesktop(WScreen * scr);
@@ -68,7 +67,7 @@ void Shutdown(WShutdownMode mode)
#ifdef HAVE_INOTIFY
close(inotifyFD);
#endif
for (i = 0; i < wScreenCount; i++) {
for (i = 0; i < w_global.screen_count; i++) {
WScreen *scr;
scr = wScreenWithNumber(i);
@@ -89,7 +88,7 @@ void Shutdown(WShutdownMode mode)
break;
case WSRestartPreparationMode:
for (i = 0; i < wScreenCount; i++) {
for (i = 0; i < w_global.screen_count; i++) {
WScreen *scr;
#ifdef HAVE_INOTIFY

View File

@@ -89,7 +89,6 @@ extern WDDomain *WDWindowMaker;
extern WDDomain *WDRootMenu;
extern WDDomain *WDWindowAttributes;
extern WShortKey wKeyBindings[WKBD_LAST];
extern int wScreenCount;
#ifdef SHAPE
extern Bool wShapeSupported;
@@ -371,7 +370,7 @@ wHackedGrabButton(unsigned int button, unsigned int modifiers,
WScreen *wScreenWithNumber(int i)
{
assert(i < wScreenCount);
assert(i < w_global.screen_count);
return wScreen[i];
}
@@ -380,13 +379,13 @@ WScreen *wScreenForRootWindow(Window window)
{
int i;
if (wScreenCount == 1)
if (w_global.screen_count == 1)
return wScreen[0];
/* Since the number of heads will probably be small (normally 2),
* it should be faster to use this than a hash table, because
* of the overhead. */
for (i = 0; i < wScreenCount; i++)
for (i = 0; i < w_global.screen_count; i++)
if (wScreen[i]->root_win == window)
return wScreen[i];
@@ -397,7 +396,7 @@ WScreen *wScreenForWindow(Window window)
{
XWindowAttributes attr;
if (wScreenCount == 1)
if (w_global.screen_count == 1)
return wScreen[0];
if (XGetWindowAttributes(dpy, window, &attr))
@@ -656,7 +655,7 @@ void StartUp(Bool defaultScreenOnly)
wScreen = wmalloc(sizeof(WScreen *) * max);
wScreenCount = 0;
w_global.screen_count = 0;
/* Check if TIFF images are supported */
formats = RSupportedFileFormats();
@@ -672,25 +671,25 @@ void StartUp(Bool defaultScreenOnly)
/* manage the screens */
for (j = 0; j < max; j++) {
if (defaultScreenOnly || max == 1) {
wScreen[wScreenCount] = wScreenInit(DefaultScreen(dpy));
if (!wScreen[wScreenCount]) {
wScreen[w_global.screen_count] = wScreenInit(DefaultScreen(dpy));
if (!wScreen[w_global.screen_count]) {
wfatal(_("it seems that there is already a window manager running"));
Exit(1);
}
} else {
wScreen[wScreenCount] = wScreenInit(j);
if (!wScreen[wScreenCount]) {
wScreen[w_global.screen_count] = wScreenInit(j);
if (!wScreen[w_global.screen_count]) {
wwarning(_("could not manage screen %i"), j);
continue;
}
}
wScreenCount++;
w_global.screen_count++;
}
InitializeSwitchMenu();
/* initialize/restore state for the screens */
for (j = 0; j < wScreenCount; j++) {
for (j = 0; j < w_global.screen_count; j++) {
int lastDesktop;
lastDesktop = wNETWMGetCurrentDesktopFromHint(wScreen[j]);
@@ -743,7 +742,7 @@ void StartUp(Bool defaultScreenOnly)
wSessionRestoreLastWorkspace(wScreen[j]);
}
if (wScreenCount == 0) {
if (w_global.screen_count == 0) {
wfatal(_("could not manage any screen"));
Exit(1);
}