applied Sylvain Laurent's EWMH fullscreen state patch, simplified his patch a bit
c6180949
2 file(s) · +22 −4
| 1 | 1 | /* See LICENSE file for copyright and license details. */ |
|
| 2 | 2 | ||
| 3 | 3 | /* appearance */ |
|
| 4 | - | static const char font[] = "-*-*-medium-*-*-*-14-*-*-*-*-*-*-*"; |
|
| 4 | + | static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*"; |
|
| 5 | 5 | static const char normbordercolor[] = "#cccccc"; |
|
| 6 | 6 | static const char normbgcolor[] = "#cccccc"; |
|
| 7 | 7 | static const char normfgcolor[] = "#000000"; |
| 41 | 41 | #endif /* XINERAMA */ |
|
| 42 | 42 | ||
| 43 | 43 | /* macros */ |
|
| 44 | - | #define D if(1) |
|
| 45 | 44 | #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) |
|
| 46 | 45 | #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) |
|
| 47 | 46 | #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) |
|
| 58 | 57 | /* enums */ |
|
| 59 | 58 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
|
| 60 | 59 | enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ |
|
| 61 | - | enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
|
| 60 | + | enum { NetSupported, NetWMName, NetWMState, |
|
| 61 | + | NetWMFullscreen, NetLast }; /* EWMH atoms */ |
|
| 62 | 62 | enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ |
|
| 63 | 63 | enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, |
|
| 64 | 64 | ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
|
| 162 | 162 | static void cleanup(void); |
|
| 163 | 163 | static void cleanupmon(Monitor *mon); |
|
| 164 | 164 | static void clearurgent(Client *c); |
|
| 165 | + | static void clientmessage(XEvent *e); |
|
| 165 | 166 | static void configure(Client *c); |
|
| 166 | 167 | static void configurenotify(XEvent *e); |
|
| 167 | 168 | static void configurerequest(XEvent *e); |
|
| 250 | 251 | static unsigned int numlockmask = 0; |
|
| 251 | 252 | static void (*handler[LASTEvent]) (XEvent *) = { |
|
| 252 | 253 | [ButtonPress] = buttonpress, |
|
| 254 | + | [ClientMessage] = clientmessage, |
|
| 253 | 255 | [ConfigureRequest] = configurerequest, |
|
| 254 | 256 | [ConfigureNotify] = configurenotify, |
|
| 255 | 257 | [DestroyNotify] = destroynotify, |
|
| 1293 | 1295 | } |
|
| 1294 | 1296 | ||
| 1295 | 1297 | void |
|
| 1298 | + | clientmessage(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 | + | ||
| 1311 | + | void |
|
| 1296 | 1312 | quit(const Arg *arg) { |
|
| 1297 | 1313 | running = False; |
|
| 1298 | 1314 | } |
|
| 1392 | 1408 | XEvent ev; |
|
| 1393 | 1409 | static const char *evname[LASTEvent] = { |
|
| 1394 | 1410 | [ButtonPress] = "buttonpress", |
|
| 1411 | + | [ClientMessage] = "clientmessage", |
|
| 1395 | 1412 | [ConfigureRequest] = "configurerequest", |
|
| 1396 | 1413 | [ConfigureNotify] = "configurenotify", |
|
| 1397 | 1414 | [DestroyNotify] = "destroynotify", |
|
| 1407 | 1424 | /* main event loop */ |
|
| 1408 | 1425 | XSync(dpy, False); |
|
| 1409 | 1426 | while(running && !XNextEvent(dpy, &ev)) { |
|
| 1410 | - | D fprintf(stderr, "run event %s %ld\n", evname[ev.type], ev.xany.window); |
|
| 1411 | 1427 | if(handler[ev.type]) |
|
| 1412 | 1428 | handler[ev.type](&ev); /* call handler */ |
|
| 1413 | 1429 | } |
|
| 1510 | 1526 | wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); |
|
| 1511 | 1527 | netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
|
| 1512 | 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 | 1531 | /* init cursors */ |
|
| 1514 | 1532 | cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); |
|
| 1515 | 1533 | cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); |
|