Move global variables from WindowMaker.h into //wmaker:globals.

This commit is contained in:
2025-02-09 22:16:14 -05:00
parent e08e3058fd
commit fc5b1e4d8e
4 changed files with 162 additions and 154 deletions
-147
View File
@@ -266,154 +266,7 @@ enum {
WColorSettings = 1 << 2
};
/****** Global Variables ******/
extern struct wmaker_global_variables {
/* Tracking of the state of the program */
struct {
wprog_state state;
wprog_state signal_state;
} program;
/* locale to use. NULL==POSIX or C */
const char *locale;
/* Tracking of X events timestamps */
struct {
/* ts of the last event we received */
Time last_event;
/* ts on the last time we did XSetInputFocus() */
Time focus_change;
} timestamp;
/* Global Domains, for storing dictionaries */
struct {
/* Note: you must #include <defaults.h> if you want to use them */
struct WDDomain *wmaker;
struct WDDomain *window_attr;
struct WDDomain *root_menu;
} domain;
/* Screens related */
int screen_count;
/*
* Ignore Workspace Change:
* this variable is used to prevent workspace switch while certain
* operations are ongoing.
*/
Bool ignore_workspace_change;
/*
* Process WorkspaceMap Event:
* this variable is set when the Workspace Map window is being displayed,
* it is mainly used to avoid re-opening another one at the same time
*/
Bool process_workspacemap_event;
#ifdef HAVE_INOTIFY
struct {
int fd_event_queue; /* Inotify's queue file descriptor */
int wd_defaults; /* Watch Descriptor for the 'Defaults' configuration file */
} inotify;
#endif
/* definition for X Atoms */
struct {
/* Window-Manager related */
struct {
Atom state;
Atom change_state;
Atom protocols;
Atom take_focus;
Atom delete_window;
Atom save_yourself;
Atom client_leader;
Atom colormap_windows;
Atom colormap_notify;
Atom ignore_focus_events;
} wm;
/* GNUStep related */
struct {
Atom wm_attr;
Atom wm_miniaturize_window;
Atom wm_resizebar;
Atom titlebar_state;
} gnustep;
/* Destkop-environment related */
struct {
Atom gtk_object_path;
} desktop;
/* WindowMaker specific */
struct {
Atom menu;
Atom wm_protocols;
Atom state;
Atom wm_function;
Atom noticeboard;
Atom command;
Atom icon_size;
Atom icon_tile;
} wmaker;
} atom;
/* X Contexts */
struct {
XContext client_win;
XContext app_win;
XContext stack;
} context;
/* X Extensions */
struct {
#ifdef USE_XSHAPE
struct {
Bool supported;
int event_base;
} shape;
#endif
#ifdef KEEP_XKB_LOCK_STATUS
struct {
Bool supported;
int event_base;
} xkb;
#endif
#ifdef USE_RANDR
struct {
Bool supported;
int event_base;
} randr;
#endif
/*
* If no extension were activated, we would end up with an empty
* structure, which old compilers may not appreciate, so let's
* work around this with a simple:
*/
int dummy;
} xext;
/* Keyboard and shortcuts */
struct {
/*
* Bit-mask to hide special key modifiers which we don't want to
* impact the shortcuts (typically: CapsLock, NumLock, ScrollLock)
*/
unsigned int modifiers_mask;
} shortcut;
} w_global;
/****** Notifications ******/
extern const char WMNManaged[];
+1 -1
View File
@@ -3,4 +3,4 @@
#include "X11/Xlib.h"
Display *dpy;
struct wmaker_global_variables;
+161 -3
View File
@@ -1,8 +1,166 @@
#ifndef WGLOBAL_DISPLAY_H_
#define WGLOBAL_DISPLAY_H_
#ifndef WGLOBALS_H_
#define WGLOBALS_H_
#include "X11/Xlib.h"
#include "X11/Xutil.h"
extern Display *dpy;
#endif // WGLOBAL_DISPLAY_H_
/* program states */
typedef enum {
WSTATE_NORMAL = 0,
WSTATE_NEED_EXIT = 1,
WSTATE_NEED_RESTART = 2,
WSTATE_EXITING = 3,
WSTATE_RESTARTING = 4,
WSTATE_MODAL = 5,
WSTATE_NEED_REREAD = 6
} wprog_state;
extern struct wmaker_global_variables {
/* Tracking of the state of the program */
struct {
wprog_state state;
wprog_state signal_state;
} program;
/* locale to use. NULL==POSIX or C */
const char *locale;
/* Tracking of X events timestamps */
struct {
/* ts of the last event we received */
Time last_event;
/* ts on the last time we did XSetInputFocus() */
Time focus_change;
} timestamp;
/* Global Domains, for storing dictionaries */
struct {
/* Note: you must #include <defaults.h> if you want to use them */
struct WDDomain *wmaker;
struct WDDomain *window_attr;
struct WDDomain *root_menu;
} domain;
/* Screens related */
int screen_count;
/*
* Ignore Workspace Change:
* this variable is used to prevent workspace switch while certain
* operations are ongoing.
*/
Bool ignore_workspace_change;
/*
* Process WorkspaceMap Event:
* this variable is set when the Workspace Map window is being displayed,
* it is mainly used to avoid re-opening another one at the same time
*/
Bool process_workspacemap_event;
#ifdef HAVE_INOTIFY
struct {
int fd_event_queue; /* Inotify's queue file descriptor */
int wd_defaults; /* Watch Descriptor for the 'Defaults' configuration file */
} inotify;
#endif
/* definition for X Atoms */
struct {
/* Window-Manager related */
struct {
Atom state;
Atom change_state;
Atom protocols;
Atom take_focus;
Atom delete_window;
Atom save_yourself;
Atom client_leader;
Atom colormap_windows;
Atom colormap_notify;
Atom ignore_focus_events;
} wm;
/* GNUStep related */
struct {
Atom wm_attr;
Atom wm_miniaturize_window;
Atom wm_resizebar;
Atom titlebar_state;
} gnustep;
/* Destkop-environment related */
struct {
Atom gtk_object_path;
} desktop;
/* WindowMaker specific */
struct {
Atom menu;
Atom wm_protocols;
Atom state;
Atom wm_function;
Atom noticeboard;
Atom command;
Atom icon_size;
Atom icon_tile;
} wmaker;
} atom;
/* X Contexts */
struct {
XContext client_win;
XContext app_win;
XContext stack;
} context;
/* X Extensions */
struct {
#ifdef USE_XSHAPE
struct {
Bool supported;
int event_base;
} shape;
#endif
#ifdef KEEP_XKB_LOCK_STATUS
struct {
Bool supported;
int event_base;
} xkb;
#endif
#ifdef USE_RANDR
struct {
Bool supported;
int event_base;
} randr;
#endif
/*
* If no extension were activated, we would end up with an empty
* structure, which old compilers may not appreciate, so let's
* work around this with a simple:
*/
int dummy;
} xext;
/* Keyboard and shortcuts */
struct {
/*
* Bit-mask to hide special key modifiers which we don't want to
* impact the shortcuts (typically: CapsLock, NumLock, ScrollLock)
*/
unsigned int modifiers_mask;
} shortcut;
} w_global;
#endif // WGLOBALS_H_
-3
View File
@@ -60,9 +60,6 @@
#include "WINGs/WUtil.h"
/****** Global Variables ******/
struct wmaker_global_variables w_global;
/* general info */
char *ProgName;