From: Christophe CURIS <[email protected]>

---
 src/WindowMaker.h | 17 +++++++++++++++++
 src/client.c      |  7 +------
 src/event.c       |  7 +------
 src/main.c        |  5 -----
 src/startup.c     |  7 +------
 src/switchpanel.c |  4 +---
 src/window.c      | 10 +++-------
 7 files changed, 24 insertions(+), 33 deletions(-)

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index eb72dcc..da8093d 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -570,6 +570,23 @@ extern struct wmaker_global_variables {
                XContext stack;
        } context;
 
+       /* X Extensions */
+       struct {
+#ifdef SHAPE
+               struct {
+                       Bool supported;
+                       int event_base;
+               } shape;
+#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;
+
        /* Session related */
        WMPropList *session_state;
 
diff --git a/src/client.c b/src/client.c
index 6ec7458..05b1049 100644
--- a/src/client.c
+++ b/src/client.c
@@ -44,11 +44,6 @@
 #include "wmspec.h"
 #include "misc.h"
 
-/****** Global Variables ******/
-
-#ifdef SHAPE
-extern Bool wShapeSupported;
-#endif
 
 /*
  *--------------------------------------------------------------------
@@ -172,7 +167,7 @@ void wClientConfigure(WWindow * wwin, 
XConfigureRequestEvent * xcre)
                return;
        }
 #ifdef SHAPE
-       if (wShapeSupported) {
+       if (w_global.xext.shape.supported) {
                int junk;
                unsigned int ujunk;
                int b_shaped;
diff --git a/src/event.c b/src/event.c
index 780bab2..3968639 100644
--- a/src/event.c
+++ b/src/event.c
@@ -81,11 +81,6 @@ extern WShortKey wKeyBindings[WKBD_LAST];
 
 #define MOD_MASK wPreferences.modifier_mask
 
-#ifdef SHAPE
-extern Bool wShapeSupported;
-extern int wShapeEventBase;
-#endif
-
 #ifdef KEEP_XKB_LOCK_STATUS
 extern int wXkbEventBase;
 #endif
@@ -551,7 +546,7 @@ static void handleExtensions(XEvent * event)
        xkbevent = (XkbEvent *) event;
 #endif                         /*KEEP_XKB_LOCK_STATUS */
 #ifdef SHAPE
-       if (wShapeSupported && event->type == (wShapeEventBase + ShapeNotify)) {
+       if (w_global.xext.shape.supported && event->type == 
(w_global.xext.shape.event_base + ShapeNotify)) {
                handleShapeNotify(event);
        }
 #endif
diff --git a/src/main.c b/src/main.c
index 8924a5d..2cf91b3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -88,11 +88,6 @@ WDDomain *WDWindowMaker = NULL;
 WDDomain *WDWindowAttributes = NULL;
 WDDomain *WDRootMenu = NULL;
 
-#ifdef SHAPE
-Bool wShapeSupported;
-int wShapeEventBase;
-#endif
-
 #ifdef KEEP_XKB_LOCK_STATUS
 Bool wXkbSupported;
 int wXkbEventBase;
diff --git a/src/startup.c b/src/startup.c
index eaa8634..4d6799f 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -90,11 +90,6 @@ extern WDDomain *WDRootMenu;
 extern WDDomain *WDWindowAttributes;
 extern WShortKey wKeyBindings[WKBD_LAST];
 
-#ifdef SHAPE
-extern Bool wShapeSupported;
-extern int wShapeEventBase;
-#endif
-
 #ifdef KEEP_XKB_LOCK_STATUS
 extern Bool wXkbSupported;
 extern int wXkbEventBase;
@@ -633,7 +628,7 @@ void StartUp(Bool defaultScreenOnly)
 
 #ifdef SHAPE
        /* ignore j */
-       wShapeSupported = XShapeQueryExtension(dpy, &wShapeEventBase, &j);
+       w_global.xext.shape.supported = XShapeQueryExtension(dpy, 
&w_global.xext.shape.event_base, &j);
 #endif
 
 #ifdef HAVE_XRANDR
diff --git a/src/switchpanel.c b/src/switchpanel.c
index a0f2195..af32171 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -38,8 +38,6 @@
 
 #ifdef SHAPE
 #include <X11/extensions/shape.h>
-
-extern Bool wShapeSupported;
 #endif
 
 struct SwitchPanel {
@@ -522,7 +520,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow 
*curwin, Bool class_only)
                XSetWindowBackgroundPixmap(dpy, WMWidgetXID(panel->win), 
pixmap);
 
 #ifdef SHAPE
-               if (mask && wShapeSupported)
+               if (mask && w_global.xext.shape.supported)
                        XShapeCombineMask(dpy, WMWidgetXID(panel->win), 
ShapeBounding, 0, 0, mask, ShapeSet);
 #endif
                if (pixmap)
diff --git a/src/window.c b/src/window.c
index be5af54..d1d7a5d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -75,10 +75,6 @@
 /****** Global Variables ******/
 extern WShortKey wKeyBindings[WKBD_LAST];
 
-#ifdef SHAPE
-extern Bool wShapeSupported;
-#endif
-
 /***** Local Stuff *****/
 static WWindowState *windowState = NULL;
 static FocusMode getFocusMode(WWindow *wwin);
@@ -621,7 +617,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
        XSaveContext(dpy, window, w_global.context.client_win, (XPointer) & 
wwin->client_descriptor);
 
 #ifdef SHAPE
-       if (wShapeSupported) {
+       if (w_global.xext.shape.supported) {
                int junk;
                unsigned int ujunk;
                int b_shaped;
@@ -2042,7 +2038,7 @@ void wWindowConfigure(WWindow *wwin, int req_x, int 
req_y, int req_width, int re
                wwin->client.y += wwin->screen_ptr->frame_border_width;
        }
 #ifdef SHAPE
-       if (wShapeSupported && wwin->flags.shaped && resize)
+       if (w_global.xext.shape.supported && wwin->flags.shaped && resize)
                wWindowSetShape(wwin);
 #endif
 
@@ -2266,7 +2262,7 @@ void wWindowConfigureBorders(WWindow *wwin)
                        wFrameWindowHideButton(wwin->frame, flags);
 
 #ifdef SHAPE
-               if (wShapeSupported && wwin->flags.shaped)
+               if (w_global.xext.shape.supported && wwin->flags.shaped)
                        wWindowSetShape(wwin);
 #endif
        }
-- 
1.8.4.rc3


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

Reply via email to