From: Christophe CURIS <[email protected]>

---
 src/WindowMaker.h | 19 +++++++++++++++++++
 src/actions.c     |  3 +--
 src/client.c      | 15 ++++++---------
 src/event.c       | 13 ++++---------
 src/main.c        | 12 ------------
 src/properties.c  | 16 ++++++----------
 src/session.c     |  4 ----
 src/shutdown.c    |  4 ++--
 src/startup.c     | 30 ++++++++++--------------------
 src/switchpanel.c |  3 +--
 src/window.c      |  7 ++++---
 src/winmenu.c     |  4 ++--
 src/wmspec.c      |  5 ++---
 13 files changed, 57 insertions(+), 78 deletions(-)

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index f27b2a8..81c764f 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -482,6 +482,25 @@ extern struct wmaker_global_variables {
 
        } timestamp;
 
+       /* 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;
+
+       } atom;
+
 } w_global;
 
 extern unsigned int ValidModMask;
diff --git a/src/actions.c b/src/actions.c
index 2cac48b..6a750b3 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -53,7 +53,6 @@
 /****** Global Variables ******/
 
 int ignore_wks_change = 0;
-extern Atom _XA_WM_TAKE_FOCUS;
 
 static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, 
int *new_y,
                                  unsigned int *new_width, unsigned int 
*new_height);
@@ -172,7 +171,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
 
                XFlush(dpy);
                if (wwin->protocols.TAKE_FOCUS)
-                       wClientSendProtocol(wwin, _XA_WM_TAKE_FOCUS, timestamp);
+                       wClientSendProtocol(wwin, w_global.atom.wm.take_focus, 
timestamp);
 
                XSync(dpy, False);
        } else {
diff --git a/src/client.c b/src/client.c
index 0c4126f..881c84c 100644
--- a/src/client.c
+++ b/src/client.c
@@ -49,10 +49,6 @@
 /* contexts */
 extern XContext wWinContext;
 
-extern Atom _XA_WM_STATE;
-extern Atom _XA_WM_PROTOCOLS;
-extern Atom _XA_WM_COLORMAP_WINDOWS;
-
 extern Atom _XA_WINDOWMAKER_MENU;
 
 extern Atom _XA_GNUSTEP_WM_ATTR;
@@ -112,8 +108,9 @@ void wClientSetState(WWindow * wwin, int state, Window 
icon_win)
        data[0] = (unsigned long)state;
        data[1] = (unsigned long)icon_win;
 
-       XChangeProperty(dpy, wwin->client_win, _XA_WM_STATE, _XA_WM_STATE, 32,
-                       PropModeReplace, (unsigned char *)data, 2);
+       XChangeProperty(dpy, wwin->client_win, w_global.atom.wm.state,
+                       w_global.atom.wm.state, 32, PropModeReplace,
+                       (unsigned char *)data, 2);
 }
 
 void wClientGetGravityOffsets(WWindow * wwin, int *ofs_x, int *ofs_y)
@@ -269,7 +266,7 @@ void wClientSendProtocol(WWindow * wwin, Atom protocol, 
Time time)
        XEvent event;
 
        event.xclient.type = ClientMessage;
-       event.xclient.message_type = _XA_WM_PROTOCOLS;
+       event.xclient.message_type = w_global.atom.wm.protocols;
        event.xclient.format = 32;
        event.xclient.display = dpy;
        event.xclient.window = wwin->client_win;
@@ -552,7 +549,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * 
event)
                break;
 
        default:
