1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

wmaker: Moved definition of WMaker-specific XAtoms into the global variables structure

This commit is contained in:
Christophe CURIS
2013-09-29 13:22:57 +02:00
committed by Carlos R. Mafra
parent 379f7022bd
commit e2ce62eb5b
9 changed files with 42 additions and 70 deletions

View File

@@ -506,6 +506,20 @@ extern struct wmaker_global_variables {
Atom titlebar_state; Atom titlebar_state;
} gnustep; } 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; } atom;
} w_global; } w_global;

View File

@@ -36,8 +36,6 @@
#include "appmenu.h" #include "appmenu.h"
#include "framewin.h" #include "framewin.h"
/******** Global Variables **********/
extern Atom _XA_WINDOWMAKER_MENU;
typedef struct { typedef struct {
short code; short code;
@@ -62,7 +60,7 @@ static void sendMessage(Window window, int what, int tag)
XEvent event; XEvent event;
event.xclient.type = ClientMessage; 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.format = 32;
event.xclient.display = dpy; event.xclient.display = dpy;
event.xclient.window = window; event.xclient.window = window;
@@ -206,7 +204,7 @@ WMenu *wAppMenuGet(WScreen * scr, Window window)
char **slist; char **slist;
WMenu *menu; WMenu *menu;
if (!XGetTextProperty(dpy, window, &text_prop, _XA_WINDOWMAKER_MENU)) { if (!XGetTextProperty(dpy, window, &text_prop, w_global.atom.wmaker.menu)) {
return NULL; return NULL;
} }
if (!XTextPropertyToStringList(&text_prop, &slist, &count) || count < 1) { if (!XTextPropertyToStringList(&text_prop, &slist, &count) || count < 1) {

View File

@@ -49,8 +49,6 @@
/* contexts */ /* contexts */
extern XContext wWinContext; extern XContext wWinContext;
extern Atom _XA_WINDOWMAKER_MENU;
#ifdef SHAPE #ifdef SHAPE
extern Bool wShapeSupported; extern Bool wShapeSupported;
#endif #endif
@@ -560,7 +558,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
GetColormapWindows(wwin); GetColormapWindows(wwin);
wColormapInstallForWindow(wwin->screen_ptr, wwin); wColormapInstallForWindow(wwin->screen_ptr, wwin);
} else if (event->atom == _XA_WINDOWMAKER_MENU) { } else if (event->atom == w_global.atom.wmaker.menu) {
WApplication *wapp; WApplication *wapp;
wapp = wApplicationOf(wwin->main_window); wapp = wApplicationOf(wwin->main_window);

View File

@@ -85,9 +85,6 @@ extern int wScreenCount;
#define MOD_MASK wPreferences.modifier_mask #define MOD_MASK wPreferences.modifier_mask
extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
extern Atom _XA_WINDOWMAKER_COMMAND;
#ifdef SHAPE #ifdef SHAPE
extern Bool wShapeSupported; extern Bool wShapeSupported;
extern int wShapeEventBase; extern int wShapeEventBase;
@@ -941,7 +938,7 @@ static void handleClientMessage(XEvent * event)
} else { /* stopping */ } else { /* stopping */
wColormapAllowClientInstallation(scr, False); 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; char *command;
size_t len; size_t len;
@@ -959,7 +956,7 @@ static void handleClientMessage(XEvent * event)
wfree(command); 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; WApplication *wapp;
int done = 0; int done = 0;
wapp = wApplicationOf(event->xclient.window); wapp = wApplicationOf(event->xclient.window);

View File

@@ -96,18 +96,6 @@ XContext wAppWinContext;
XContext wStackContext; XContext wStackContext;
XContext wVEdgeContext; 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 #ifdef SHAPE
Bool wShapeSupported; Bool wShapeSupported;
int wShapeEventBase; int wShapeEventBase;

View File

@@ -31,12 +31,6 @@
#include "GNUstep.h" #include "GNUstep.h"
#include "properties.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) int PropGetNormalHints(Window window, XSizeHints * size_hints, int *pre_iccm)
{ {
@@ -164,11 +158,11 @@ void PropSetWMakerProtocols(Window root)
Atom protocols[3]; Atom protocols[3];
int count = 0; int count = 0;
protocols[count++] = _XA_WINDOWMAKER_MENU; protocols[count++] = w_global.atom.wmaker.menu;
protocols[count++] = _XA_WINDOWMAKER_WM_FUNCTION; protocols[count++] = w_global.atom.wmaker.wm_function;
protocols[count++] = _XA_WINDOWMAKER_NOTICEBOARD; 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); 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); imageAtom, 8, PropModeReplace, tmp, image->width * image->height * 4 + 4);
wfree(tmp); wfree(tmp);
@@ -257,7 +251,7 @@ int PropGetWindowState(Window window)
void PropCleanUp(Window root) void PropCleanUp(Window root)
{ {
XDeleteProperty(dpy, root, _XA_WINDOWMAKER_WM_PROTOCOLS); XDeleteProperty(dpy, root, w_global.atom.wmaker.wm_protocols);
XDeleteProperty(dpy, root, _XA_WINDOWMAKER_NOTICEBOARD); XDeleteProperty(dpy, root, w_global.atom.wmaker.noticeboard);
XDeleteProperty(dpy, root, XA_WM_ICON_SIZE); XDeleteProperty(dpy, root, XA_WM_ICON_SIZE);
} }

View File

@@ -70,9 +70,6 @@
|KeyPressMask|KeyReleaseMask) |KeyPressMask|KeyReleaseMask)
/**** Global variables ****/ /**** Global variables ****/
extern Atom _XA_WINDOWMAKER_STATE;
extern Atom _XA_WINDOWMAKER_NOTICEBOARD;
extern int wScreenCount; extern int wScreenCount;
#ifdef KEEP_XKB_LOCK_STATUS #ifdef KEEP_XKB_LOCK_STATUS
@@ -666,9 +663,9 @@ WScreen *wScreenInit(int screen_number)
PropSetWMakerProtocols(scr->root_win); PropSetWMakerProtocols(scr->root_win);
/* setup our noticeboard */ /* 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); 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); XA_WINDOW, 32, PropModeReplace, (unsigned char *)&scr->info_window, 1);
#ifdef BALLOON_TEXT #ifdef BALLOON_TEXT

View File

@@ -107,16 +107,6 @@ extern XContext wAppWinContext;
extern XContext wStackContext; extern XContext wStackContext;
extern XContext wVEdgeContext; 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 #ifndef HAVE_INOTIFY
/* special flags */ /* special flags */
extern char WDelayedActionSet; extern char WDelayedActionSet;
@@ -510,14 +500,14 @@ void StartUp(Bool defaultScreenOnly)
w_global.atom.wm.colormap_windows = atom[7]; w_global.atom.wm.colormap_windows = atom[7];
w_global.atom.wm.colormap_notify = atom[8]; w_global.atom.wm.colormap_notify = atom[8];
_XA_WINDOWMAKER_MENU = atom[9]; w_global.atom.wmaker.menu = atom[9];
_XA_WINDOWMAKER_STATE = atom[10]; w_global.atom.wmaker.state = atom[10];
_XA_WINDOWMAKER_WM_PROTOCOLS = atom[11]; w_global.atom.wmaker.wm_protocols = atom[11];
_XA_WINDOWMAKER_WM_FUNCTION = atom[12]; w_global.atom.wmaker.wm_function = atom[12];
_XA_WINDOWMAKER_NOTICEBOARD = atom[13]; w_global.atom.wmaker.noticeboard = atom[13];
_XA_WINDOWMAKER_COMMAND = atom[14]; w_global.atom.wmaker.command = atom[14];
_XA_WINDOWMAKER_ICON_SIZE = atom[15]; w_global.atom.wmaker.icon_size = atom[15];
_XA_WINDOWMAKER_ICON_TILE = atom[16]; w_global.atom.wmaker.icon_tile = atom[16];
w_global.atom.gnustep.wm_attr = atom[17]; w_global.atom.gnustep.wm_attr = atom[17];
w_global.atom.gnustep.wm_miniaturize_window = atom[18]; w_global.atom.gnustep.wm_miniaturize_window = atom[18];

View File

@@ -82,9 +82,6 @@ extern Bool wShapeSupported;
/* contexts */ /* contexts */
extern XContext wWinContext; extern XContext wWinContext;
/* protocol atoms */
extern Atom _XA_WINDOWMAKER_STATE;
/***** Local Stuff *****/ /***** Local Stuff *****/
static WWindowState *windowState = NULL; static WWindowState *windowState = NULL;
static FocusMode getFocusMode(WWindow *wwin); static FocusMode getFocusMode(WWindow *wwin);
@@ -739,10 +736,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
WSETUFLAG(wwin, shared_appicon, 0); WSETUFLAG(wwin, shared_appicon, 0);
if (wwin->main_window) { if (wwin->main_window) {
extern Atom _XA_WINDOWMAKER_MENU;
XTextProperty text_prop; 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); WSETUFLAG(wwin, shared_appicon, 0);
} }
@@ -2307,8 +2303,8 @@ void wWindowSaveState(WWindow * wwin)
WMCountInArray(wwin->screen_ptr->shortcutWindows[i], wwin)) WMCountInArray(wwin->screen_ptr->shortcutWindows[i], wwin))
data[9] |= 1 << i; data[9] |= 1 << i;
} }
XChangeProperty(dpy, wwin->client_win, _XA_WINDOWMAKER_STATE, XChangeProperty(dpy, wwin->client_win, w_global.atom.wmaker.state,
_XA_WINDOWMAKER_STATE, 32, PropModeReplace, (unsigned char *)data, 10); w_global.atom.wmaker.state, 32, PropModeReplace, (unsigned char *)data, 10);
} }
static int getSavedState(Window window, WSavedState ** state) static int getSavedState(Window window, WSavedState ** state)
@@ -2319,8 +2315,8 @@ static int getSavedState(Window window, WSavedState ** state)
unsigned long bytes_after_ret; unsigned long bytes_after_ret;
long *data; long *data;
if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0, 10, if (XGetWindowProperty(dpy, window, w_global.atom.wmaker.state, 0, 10,
True, _XA_WINDOWMAKER_STATE, True, w_global.atom.wmaker.state,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret, &type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)&data) != Success || !data || nitems_ret < 10) (unsigned char **)&data) != Success || !data || nitems_ret < 10)
return 0; return 0;
@@ -2340,7 +2336,7 @@ static int getSavedState(Window window, WSavedState ** state)
XFree(data); XFree(data);
if (*state && type_ret == _XA_WINDOWMAKER_STATE) if (*state && type_ret == w_global.atom.wmaker.state)
return 1; return 1;
else else
return 0; return 0;