foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

atoms.c (899B)


      1 #include <X11/Xproto.h>
      2 #include <X11/Xatom.h>
      3 #include <X11/Xlib.h>
      4 
      5 #include "atoms.h"
      6 #include "foo-wm.h"
      7 
      8 void sendDeleteWindow(Window * window) {
      9   int protocolsReturn = -1;
     10   Atom *protocols     = NULL;
     11   XGetWMProtocols(display, *window, &protocols, &protocolsReturn);
     12 
     13   XEvent dw;
     14   dw.type                 = ClientMessage;
     15   dw.xclient.window       = *window;
     16   dw.xclient.format       = 32;
     17   dw.xclient.message_type = icccmAtoms[WmProtocols];
     18   dw.xclient.data.l[0]    = icccmAtoms[WmDeleteWindow];
     19   dw.xclient.data.l[1]    = CurrentTime;
     20   XSendEvent(display, *window, False, NoEventMask, &dw);
     21 
     22 }
     23 
     24 
     25 void setupAtoms(void) {
     26   // Set Up ICCCM Atoms for:
     27   // WM_PROTOCOLS & WM_DELETE_WINDOW
     28   icccmAtoms[WmProtocols] = XInternAtom(
     29       display, "WM_PROTOCOLS", False);
     30   icccmAtoms[WmDeleteWindow] = XInternAtom(
     31       display, "WM_DELETE_WINDOW", False);
     32 
     33   XSync(display, False);
     34 }