-               if (event->atom == _XA_WM_PROTOCOLS) {
+               if (event->atom == w_global.atom.wm.protocols) {
 
                        PropGetProtocols(wwin->client_win, &wwin->protocols);
 
@@ -561,7 +558,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * 
event)
                        if (wwin->frame)
                                wWindowUpdateButtonImages(wwin);
 
-               } else if (event->atom == _XA_WM_COLORMAP_WINDOWS) {
+               } else if (event->atom == w_global.atom.wm.colormap_windows) {
 
                        GetColormapWindows(wwin);
                        wColormapInstallForWindow(wwin->screen_ptr, wwin);
diff --git a/src/event.c b/src/event.c
index ba5b09d..40ded2a 100644
--- a/src/event.c
+++ b/src/event.c
@@ -85,16 +85,11 @@ extern int wScreenCount;
 
 #define MOD_MASK wPreferences.modifier_mask
 
-extern Atom _XA_WM_COLORMAP_NOTIFY;
-
-extern Atom _XA_WM_CHANGE_STATE;
-extern Atom _XA_WM_DELETE_WINDOW;
 extern Atom _XA_GNUSTEP_WM_ATTR;
 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
 extern Atom _XA_GNUSTEP_TITLEBAR_STATE;
 extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
 extern Atom _XA_WINDOWMAKER_COMMAND;
-extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
 
 #ifdef SHAPE
 extern Bool wShapeSupported;
@@ -930,7 +925,7 @@ static void handleClientMessage(XEvent * event)
        WObjDescriptor *desc;
 
        /* handle transition from Normal to Iconic state */
-       if (event->xclient.message_type == _XA_WM_CHANGE_STATE
+       if (event->xclient.message_type == w_global.atom.wm.change_state
            && event->xclient.format == 32 && event->xclient.data.l[0] == 
IconicState) {
 
                wwin = wWindowFor(event->xclient.window);
@@ -938,7 +933,7 @@ static void handleClientMessage(XEvent * event)
                        return;
                if (!wwin->flags.miniaturized)
                        wIconifyWindow(wwin);
-       } else if (event->xclient.message_type == _XA_WM_COLORMAP_NOTIFY && 
event->xclient.format == 32) {
+       } else if (event->xclient.message_type == 
w_global.atom.wm.colormap_notify && event->xclient.format == 32) {
                WScreen *scr = wScreenForRootWindow(event->xclient.window);
 
                if (!scr)
@@ -1028,7 +1023,7 @@ static void handleClientMessage(XEvent * event)
                        wFrameWindowChangeState(wwin->frame, WS_FOCUSED);
                        break;
                }
-       } else if (event->xclient.message_type == _XA_WM_IGNORE_FOCUS_EVENTS) {
+       } else if (event->xclient.message_type == 
w_global.atom.wm.ignore_focus_events) {
                WScreen *scr = wScreenForRootWindow(event->xclient.window);
                if (!scr)
                        return;
@@ -1554,7 +1549,7 @@ static void handleKeyPress(XEvent * event)
                if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, 
no_closable)) {
                        CloseWindowMenu(scr);
                        if (wwin->protocols.DELETE_WINDOW)
-                               wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, 
event->xkey.time);
+                               wClientSendProtocol(wwin, 
w_global.atom.wm.delete_window, event->xkey.time);
                }
                break;
        case WKBD_SELECT:
diff --git a/src/main.c b/src/main.c
index 36e595a..341f24a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -97,16 +97,6 @@ XContext wStackContext;
 XContext wVEdgeContext;
 
 /* Atoms */
-Atom _XA_WM_STATE;
-Atom _XA_WM_CHANGE_STATE;
-Atom _XA_WM_PROTOCOLS;
-Atom _XA_WM_TAKE_FOCUS;
-Atom _XA_WM_DELETE_WINDOW;
-Atom _XA_WM_SAVE_YOURSELF;
-Atom _XA_WM_CLIENT_LEADER;
-Atom _XA_WM_COLORMAP_WINDOWS;
-Atom _XA_WM_COLORMAP_NOTIFY;
-
 Atom _XA_GNUSTEP_WM_ATTR;
 Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
 Atom _XA_GNUSTEP_WM_RESIZEBAR;
@@ -123,8 +113,6 @@ Atom _XA_WINDOWMAKER_COMMAND;
 Atom _XA_WINDOWMAKER_ICON_SIZE;
 Atom _XA_WINDOWMAKER_ICON_TILE;
 
-Atom _XA_WM_IGNORE_FOCUS_EVENTS;
-
 #ifdef SHAPE
 Bool wShapeSupported;
 int wShapeEventBase;
diff --git a/src/properties.c b/src/properties.c
index 5bde912..caadff5 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -32,11 +32,6 @@
 #include "properties.h"
 
 /* atoms */
-extern Atom _XA_WM_STATE;
-extern Atom _XA_WM_CLIENT_LEADER;
-extern Atom _XA_WM_TAKE_FOCUS;
-extern Atom _XA_WM_DELETE_WINDOW;
-extern Atom _XA_WM_SAVE_YOURSELF;
 extern Atom _XA_GNUSTEP_WM_ATTR;
 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
 extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
