diff --git a/bazel/wmaker/WindowMaker.h b/bazel/wmaker/WindowMaker.h index e132163c..9d5ff4a6 100644 --- a/bazel/wmaker/WindowMaker.h +++ b/bazel/wmaker/WindowMaker.h @@ -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 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[]; diff --git a/bazel/wmaker/globals.c b/bazel/wmaker/globals.c index 94864242..7ff6f663 100644 --- a/bazel/wmaker/globals.c +++ b/bazel/wmaker/globals.c @@ -3,4 +3,4 @@ #include "X11/Xlib.h" Display *dpy; - +struct wmaker_global_variables; diff --git a/bazel/wmaker/globals.h b/bazel/wmaker/globals.h index d512698c..31893f91 100644 --- a/bazel/wmaker/globals.h +++ b/bazel/wmaker/globals.h @@ -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 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_ diff --git a/bazel/wmaker/main.c b/bazel/wmaker/main.c index 6d605e46..5f29a58b 100644 --- a/bazel/wmaker/main.c +++ b/bazel/wmaker/main.c @@ -60,9 +60,6 @@ #include "WINGs/WUtil.h" -/****** Global Variables ******/ -struct wmaker_global_variables w_global; - /* general info */ char *ProgName;