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

wmaker: Moved definition of WM-related XAtoms into the global variables structure

This commit is contained in:
Christophe CURIS
2013-09-29 13:22:55 +02:00
committed by Carlos R. Mafra
parent 32cebb1305
commit ecfb2dc902
13 changed files with 57 additions and 78 deletions

View File

@@ -481,6 +481,25 @@ extern struct wmaker_global_variables {
} timestamp; } 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; } w_global;
extern unsigned int ValidModMask; extern unsigned int ValidModMask;

View File

@@ -53,7 +53,6 @@
/****** Global Variables ******/ /****** Global Variables ******/
int ignore_wks_change = 0; 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, static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, int *new_y,
unsigned int *new_width, unsigned int *new_height); unsigned int *new_width, unsigned int *new_height);
@@ -172,7 +171,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
XFlush(dpy); XFlush(dpy);
if (wwin->protocols.TAKE_FOCUS) if (wwin->protocols.TAKE_FOCUS)
wClientSendProtocol(wwin, _XA_WM_TAKE_FOCUS, timestamp); wClientSendProtocol(wwin, w_global.atom.wm.take_focus, timestamp);
XSync(dpy, False); XSync(dpy, False);
} else { } else {

View File

@@ -49,10 +49,6 @@
/* contexts */ /* contexts */
extern XContext wWinContext; 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_WINDOWMAKER_MENU;
extern Atom _XA_GNUSTEP_WM_ATTR; 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[0] = (unsigned long)state;
data[1] = (unsigned long)icon_win; data[1] = (unsigned long)icon_win;
XChangeProperty(dpy, wwin->client_win, _XA_WM_STATE, _XA_WM_STATE, 32, XChangeProperty(dpy, wwin->client_win, w_global.atom.wm.state,
PropModeReplace, (unsigned char *)data, 2); w_global.atom.wm.state, 32, PropModeReplace,
(unsigned char *)data, 2);
} }
void wClientGetGravityOffsets(WWindow * wwin, int *ofs_x, int *ofs_y) void wClientGetGravityOffsets(WWindow * wwin, int *ofs_x, int *ofs_y)
@@ -269,7 +266,7 @@ void wClientSendProtocol(WWindow * wwin, Atom protocol, Time time)
XEvent event; XEvent event;
event.xclient.type = ClientMessage; 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.format = 32;
event.xclient.display = dpy; event.xclient.display = dpy;
event.xclient.window = wwin->client_win; event.xclient.window = wwin->client_win;
@@ -552,7 +549,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
break; break;
default: default:
if (event->atom == _XA_WM_PROTOCOLS) { if (event->atom == w_global.atom.wm.protocols) {
PropGetProtocols(wwin->client_win, &wwin->protocols); PropGetProtocols(wwin->client_win, &wwin->protocols);
@@ -561,7 +558,7 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
if (wwin->frame) if (wwin->frame)
wWindowUpdateButtonImages(wwin); wWindowUpdateButtonImages(wwin);
} else if (event->atom == _XA_WM_COLORMAP_WINDOWS) { } else if (event->atom == w_global.atom.wm.colormap_windows) {
GetColormapWindows(wwin); GetColormapWindows(wwin);
wColormapInstallForWindow(wwin->screen_ptr, wwin); wColormapInstallForWindow(wwin->screen_ptr, wwin);

View File

@@ -85,16 +85,11 @@ extern int wScreenCount;
#define MOD_MASK wPreferences.modifier_mask #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_ATTR;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW; extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_GNUSTEP_TITLEBAR_STATE; extern Atom _XA_GNUSTEP_TITLEBAR_STATE;
extern Atom _XA_WINDOWMAKER_WM_FUNCTION; extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
extern Atom _XA_WINDOWMAKER_COMMAND; extern Atom _XA_WINDOWMAKER_COMMAND;
extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
#ifdef SHAPE #ifdef SHAPE
extern Bool wShapeSupported; extern Bool wShapeSupported;
@@ -930,7 +925,7 @@ static void handleClientMessage(XEvent * event)
WObjDescriptor *desc; WObjDescriptor *desc;
/* handle transition from Normal to Iconic state */ /* 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) { && event->xclient.format == 32 && event->xclient.data.l[0] == IconicState) {
wwin = wWindowFor(event->xclient.window); wwin = wWindowFor(event->xclient.window);
@@ -938,7 +933,7 @@ static void handleClientMessage(XEvent * event)
return; return;
if (!wwin->flags.miniaturized) if (!wwin->flags.miniaturized)
wIconifyWindow(wwin); 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); WScreen *scr = wScreenForRootWindow(event->xclient.window);
if (!scr) if (!scr)
@@ -1028,7 +1023,7 @@ static void handleClientMessage(XEvent * event)
wFrameWindowChangeState(wwin->frame, WS_FOCUSED); wFrameWindowChangeState(wwin->frame, WS_FOCUSED);
break; 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); WScreen *scr = wScreenForRootWindow(event->xclient.window);
if (!scr) if (!scr)
return; return;
@@ -1554,7 +1549,7 @@ static void handleKeyPress(XEvent * event)
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_closable)) { if (ISMAPPED(wwin) && ISFOCUSED(wwin) && !WFLAGP(wwin, no_closable)) {
CloseWindowMenu(scr); CloseWindowMenu(scr);
if (wwin->protocols.DELETE_WINDOW) 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; break;
case WKBD_SELECT: case WKBD_SELECT:

View File

@@ -97,16 +97,6 @@ XContext wStackContext;
XContext wVEdgeContext; XContext wVEdgeContext;
/* Atoms */ /* 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_ATTR;
Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW; Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
Atom _XA_GNUSTEP_WM_RESIZEBAR; Atom _XA_GNUSTEP_WM_RESIZEBAR;
@@ -123,8 +113,6 @@ Atom _XA_WINDOWMAKER_COMMAND;
Atom _XA_WINDOWMAKER_ICON_SIZE; Atom _XA_WINDOWMAKER_ICON_SIZE;
Atom _XA_WINDOWMAKER_ICON_TILE; Atom _XA_WINDOWMAKER_ICON_TILE;
Atom _XA_WM_IGNORE_FOCUS_EVENTS;
#ifdef SHAPE #ifdef SHAPE
Bool wShapeSupported; Bool wShapeSupported;
int wShapeEventBase; int wShapeEventBase;

View File

@@ -32,11 +32,6 @@
#include "properties.h" #include "properties.h"
/* atoms */ /* 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_ATTR;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW; extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_WINDOWMAKER_WM_FUNCTION; extern Atom _XA_WINDOWMAKER_WM_FUNCTION;
@@ -92,11 +87,11 @@ void PropGetProtocols(Window window, WProtocols * prots)
return; return;
} }
for (i = 0; i < count; i++) { 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; 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; 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; prots->SAVE_YOURSELF = 1;
else if (protocols[i] == _XA_GNUSTEP_WM_MINIATURIZE_WINDOW) else if (protocols[i] == _XA_GNUSTEP_WM_MINIATURIZE_WINDOW)
prots->MINIATURIZE_WINDOW = 1; prots->MINIATURIZE_WINDOW = 1;
@@ -234,7 +229,7 @@ Window PropGetClientLeader(Window window)
Window *win; Window *win;
Window leader; 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) if (!win)
return None; return None;
@@ -250,7 +245,8 @@ int PropGetWindowState(Window window)
long *data; long *data;
long state; 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) if (!data)
return -1; return -1;

View File

@@ -85,10 +85,6 @@
#include <WINGs/WUtil.h> #include <WINGs/WUtil.h>
/** Global **/
extern Atom _XA_WM_SAVE_YOURSELF;
static WMPropList *sApplications = NULL; static WMPropList *sApplications = NULL;
static WMPropList *sCommand; static WMPropList *sCommand;

View File

@@ -38,7 +38,6 @@
#include "colormap.h" #include "colormap.h"
#include "shutdown.h" #include "shutdown.h"
extern Atom _XA_WM_DELETE_WINDOW;
extern int wScreenCount; extern int wScreenCount;
static void wipeDesktop(WScreen * scr); static void wipeDesktop(WScreen * scr);
@@ -196,7 +195,8 @@ static void wipeDesktop(WScreen * scr)
wwin = scr->focused_window; wwin = scr->focused_window;
while (wwin) { while (wwin) {
if (wwin->protocols.DELETE_WINDOW) 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 else
wClientKill(wwin); wClientKill(wwin);
wwin = wwin->prev; wwin = wwin->prev;

View File

@@ -108,15 +108,6 @@ extern XContext wStackContext;
extern XContext wVEdgeContext; extern XContext wVEdgeContext;
/* atoms */ /* 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_GNUSTEP_WM_ATTR;
extern Atom _XA_WINDOWMAKER_MENU; extern Atom _XA_WINDOWMAKER_MENU;
extern Atom _XA_WINDOWMAKER_WM_PROTOCOLS; 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_WINDOWMAKER_ICON_TILE;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW; extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_GNUSTEP_TITLEBAR_STATE; extern Atom _XA_GNUSTEP_TITLEBAR_STATE;
extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
#ifndef HAVE_INOTIFY #ifndef HAVE_INOTIFY
/* special flags */ /* special flags */
@@ -513,15 +503,15 @@ void StartUp(Bool defaultScreenOnly)
} }
#endif #endif
_XA_WM_STATE = atom[0]; w_global.atom.wm.state = atom[0];
_XA_WM_CHANGE_STATE = atom[1]; w_global.atom.wm.change_state = atom[1];
_XA_WM_PROTOCOLS = atom[2]; w_global.atom.wm.protocols = atom[2];
_XA_WM_TAKE_FOCUS = atom[3]; w_global.atom.wm.take_focus = atom[3];
_XA_WM_DELETE_WINDOW = atom[4]; w_global.atom.wm.delete_window = atom[4];
_XA_WM_SAVE_YOURSELF = atom[5]; w_global.atom.wm.save_yourself = atom[5];
_XA_WM_CLIENT_LEADER = atom[6]; w_global.atom.wm.client_leader = atom[6];
_XA_WM_COLORMAP_WINDOWS = atom[7]; w_global.atom.wm.colormap_windows = atom[7];
_XA_WM_COLORMAP_NOTIFY = atom[8]; w_global.atom.wm.colormap_notify = atom[8];
_XA_WINDOWMAKER_MENU = atom[9]; _XA_WINDOWMAKER_MENU = atom[9];
_XA_WINDOWMAKER_STATE = atom[10]; _XA_WINDOWMAKER_STATE = atom[10];
@@ -536,7 +526,7 @@ void StartUp(Bool defaultScreenOnly)
_XA_GNUSTEP_WM_MINIATURIZE_WINDOW = atom[18]; _XA_GNUSTEP_WM_MINIATURIZE_WINDOW = atom[18];
_XA_GNUSTEP_TITLEBAR_STATE = atom[19]; _XA_GNUSTEP_TITLEBAR_STATE = atom[19];
_XA_WM_IGNORE_FOCUS_EVENTS = atom[20]; w_global.atom.wm.ignore_focus_events = atom[20];
#ifdef XDND #ifdef XDND
wXDNDInitializeAtoms(); wXDNDInitializeAtoms();

View File

@@ -35,7 +35,6 @@
#include "misc.h" #include "misc.h"
#include "xinerama.h" #include "xinerama.h"
extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
#ifdef SHAPE #ifdef SHAPE
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
@@ -558,7 +557,7 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
Window info_win = panel->scr->info_window; Window info_win = panel->scr->info_window;
XEvent ev; XEvent ev;
ev.xclient.type = ClientMessage; 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.format = 32;
ev.xclient.data.l[0] = True; ev.xclient.data.l[0] = True;

View File

@@ -83,7 +83,6 @@ extern Bool wShapeSupported;
extern XContext wWinContext; extern XContext wWinContext;
/* protocol atoms */ /* protocol atoms */
extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW; extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_WINDOWMAKER_STATE; extern Atom _XA_WINDOWMAKER_STATE;
@@ -2917,7 +2916,8 @@ static void windowCloseClick(WCoreWindow *sender, void *data, XEvent *event)
} else { } else {
if (wwin->protocols.DELETE_WINDOW && event->xbutton.state == 0) { if (wwin->protocols.DELETE_WINDOW && event->xbutton.state == 0) {
/* send delete message */ /* 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 */ /* send delete message */
if (wwin->protocols.DELETE_WINDOW) 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 else
wClientKill(wwin); wClientKill(wwin);
} }

View File

@@ -69,7 +69,6 @@
#define WO_ENTRIES 3 #define WO_ENTRIES 3
/**** Global data ***/ /**** Global data ***/
extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW; extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern WShortKey wKeyBindings[WKBD_LAST]; extern WShortKey wKeyBindings[WKBD_LAST];
@@ -112,7 +111,8 @@ static void execMenuCommand(WMenu * menu, WMenuEntry * entry)
switch (entry->order) { switch (entry->order) {
case MC_CLOSE: case MC_CLOSE:
/* send delete message */ /* 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; break;
case MC_KILL: case MC_KILL:

View File

@@ -50,8 +50,6 @@
#include "xinerama.h" #include "xinerama.h"
#include "properties.h" #include "properties.h"
/* Global variables */
extern Atom _XA_WM_DELETE_WINDOW;
/* Root Window Properties */ /* Root Window Properties */
static Atom net_supported; static Atom net_supported;
@@ -1405,7 +1403,8 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
} else if (event->message_type == net_close_window) { } else if (event->message_type == net_close_window) {
if (!WFLAGP(wwin, no_closable)) { if (!WFLAGP(wwin, no_closable)) {
if (wwin->protocols.DELETE_WINDOW) 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) { } else if (event->message_type == net_wm_state) {
int maximized = wwin->flags.maximized; int maximized = wwin->flags.maximized;