@@ -92,11 +87,11 @@ void PropGetProtocols(Window window, WProtocols * prots)
                return;
        }
        for (i = 0; i < count; i++) {
-               if (protocols[i] == _XA_WM_TAKE_FOCUS)
+               if (protocols[i] == w_global.atom.wm.take_focus)
                        prots->TAKE_FOCUS = 1;
-               else if (protocols[i] == _XA_WM_DELETE_WINDOW)
+               else if (protocols[i] == w_global.atom.wm.delete_window)
                        prots->DELETE_WINDOW = 1;
-               else if (protocols[i] == _XA_WM_SAVE_YOURSELF)
+               else if (protocols[i] == w_global.atom.wm.save_yourself)
                        prots->SAVE_YOURSELF = 1;
                else if (protocols[i] == _XA_GNUSTEP_WM_MINIATURIZE_WINDOW)
                        prots->MINIATURIZE_WINDOW = 1;
@@ -234,7 +229,7 @@ Window PropGetClientLeader(Window window)
        Window *win;
        Window leader;
 
-       win = (Window *) PropGetCheckProperty(window, _XA_WM_CLIENT_LEADER, 
XA_WINDOW, 32, 1, NULL);
+       win = (Window *) PropGetCheckProperty(window, 
w_global.atom.wm.client_leader, XA_WINDOW, 32, 1, NULL);
 
        if (!win)
                return None;
@@ -250,7 +245,8 @@ int PropGetWindowState(Window window)
        long *data;
        long state;
 
-       data = (long *)PropGetCheckProperty(window, _XA_WM_STATE, _XA_WM_STATE, 
32, 1, NULL);
+       data = (long *)PropGetCheckProperty(window, w_global.atom.wm.state,
+                               w_global.atom.wm.state, 32, 1, NULL);
 
        if (!data)
                return -1;
diff --git a/src/session.c b/src/session.c
index 20fc8fb..6b5696d 100644
--- a/src/session.c
+++ b/src/session.c
@@ -85,10 +85,6 @@
 
 #include <WINGs/WUtil.h>
 
-/** Global **/
-
-extern Atom _XA_WM_SAVE_YOURSELF;
-
 
 static WMPropList *sApplications = NULL;
 static WMPropList *sCommand;
diff --git a/src/shutdown.c b/src/shutdown.c
index 163fe71..5a82292 100644
--- a/src/shutdown.c
+++ b/src/shutdown.c
@@ -38,7 +38,6 @@
 #include "colormap.h"
 #include "shutdown.h"
 
-extern Atom _XA_WM_DELETE_WINDOW;
 extern int wScreenCount;
 
 static void wipeDesktop(WScreen * scr);
@@ -196,7 +195,8 @@ static void wipeDesktop(WScreen * scr)
        wwin = scr->focused_window;
        while (wwin) {
                if (wwin->protocols.DELETE_WINDOW)
-                       wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, 
w_global.timestamp.last_event);
+                       wClientSendProtocol(wwin, 
w_global.atom.wm.delete_window,
+                                                                         
w_global.timestamp.last_event);
                else
                        wClientKill(wwin);
                wwin = wwin->prev;
diff --git a/src/startup.c b/src/startup.c
index f8e8bbc..31fc71b 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -108,15 +108,6 @@ extern XContext wStackContext;
 extern XContext wVEdgeContext;
 
 /* atoms */
-extern Atom _XA_WM_STATE;
-extern Atom _XA_WM_CHANGE_STATE;
-extern Atom _XA_WM_PROTOCOLS;
-extern Atom _XA_WM_TAKE_FOCUS;
-extern Atom _XA_WM_DELETE_WINDOW;
-extern Atom _XA_WM_SAVE_YOURSELF;
-extern Atom _XA_WM_CLIENT_LEADER;
-extern Atom _XA_WM_COLORMAP_WINDOWS;
-extern Atom _XA_WM_COLORMAP_NOTIFY;
 extern Atom _XA_GNUSTEP_WM_ATTR;
 extern Atom _XA_WINDOWMAKER_MENU;
 extern Atom _XA_WINDOWMAKER_WM_PROTOCOLS;
@@ -128,7 +119,6 @@ extern Atom _XA_WINDOWMAKER_ICON_SIZE;
 extern Atom _XA_WINDOWMAKER_ICON_TILE;
 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
 extern Atom _XA_GNUSTEP_TITLEBAR_STATE;
-extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
 
 #ifndef HAVE_INOTIFY
 /* special flags */
@@ -513,15 +503,15 @@ void StartUp(Bool defaultScreenOnly)
        }
 #endif
 
-       _XA_WM_STATE = atom[0];
-       _XA_WM_CHANGE_STATE = atom[1];
-       _XA_WM_PROTOCOLS = atom[2];
-       _XA_WM_TAKE_FOCUS = atom[3];
-       _XA_WM_DELETE_WINDOW = atom[4];
-       _XA_WM_SAVE_YOURSELF = atom[5];
-       _XA_WM_CLIENT_LEADER = atom[6];
-       _XA_WM_COLORMAP_WINDOWS = atom[7];
-       _XA_WM_COLORMAP_NOTIFY = atom[8];
+       w_global.atom.wm.state = atom[0];
+       w_global.atom.wm.change_state = atom[1];
+       w_global.atom.wm.protocols = atom[2];
+       w_global.atom.wm.take_focus = atom[3];
+       w_global.atom.wm.delete_window = atom[4];
+       w_global.atom.wm.save_yourself = atom[5];
+       w_global.atom.wm.client_leader = atom[6];
+       w_global.atom.wm.colormap_windows = atom[7];
+       w_global.atom.wm.colormap_notify = atom[8];
 
        _XA_WINDOWMAKER_MENU = atom[9];
        _XA_WINDOWMAKER_STATE = atom[10];
