wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

xtime.c (684B)


      1 /* Copyright ©2006-2010 Kris Maglione <maglione.k at Gmail>
      2  * See LICENSE file for license details.
      3  */
      4 #include <stuff/x.h>
      5 
      6 static int
      7 findtime(Display *d, XEvent *e, XPointer v) {
      8 	Window *w;
      9 
     10 	w = (Window*)v;
     11 	if(e->type == PropertyNotify && e->xproperty.window == w->xid) {
     12 		event_xtime = e->xproperty.time;
     13 		return true;
     14 	}
     15 	return false;
     16 }
     17 
     18 long
     19 event_updatextime(void) {
     20 	Window *w;
     21 	WinAttr wa;
     22 	XEvent e;
     23 	long l;
     24 
     25 	w = createwindow(&scr.root, Rect(0, 0, 1, 1), 0, InputOnly, &wa, 0);
     26 
     27 	XSelectInput(display, w->xid, PropertyChangeMask);
     28 	changeprop_long(w, "ATOM", "ATOM", &l, 0);
     29 	XIfEvent(display, &e, findtime, (void*)w);
     30 
     31 	destroywindow(w);
     32 	return event_xtime;
     33 }
     34