summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authoranselm@garbe.us <unknown>2010-05-27 08:19:08 +0100
committeranselm@garbe.us <unknown>2010-05-27 08:19:08 +0100
commitc6180949a759e936e57d7ec9d4cfee3379a39cef (patch)
tree5cdb78149a6ab97cf08527d72edcdd5f245745ba /dwm.c
parentadded the related bug reported by voltaic (diff)
downloaddwm-c6180949a759e936e57d7ec9d4cfee3379a39cef.tar.gz
dwm-c6180949a759e936e57d7ec9d4cfee3379a39cef.zip
applied Sylvain Laurent's EWMH fullscreen state patch, simplified his patch a bit
Diffstat (limited to '')
-rw-r--r--dwm.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/dwm.c b/dwm.c
index ac534a8..3b18b2b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -41,7 +41,6 @@
41#endif /* XINERAMA */ 41#endif /* XINERAMA */
42 42
43/* macros */ 43/* macros */
44#define D if(1)
45#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) 44#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
46#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) 45#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask))
47#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) 46#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
@@ -58,7 +57,8 @@
58/* enums */ 57/* enums */
59enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 58enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
60enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ 59enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
61enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ 60enum { NetSupported, NetWMName, NetWMState,
61 NetWMFullscreen, NetLast }; /* EWMH atoms */
62enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ 62enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */
63enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, 63enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
64 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ 64 ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -162,6 +162,7 @@ static void checkotherwm(void);
162static void cleanup(void); 162static void cleanup(void);
163static void cleanupmon(Monitor *mon); 163static void cleanupmon(Monitor *mon);
164static void clearurgent(Client *c); 164static void clearurgent(Client *c);
165static void clientmessage(XEvent *e);
165static void configure(Client *c); 166static void configure(Client *c);
166static void configurenotify(XEvent *e); 167static void configurenotify(XEvent *e);
167static void configurerequest(XEvent *e); 168static void configurerequest(XEvent *e);
@@ -250,6 +251,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
250static unsigned int numlockmask = 0; 251static unsigned int numlockmask = 0;
251static void (*handler[LASTEvent]) (XEvent *) = { 252static void (*handler[LASTEvent]) (XEvent *) = {
252 [ButtonPress] = buttonpress, 253 [ButtonPress] = buttonpress,
254 [ClientMessage] = clientmessage,
253 [ConfigureRequest] = configurerequest, 255 [ConfigureRequest] = configurerequest,
254 [ConfigureNotify] = configurenotify, 256 [ConfigureNotify] = configurenotify,
255 [DestroyNotify] = destroynotify, 257 [DestroyNotify] = destroynotify,
@@ -1293,6 +1295,20 @@ propertynotify(XEvent *e) {
1293} 1295}
1294 1296
1295void 1297void
1298clientmessage(XEvent *e) {
1299 XClientMessageEvent *cme = &e->xclient;
1300
1301 if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) {
1302 if(cme->data.l[0])
1303 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
1304 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
1305 else
1306 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
1307 PropModeReplace, (unsigned char*)0, 0);
1308 }
1309}
1310
1311void
1296quit(const Arg *arg) { 1312quit(const Arg *arg) {
1297 running = False; 1313 running = False;
1298} 1314}
@@ -1392,6 +1408,7 @@ run(void) {
1392 XEvent ev; 1408 XEvent ev;
1393 static const char *evname[LASTEvent] = { 1409 static const char *evname[LASTEvent] = {
1394 [ButtonPress] = "buttonpress", 1410 [ButtonPress] = "buttonpress",
1411 [ClientMessage] = "clientmessage",
1395 [ConfigureRequest] = "configurerequest", 1412 [ConfigureRequest] = "configurerequest",
1396 [ConfigureNotify] = "configurenotify", 1413 [ConfigureNotify] = "configurenotify",
1397 [DestroyNotify] = "destroynotify", 1414 [DestroyNotify] = "destroynotify",
@@ -1407,7 +1424,6 @@ run(void) {
1407 /* main event loop */ 1424 /* main event loop */
1408 XSync(dpy, False); 1425 XSync(dpy, False);
1409 while(running && !XNextEvent(dpy, &ev)) { 1426 while(running && !XNextEvent(dpy, &ev)) {
1410 D fprintf(stderr, "run event %s %ld\n", evname[ev.type], ev.xany.window);
1411 if(handler[ev.type]) 1427 if(handler[ev.type])
1412 handler[ev.type](&ev); /* call handler */ 1428 handler[ev.type](&ev); /* call handler */
1413 } 1429 }
@@ -1510,6 +1526,8 @@ setup(void) {
1510 wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); 1526 wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
1511 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 1527 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
1512 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); 1528 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
1529 netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
1530 netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
1513 /* init cursors */ 1531 /* init cursors */
1514 cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); 1532 cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
1515 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); 1533 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);