@@ -536,7 +526,7 @@ void StartUp(Bool defaultScreenOnly)
        _XA_GNUSTEP_WM_MINIATURIZE_WINDOW = atom[18];
        _XA_GNUSTEP_TITLEBAR_STATE = atom[19];
 
-       _XA_WM_IGNORE_FOCUS_EVENTS = atom[20];
+       w_global.atom.wm.ignore_focus_events = atom[20];
 
 #ifdef XDND
        wXDNDInitializeAtoms();
diff --git a/src/switchpanel.c b/src/switchpanel.c
index f305d41..424755d 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -35,7 +35,6 @@
 #include "misc.h"
 #include "xinerama.h"
 
-extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
 
 #ifdef SHAPE
 #include <X11/extensions/shape.h>
@@ -558,7 +557,7 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
                Window info_win = panel->scr->info_window;
                XEvent ev;
                ev.xclient.type = ClientMessage;
-               ev.xclient.message_type = _XA_WM_IGNORE_FOCUS_EVENTS;
+               ev.xclient.message_type = w_global.atom.wm.ignore_focus_events;
                ev.xclient.format = 32;
                ev.xclient.data.l[0] = True;
 
diff --git a/src/window.c b/src/window.c
index be3796a..6e5e87b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -83,7 +83,6 @@ extern Bool wShapeSupported;
 extern XContext wWinContext;
 
 /* protocol atoms */
-extern Atom _XA_WM_DELETE_WINDOW;
 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
 extern Atom _XA_WINDOWMAKER_STATE;
 
@@ -2917,7 +2916,8 @@ static void windowCloseClick(WCoreWindow *sender, void 
*data, XEvent *event)
        } else {
                if (wwin->protocols.DELETE_WINDOW && event->xbutton.state == 0) 
{
                        /* send delete message */
-                       wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, 
w_global.timestamp.last_event);
+                       wClientSendProtocol(wwin, 
w_global.atom.wm.delete_window,
+                                                                         
w_global.timestamp.last_event);
                }
        }
 }
@@ -2933,7 +2933,8 @@ static void windowCloseDblClick(WCoreWindow *sender, void 
*data, XEvent *event)
 
        /* send delete message */
        if (wwin->protocols.DELETE_WINDOW)
-               wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, 
w_global.timestamp.last_event);
+               wClientSendProtocol(wwin, w_global.atom.wm.delete_window,
+                                                                 
w_global.timestamp.last_event);
        else
                wClientKill(wwin);
 }
diff --git a/src/winmenu.c b/src/winmenu.c
index 16d6785..1470bc4 100644
--- a/src/winmenu.c
+++ b/src/winmenu.c
@@ -69,7 +69,6 @@
 #define WO_ENTRIES             3
 
 /**** Global data ***/
-extern Atom _XA_WM_DELETE_WINDOW;
 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
 
 extern WShortKey wKeyBindings[WKBD_LAST];
@@ -112,7 +111,8 @@ static void execMenuCommand(WMenu * menu, WMenuEntry * 
entry)
        switch (entry->order) {
        case MC_CLOSE:
                /* send delete message */
-               wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, 
w_global.timestamp.last_event);
+               wClientSendProtocol(wwin, w_global.atom.wm.delete_window,
+                                                                 
w_global.timestamp.last_event);
                break;
 
        case MC_KILL:
diff --git a/src/wmspec.c b/src/wmspec.c
index d2b945f..553ffba 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -50,8 +50,6 @@
 #include "xinerama.h"
 #include "properties.h"
 
-/* Global variables */
-extern Atom _XA_WM_DELETE_WINDOW;
 
 /* Root Window Properties */
 static Atom net_supported;
@@ -1405,7 +1403,8 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent 
*event)
        } else if (event->message_type == net_close_window) {
                if (!WFLAGP(wwin, no_closable)) {
                        if (wwin->protocols.DELETE_WINDOW)
-                               wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, 
w_global.timestamp.last_event);
+                               wClientSendProtocol(wwin, 
w_global.atom.wm.delete_window,
+                                                                               
  w_global.timestamp.last_event);
                }
        } else if (event->message_type == net_wm_state) {
                int maximized = wwin->flags.maximized;
-- 
1.8.4.rc3


-- 
To unsubscribe, send mail to [email protected].

Reply via email to