diff -r 1456ca0c94b7 dwm.c --- a/dwm.c Sun Apr 11 18:42:32 2010 +0100 +++ b/dwm.c Mon May 24 21:12:07 2010 +0200 @@ -58,7 +58,8 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ -enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ +enum { NetSupported, NetWMName, NetWMState, + NetWMFullscreen, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ @@ -162,6 +163,7 @@ static void cleanup(void); static void cleanupmon(Monitor *mon); static void clearurgent(Client *c); +static void clientmessage(XEvent *e); static void configure(Client *c); static void configurenotify(XEvent *e); static void configurerequest(XEvent *e); @@ -250,6 +252,7 @@ static unsigned int numlockmask = 0; static void (*handler[LASTEvent]) (XEvent *) = { [ButtonPress] = buttonpress, + [ClientMessage] = clientmessage, [ConfigureRequest] = configurerequest, [ConfigureNotify] = configurenotify, [DestroyNotify] = destroynotify, @@ -1293,6 +1296,20 @@ } void +clientmessage(XEvent *e) { + XClientMessageEvent *cme = &e->xclient; + + if (cme->message_type == netatom[NetWMState]) { + if (cme->data.l[1] == netatom[NetWMFullscreen]) { + if (cme->data.l[0]) + XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); + else + XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char*)0, 0); + } + } +} + +void quit(const Arg *arg) { running = False; } @@ -1392,6 +1409,7 @@ XEvent ev; static const char *evname[LASTEvent] = { [ButtonPress] = "buttonpress", + [ClientMessage] = "clientmessage", [ConfigureRequest] = "configurerequest", [ConfigureNotify] = "configurenotify", [DestroyNotify] = "destroynotify", @@ -1510,6 +1528,8 @@ wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); + netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); + netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); /* init cursors */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);