diff --git a/src/WindowMaker.h b/src/WindowMaker.h index eb72dccc..da8093d3 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 6ec7458c..05b10498 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 780bab25..3968639c 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 79899a09..b668cf5c 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 eaa8634c..4d6799f1 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 a0f2195d..af32171d 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -38,8 +38,6 @@ #ifdef SHAPE #include - -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 be5af546..d1d7a5d2 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 }