diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 6620e77f..cc4dc06c 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -506,6 +506,20 @@ extern struct wmaker_global_variables { Atom titlebar_state; } gnustep; + /* 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; } w_global; diff --git a/src/appmenu.c b/src/appmenu.c index ceb6c9a1..276194ae 100644 --- a/src/appmenu.c +++ b/src/appmenu.c @@ -36,8 +36,6 @@ #include "appmenu.h" #include "framewin.h" -/******** Global Variables **********/ -extern Atom _XA_WINDOWMAKER_MENU; typedef struct { short code; @@ -62,7 +60,7 @@ static void sendMessage(Window window, int what, int tag) XEvent event; event.xclient.type = ClientMessage; - event.xclient.message_type = _XA_WINDOWMAKER_MENU; + event.xclient.message_type = w_global.atom.wmaker.menu; event.xclient.format = 32; event.xclient.display = dpy; event.xclient.window = window; @@ -206,7 +204,7 @@ WMenu *wAppMenuGet(WScreen * scr, Window window) char **slist; WMenu *menu; - if (!XGetTextProperty(dpy, window, &text_prop, _XA_WINDOWMAKER_MENU)) { + if (!XGetTextProperty(dpy, window, &text_prop, w_global.atom.wmaker.menu)) { return NULL; } if (!XTextPropertyToStringList(&text_prop, &slist, &count) || count < 1) { diff --git a/src/client.c b/src/client.c index be0fa619..2b04b6a1 100644 --- a/src/client.c +++ b/src/client.c @@ -49,8 +49,6 @@ /* contexts */ extern XContext wWinContext; -extern Atom _XA_WINDOWMAKER_MENU; - #ifdef SHAPE extern Bool wShapeSupported; #endif @@ -560,7 +558,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event) GetColormapWindows(wwin); wColormapInstallForWindow(wwin->screen_ptr, wwin); - } else if (event->atom == _XA_WINDOWMAKER_MENU) { + } else if (event->atom == w_global.atom.wmaker.menu) { WApplication *wapp; wapp = wApplicationOf(wwin->main_window); diff --git a/src/event.c b/src/event.c index b38d6305..bd84810e 100644 --- a/src/event.c +++ b/src/event.c @@ -85,9 +85,6 @@ extern int wScreenCount; #define MOD_MASK wPreferences.modifier_mask -extern Atom _XA_WINDOWMAKER_WM_FUNCTION; -extern Atom _XA_WINDOWMAKER_COMMAND; - #ifdef SHAPE extern Bool wShapeSupported; extern int wShapeEventBase; @@ -941,7 +938,7 @@ static void handleClientMessage(XEvent * event) } else { /* stopping */ wColormapAllowClientInstallation(scr, False); } - } else if (event->xclient.message_type == _XA_WINDOWMAKER_COMMAND) { + } else if (event->xclient.message_type == w_global.atom.wmaker.command) { char *command; size_t len; @@ -959,7 +956,7 @@ static void handleClientMessage(XEvent * event) wfree(command); - } else if (event->xclient.message_type == _XA_WINDOWMAKER_WM_FUNCTION) { + } else if (event->xclient.message_type == w_global.atom.wmaker.wm_function) { WApplication *wapp; int done = 0; wapp = wApplicationOf(event->xclient.window); diff --git a/src/main.c b/src/main.c index 7575baab..81917ef0 100644 --- a/src/main.c +++ b/src/main.c @@ -96,18 +96,6 @@ XContext wAppWinContext; XContext wStackContext; XContext wVEdgeContext; -/* Atoms */ -Atom _XA_WINDOWMAKER_MENU; -Atom _XA_WINDOWMAKER_WM_PROTOCOLS; -Atom _XA_WINDOWMAKER_STATE; - -Atom _XA_WINDOWMAKER_WM_FUNCTION; -Atom _XA_WINDOWMAKER_NOTICEBOARD; -Atom _XA_WINDOWMAKER_COMMAND; - -Atom _XA_WINDOWMAKER_ICON_SIZE; -Atom _XA_WINDOWMAKER_ICON_TILE; - #ifdef SHAPE Bool wShapeSupported; int wShapeEventBase; diff --git a/src/properties.c b/src/properties.c index ba8b162b..6751306c 100644 --- a/src/properties.c +++ b/src/properties.c @@ -31,12 +31,6 @@ #include "GNUstep.h" #include "properties.h" -/* atoms */ -extern Atom _XA_WINDOWMAKER_WM_FUNCTION; -extern Atom _XA_WINDOWMAKER_MENU; -extern Atom _XA_WINDOWMAKER_WM_PROTOCOLS; -extern Atom _XA_WINDOWMAKER_NOTICEBOARD; -extern Atom _XA_WINDOWMAKER_ICON_TILE; int PropGetNormalHints(Window window, XSizeHints * size_hints, int *pre_iccm) { @@ -164,11 +158,11 @@ void PropSetWMakerProtocols(Window root) Atom protocols[3]; int count = 0; - protocols[count++] = _XA_WINDOWMAKER_MENU; - protocols[count++] = _XA_WINDOWMAKER_WM_FUNCTION; - protocols[count++] = _XA_WINDOWMAKER_NOTICEBOARD; + protocols[count++] = w_global.atom.wmaker.menu; + protocols[count++] = w_global.atom.wmaker.wm_function; + protocols[count++] = w_global.atom.wmaker.noticeboard; - XChangeProperty(dpy, root, _XA_WINDOWMAKER_WM_PROTOCOLS, XA_ATOM, + XChangeProperty(dpy, root, w_global.atom.wmaker.wm_protocols, XA_ATOM, 32, PropModeReplace, (unsigned char *)protocols, count); } @@ -216,7 +210,7 @@ void PropSetIconTileHint(WScreen * scr, RImage * image) } } - XChangeProperty(dpy, scr->info_window, _XA_WINDOWMAKER_ICON_TILE, + XChangeProperty(dpy, scr->info_window, w_global.atom.wmaker.icon_tile, imageAtom, 8, PropModeReplace, tmp, image->width * image->height * 4 + 4); wfree(tmp); @@ -257,7 +251,7 @@ int PropGetWindowState(Window window) void PropCleanUp(Window root) { - XDeleteProperty(dpy, root, _XA_WINDOWMAKER_WM_PROTOCOLS); - XDeleteProperty(dpy, root, _XA_WINDOWMAKER_NOTICEBOARD); + XDeleteProperty(dpy, root, w_global.atom.wmaker.wm_protocols); + XDeleteProperty(dpy, root, w_global.atom.wmaker.noticeboard); XDeleteProperty(dpy, root, XA_WM_ICON_SIZE); } diff --git a/src/screen.c b/src/screen.c index b5f52d95..c296a33e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -70,9 +70,6 @@ |KeyPressMask|KeyReleaseMask) /**** Global variables ****/ -extern Atom _XA_WINDOWMAKER_STATE; -extern Atom _XA_WINDOWMAKER_NOTICEBOARD; - extern int wScreenCount; #ifdef KEEP_XKB_LOCK_STATUS @@ -666,9 +663,9 @@ WScreen *wScreenInit(int screen_number) PropSetWMakerProtocols(scr->root_win); /* setup our noticeboard */ - XChangeProperty(dpy, scr->info_window, _XA_WINDOWMAKER_NOTICEBOARD, + XChangeProperty(dpy, scr->info_window, w_global.atom.wmaker.noticeboard, XA_WINDOW, 32, PropModeReplace, (unsigned char *)&scr->info_window, 1); - XChangeProperty(dpy, scr->root_win, _XA_WINDOWMAKER_NOTICEBOARD, + XChangeProperty(dpy, scr->root_win, w_global.atom.wmaker.noticeboard, XA_WINDOW, 32, PropModeReplace, (unsigned char *)&scr->info_window, 1); #ifdef BALLOON_TEXT diff --git a/src/startup.c b/src/startup.c index 68bc5260..aade6d6c 100644 --- a/src/startup.c +++ b/src/startup.c @@ -107,16 +107,6 @@ extern XContext wAppWinContext; extern XContext wStackContext; extern XContext wVEdgeContext; -/* atoms */ -extern Atom _XA_WINDOWMAKER_MENU; -extern Atom _XA_WINDOWMAKER_WM_PROTOCOLS; -extern Atom _XA_WINDOWMAKER_STATE; -extern Atom _XA_WINDOWMAKER_WM_FUNCTION; -extern Atom _XA_WINDOWMAKER_NOTICEBOARD; -extern Atom _XA_WINDOWMAKER_COMMAND; -extern Atom _XA_WINDOWMAKER_ICON_SIZE; -extern Atom _XA_WINDOWMAKER_ICON_TILE; - #ifndef HAVE_INOTIFY /* special flags */ extern char WDelayedActionSet; @@ -510,14 +500,14 @@ void StartUp(Bool defaultScreenOnly) 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]; - _XA_WINDOWMAKER_WM_PROTOCOLS = atom[11]; - _XA_WINDOWMAKER_WM_FUNCTION = atom[12]; - _XA_WINDOWMAKER_NOTICEBOARD = atom[13]; - _XA_WINDOWMAKER_COMMAND = atom[14]; - _XA_WINDOWMAKER_ICON_SIZE = atom[15]; - _XA_WINDOWMAKER_ICON_TILE = atom[16]; + w_global.atom.wmaker.menu = atom[9]; + w_global.atom.wmaker.state = atom[10]; + w_global.atom.wmaker.wm_protocols = atom[11]; + w_global.atom.wmaker.wm_function = atom[12]; + w_global.atom.wmaker.noticeboard = atom[13]; + w_global.atom.wmaker.command = atom[14]; + w_global.atom.wmaker.icon_size = atom[15]; + w_global.atom.wmaker.icon_tile = atom[16]; w_global.atom.gnustep.wm_attr = atom[17]; w_global.atom.gnustep.wm_miniaturize_window = atom[18]; diff --git a/src/window.c b/src/window.c index 62786d34..789159aa 100644 --- a/src/window.c +++ b/src/window.c @@ -82,9 +82,6 @@ extern Bool wShapeSupported; /* contexts */ extern XContext wWinContext; -/* protocol atoms */ -extern Atom _XA_WINDOWMAKER_STATE; - /***** Local Stuff *****/ static WWindowState *windowState = NULL; static FocusMode getFocusMode(WWindow *wwin); @@ -739,10 +736,9 @@ WWindow *wManageWindow(WScreen *scr, Window window) WSETUFLAG(wwin, shared_appicon, 0); if (wwin->main_window) { - extern Atom _XA_WINDOWMAKER_MENU; XTextProperty text_prop; - if (XGetTextProperty(dpy, wwin->main_window, &text_prop, _XA_WINDOWMAKER_MENU)) + if (XGetTextProperty(dpy, wwin->main_window, &text_prop, w_global.atom.wmaker.menu)) WSETUFLAG(wwin, shared_appicon, 0); } @@ -2307,8 +2303,8 @@ void wWindowSaveState(WWindow * wwin) WMCountInArray(wwin->screen_ptr->shortcutWindows[i], wwin)) data[9] |= 1 << i; } - XChangeProperty(dpy, wwin->client_win, _XA_WINDOWMAKER_STATE, - _XA_WINDOWMAKER_STATE, 32, PropModeReplace, (unsigned char *)data, 10); + XChangeProperty(dpy, wwin->client_win, w_global.atom.wmaker.state, + w_global.atom.wmaker.state, 32, PropModeReplace, (unsigned char *)data, 10); } static int getSavedState(Window window, WSavedState ** state) @@ -2319,8 +2315,8 @@ static int getSavedState(Window window, WSavedState ** state) unsigned long bytes_after_ret; long *data; - if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0, 10, - True, _XA_WINDOWMAKER_STATE, + if (XGetWindowProperty(dpy, window, w_global.atom.wmaker.state, 0, 10, + True, w_global.atom.wmaker.state, &type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret, (unsigned char **)&data) != Success || !data || nitems_ret < 10) return 0; @@ -2340,7 +2336,7 @@ static int getSavedState(Window window, WSavedState ** state) XFree(data); - if (*state && type_ret == _XA_WINDOWMAKER_STATE) + if (*state && type_ret == w_global.atom.wmaker.state) return 1; else return 0;