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:
committed by
Carlos R. Mafra
parent
6d65daf1be
commit
b6423a7b4f
@@ -481,6 +481,9 @@ extern struct wmaker_global_variables {
|
|||||||
|
|
||||||
} timestamp;
|
} timestamp;
|
||||||
|
|
||||||
|
/* Screens related */
|
||||||
|
int screen_count;
|
||||||
|
|
||||||
/* Workspace related */
|
/* Workspace related */
|
||||||
struct {
|
struct {
|
||||||
struct WWorkspace **array; /* data for the workspaces */
|
struct WWorkspace **array; /* data for the workspaces */
|
||||||
|
|||||||
@@ -75,7 +75,6 @@
|
|||||||
extern WDDomain *WDWindowMaker;
|
extern WDDomain *WDWindowMaker;
|
||||||
extern WDDomain *WDWindowAttributes;
|
extern WDDomain *WDWindowAttributes;
|
||||||
extern WDDomain *WDRootMenu;
|
extern WDDomain *WDRootMenu;
|
||||||
extern int wScreenCount;
|
|
||||||
extern WShortKey wKeyBindings[WKBD_LAST];
|
extern WShortKey wKeyBindings[WKBD_LAST];
|
||||||
|
|
||||||
typedef struct _WDefaultEntry WDefaultEntry;
|
typedef struct _WDefaultEntry WDefaultEntry;
|
||||||
@@ -995,7 +994,7 @@ void wDefaultsCheckDomains(void* arg)
|
|||||||
shared_dict = NULL;
|
shared_dict = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < w_global.screen_count; i++) {
|
||||||
scr = wScreenWithNumber(i);
|
scr = wScreenWithNumber(i);
|
||||||
if (scr)
|
if (scr)
|
||||||
wReadDefaults(scr, dict);
|
wReadDefaults(scr, dict);
|
||||||
@@ -1038,7 +1037,7 @@ void wDefaultsCheckDomains(void* arg)
|
|||||||
WMReleasePropList(WDWindowAttributes->dictionary);
|
WMReleasePropList(WDWindowAttributes->dictionary);
|
||||||
|
|
||||||
WDWindowAttributes->dictionary = dict;
|
WDWindowAttributes->dictionary = dict;
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < w_global.screen_count; i++) {
|
||||||
scr = wScreenWithNumber(i);
|
scr = wScreenWithNumber(i);
|
||||||
if (scr) {
|
if (scr) {
|
||||||
wDefaultUpdateIcons(scr);
|
wDefaultUpdateIcons(scr);
|
||||||
|
|||||||
@@ -78,7 +78,6 @@
|
|||||||
|
|
||||||
/******** Global Variables **********/
|
/******** Global Variables **********/
|
||||||
extern WShortKey wKeyBindings[WKBD_LAST];
|
extern WShortKey wKeyBindings[WKBD_LAST];
|
||||||
extern int wScreenCount;
|
|
||||||
|
|
||||||
#define MOD_MASK wPreferences.modifier_mask
|
#define MOD_MASK wPreferences.modifier_mask
|
||||||
|
|
||||||
@@ -1198,7 +1197,7 @@ static void handleXkbIndicatorStateNotify(XEvent *event)
|
|||||||
XkbStateRec staterec;
|
XkbStateRec staterec;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < w_global.screen_count; i++) {
|
||||||
scr = wScreenWithNumber(i);
|
scr = wScreenWithNumber(i);
|
||||||
wwin = scr->focused_window;
|
wwin = scr->focused_window;
|
||||||
if (wwin && wwin->flags.focused) {
|
if (wwin && wwin->flags.focused) {
|
||||||
@@ -1697,17 +1696,17 @@ static void handleKeyPress(XEvent * event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WKBD_SWITCH_SCREEN:
|
case WKBD_SWITCH_SCREEN:
|
||||||
if (wScreenCount > 1) {
|
if (w_global.screen_count > 1) {
|
||||||
WScreen *scr2;
|
WScreen *scr2;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* find index of this screen */
|
/* find index of this screen */
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < w_global.screen_count; i++) {
|
||||||
if (wScreenWithNumber(i) == scr)
|
if (wScreenWithNumber(i) == scr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
if (i >= wScreenCount) {
|
if (i >= w_global.screen_count) {
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
scr2 = wScreenWithNumber(i);
|
scr2 = wScreenWithNumber(i);
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ int inotifyFD;
|
|||||||
int inotifyWD;
|
int inotifyWD;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int wScreenCount = 0;
|
|
||||||
|
|
||||||
struct WPreferences wPreferences;
|
struct WPreferences wPreferences;
|
||||||
|
|
||||||
WShortKey wKeyBindings[WKBD_LAST];
|
WShortKey wKeyBindings[WKBD_LAST];
|
||||||
@@ -423,7 +421,7 @@ noreturn void wAbort(Bool dumpCore)
|
|||||||
int i;
|
int i;
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
|
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < w_global.screen_count; i++) {
|
||||||
scr = wScreenWithNumber(i);
|
scr = wScreenWithNumber(i);
|
||||||
if (scr)
|
if (scr)
|
||||||
RestoreDesktop(scr);
|
RestoreDesktop(scr);
|
||||||
@@ -792,7 +790,7 @@ static int real_main(int argc, char **argv)
|
|||||||
wXModifierInitialize();
|
wXModifierInitialize();
|
||||||
StartUp(!multiHead);
|
StartUp(!multiHead);
|
||||||
|
|
||||||
if (wScreenCount == 1)
|
if (w_global.screen_count == 1)
|
||||||
multiHead = False;
|
multiHead = False;
|
||||||
|
|
||||||
execInitScript();
|
execInitScript();
|
||||||
|
|||||||
@@ -70,7 +70,6 @@
|
|||||||
|KeyPressMask|KeyReleaseMask)
|
|KeyPressMask|KeyReleaseMask)
|
||||||
|
|
||||||
/**** Global variables ****/
|
/**** Global variables ****/
|
||||||
extern int wScreenCount;
|
|
||||||
|
|
||||||
#ifdef KEEP_XKB_LOCK_STATUS
|
#ifdef KEEP_XKB_LOCK_STATUS
|
||||||
extern int wXkbSupported;
|
extern int wXkbSupported;
|
||||||
@@ -804,7 +803,7 @@ void wScreenRestoreState(WScreen * scr)
|
|||||||
|
|
||||||
make_keys();
|
make_keys();
|
||||||
|
|
||||||
if (wScreenCount == 1) {
|
if (w_global.screen_count == 1) {
|
||||||
path = wdefaultspathfordomain("WMState");
|
path = wdefaultspathfordomain("WMState");
|
||||||
} else {
|
} else {
|
||||||
char buf[16];
|
char buf[16];
|
||||||
@@ -814,7 +813,7 @@ void wScreenRestoreState(WScreen * scr)
|
|||||||
|
|
||||||
w_global.session_state = WMReadPropListFromFile(path);
|
w_global.session_state = WMReadPropListFromFile(path);
|
||||||
wfree(path);
|
wfree(path);
|
||||||
if (!w_global.session_state && wScreenCount > 1) {
|
if (!w_global.session_state && w_global.screen_count > 1) {
|
||||||
path = wdefaultspathfordomain("WMState");
|
path = wdefaultspathfordomain("WMState");
|
||||||
w_global.session_state = WMReadPropListFromFile(path);
|
w_global.session_state = WMReadPropListFromFile(path);
|
||||||
wfree(path);
|
wfree(path);
|
||||||
@@ -915,7 +914,7 @@ void wScreenSaveState(WScreen * scr)
|
|||||||
|
|
||||||
wMenuSaveState(scr);
|
wMenuSaveState(scr);
|
||||||
|
|
||||||
if (wScreenCount == 1) {
|
if (w_global.screen_count == 1) {
|
||||||
str = wdefaultspathfordomain("WMState");
|
str = wdefaultspathfordomain("WMState");
|
||||||
} else {
|
} else {
|
||||||
char buf[16];
|
char buf[16];
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include "colormap.h"
|
#include "colormap.h"
|
||||||
#include "shutdown.h"
|
#include "shutdown.h"
|
||||||
|
|
||||||
extern int wScreenCount;
|
|
||||||
|
|
||||||
static void wipeDesktop(WScreen * scr);
|
static void wipeDesktop(WScreen * scr);
|
||||||
|
|
||||||
@@ -68,7 +67,7 @@ void Shutdown(WShutdownMode mode)
|
|||||||
#ifdef HAVE_INOTIFY
|
#ifdef HAVE_INOTIFY
|
||||||
close(inotifyFD);
|
close(inotifyFD);
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < w_global.screen_count; i++) {
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
|
|
||||||
scr = wScreenWithNumber(i);
|
scr = wScreenWithNumber(i);
|
||||||
@@ -89,7 +88,7 @@ void Shutdown(WShutdownMode mode)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WSRestartPreparationMode:
|
case WSRestartPreparationMode:
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < w_global.screen_count; i++) {
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
|
|
||||||
#ifdef HAVE_INOTIFY
|
#ifdef HAVE_INOTIFY
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ extern WDDomain *WDWindowMaker;
|
|||||||
extern WDDomain *WDRootMenu;
|
extern WDDomain *WDRootMenu;
|
||||||
extern WDDomain *WDWindowAttributes;
|
extern WDDomain *WDWindowAttributes;
|
||||||
extern WShortKey wKeyBindings[WKBD_LAST];
|
extern WShortKey wKeyBindings[WKBD_LAST];
|
||||||
extern int wScreenCount;
|
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
extern Bool wShapeSupported;
|
extern Bool wShapeSupported;
|
||||||
@@ -371,7 +370,7 @@ wHackedGrabButton(unsigned int button, unsigned int modifiers,
|
|||||||
|
|
||||||
WScreen *wScreenWithNumber(int i)
|
WScreen *wScreenWithNumber(int i)
|
||||||
{
|
{
|
||||||
assert(i < wScreenCount);
|
assert(i < w_global.screen_count);
|
||||||
|
|
||||||
return wScreen[i];
|
return wScreen[i];
|
||||||
}
|
}
|
||||||
@@ -380,13 +379,13 @@ WScreen *wScreenForRootWindow(Window window)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (wScreenCount == 1)
|
if (w_global.screen_count == 1)
|
||||||
return wScreen[0];
|
return wScreen[0];
|
||||||
|
|
||||||
/* Since the number of heads will probably be small (normally 2),
|
/* Since the number of heads will probably be small (normally 2),
|
||||||
* it should be faster to use this than a hash table, because
|
* it should be faster to use this than a hash table, because
|
||||||
* of the overhead. */
|
* of the overhead. */
|
||||||
for (i = 0; i < wScreenCount; i++)
|
for (i = 0; i < w_global.screen_count; i++)
|
||||||
if (wScreen[i]->root_win == window)
|
if (wScreen[i]->root_win == window)
|
||||||
return wScreen[i];
|
return wScreen[i];
|
||||||
|
|
||||||
@@ -397,7 +396,7 @@ WScreen *wScreenForWindow(Window window)
|
|||||||
{
|
{
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
|
||||||
if (wScreenCount == 1)
|
if (w_global.screen_count == 1)
|
||||||
return wScreen[0];
|
return wScreen[0];
|
||||||
|
|
||||||
if (XGetWindowAttributes(dpy, window, &attr))
|
if (XGetWindowAttributes(dpy, window, &attr))
|
||||||
@@ -656,7 +655,7 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
|
|
||||||
wScreen = wmalloc(sizeof(WScreen *) * max);
|
wScreen = wmalloc(sizeof(WScreen *) * max);
|
||||||
|
|
||||||
wScreenCount = 0;
|
w_global.screen_count = 0;
|
||||||
|
|
||||||
/* Check if TIFF images are supported */
|
/* Check if TIFF images are supported */
|
||||||
formats = RSupportedFileFormats();
|
formats = RSupportedFileFormats();
|
||||||
@@ -672,25 +671,25 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
/* manage the screens */
|
/* manage the screens */
|
||||||
for (j = 0; j < max; j++) {
|
for (j = 0; j < max; j++) {
|
||||||
if (defaultScreenOnly || max == 1) {
|
if (defaultScreenOnly || max == 1) {
|
||||||
wScreen[wScreenCount] = wScreenInit(DefaultScreen(dpy));
|
wScreen[w_global.screen_count] = wScreenInit(DefaultScreen(dpy));
|
||||||
if (!wScreen[wScreenCount]) {
|
if (!wScreen[w_global.screen_count]) {
|
||||||
wfatal(_("it seems that there is already a window manager running"));
|
wfatal(_("it seems that there is already a window manager running"));
|
||||||
Exit(1);
|
Exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wScreen[wScreenCount] = wScreenInit(j);
|
wScreen[w_global.screen_count] = wScreenInit(j);
|
||||||
if (!wScreen[wScreenCount]) {
|
if (!wScreen[w_global.screen_count]) {
|
||||||
wwarning(_("could not manage screen %i"), j);
|
wwarning(_("could not manage screen %i"), j);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wScreenCount++;
|
w_global.screen_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeSwitchMenu();
|
InitializeSwitchMenu();
|
||||||
|
|
||||||
/* initialize/restore state for the screens */
|
/* initialize/restore state for the screens */
|
||||||
for (j = 0; j < wScreenCount; j++) {
|
for (j = 0; j < w_global.screen_count; j++) {
|
||||||
int lastDesktop;
|
int lastDesktop;
|
||||||
|
|
||||||
lastDesktop = wNETWMGetCurrentDesktopFromHint(wScreen[j]);
|
lastDesktop = wNETWMGetCurrentDesktopFromHint(wScreen[j]);
|
||||||
@@ -743,7 +742,7 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
wSessionRestoreLastWorkspace(wScreen[j]);
|
wSessionRestoreLastWorkspace(wScreen[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wScreenCount == 0) {
|
if (w_global.screen_count == 0) {
|
||||||
wfatal(_("could not manage any screen"));
|
wfatal(_("could not manage any screen"));
|
||||||
Exit(1);
|
Exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user