[hackers] [wmii] Fix wistrut. Closes issue #131. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Sun, 18 Oct 2009 22:09:01 +0000 (UTC)

changeset: 2557:0e4ad0f7f71f
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Oct 18 18:07:35 2009 -0400
files: cmd/strut/Makefile cmd/strut/event.c cmd/strut/main.c
description:
Fix wistrut. Closes issue #131.

diff -r 33e8ef39fcf2 -r 0e4ad0f7f71f cmd/strut/Makefile
--- a/cmd/strut/Makefile Sun Oct 18 17:33:37 2009 -0400
+++ b/cmd/strut/Makefile Sun Oct 18 18:07:35 2009 -0400
@@ -11,7 +11,7 @@
 
 LIB = $(LIBIXP)
 LDFLAGS += -lm -lregexp9 -lbio -lfmt -lutf
-CFLAGS += -DVERSION=\"$(VERSION)\" -DIXP_NEEDAPI=86
+CFLAGS += -DIXP_NEEDAPI=86
 OBJ = main \
         event \
         ewmh \
diff -r 33e8ef39fcf2 -r 0e4ad0f7f71f cmd/strut/event.c
--- a/cmd/strut/event.c Sun Oct 18 17:33:37 2009 -0400
+++ b/cmd/strut/event.c Sun Oct 18 18:07:35 2009 -0400
@@ -68,7 +68,7 @@
         Window *w;
 
         w = (Window*)v;
- if(e->type == PropertyNotify && e->xproperty.window == w->w) {
+ if(e->type == PropertyNotify && e->xproperty.window == w->xid) {
                 xtime = e->xproperty.time;
                 return true;
         }
@@ -84,7 +84,7 @@
 
         w = createwindow(&scr.root, Rect(0, 0, 1, 1), 0, InputOnly, &wa, 0);
 
- XSelectInput(display, w->w, PropertyChangeMask);
+ XSelectInput(display, w->xid, PropertyChangeMask);
         changeprop_long(w, "ATOM", "ATOM", &l, 0);
         XIfEvent(display, &e, findtime, (void*)w);
 
@@ -272,7 +272,7 @@
         Window *w;
 
         ev = &e->xunmap;
- if((w = findwin(ev->window)) && w->parent && (ev->event == w->parent->w)) {
+ if((w = findwin(ev->window)) && w->parent && (ev->event == w->parent->xid)) {
                 if(ev->send_event || w->unmapped-- == 0)
                         handle(w, unmap, ev);
         }
diff -r 33e8ef39fcf2 -r 0e4ad0f7f71f cmd/strut/main.c
--- a/cmd/strut/main.c Sun Oct 18 17:33:37 2009 -0400
+++ b/cmd/strut/main.c Sun Oct 18 18:07:35 2009 -0400
@@ -10,8 +10,6 @@
 
 static const char version[] = "witray-"VERSION", ©2007 Kris Maglione\n";
 
-static int (*xlib_errorhandler) (Display*, XErrorEvent*);
-
 static void
 usage(void) {
         fatal("usage: %s <window>\n", argv0);
@@ -32,47 +30,7 @@
         va_end(ap);
 }
 
-/*
- * There's no way to check accesses to destroyed windows, thus
- * those cases are ignored (especially on UnmapNotifies).
- * Other types of errors call Xlib's default error handler, which
- * calls exit().
- */
-struct {
- uchar rcode;
- uchar ecode;
-} itab[] = {
- { 0, BadWindow },
- { X_SetInputFocus, BadMatch },
- { X_PolyText8, BadDrawable },
- { X_PolyFillRectangle, BadDrawable },
- { X_PolySegment, BadDrawable },
- { X_ConfigureWindow, BadMatch },
- { X_GrabKey, BadAccess },
- { X_GetAtomName, BadAtom },
-};
-
-static int
-errorhandler(Display *dpy, XErrorEvent *error) {
- int i;
-
- USED(dpy);
-
- if(error->request_code == X_QueryTree
- && error->error_code == BadWindow
- && error->resourceid == win.w)
- fatal("%W: window does not exist", &win);
-
- for(i = 0; i < nelem(itab); i++)
- if((itab[i].rcode == 0 || itab[i].rcode == error->request_code)
- && (itab[i].ecode == 0 || itab[i].ecode == error->error_code))
- return 0;
-
- fprint(2, "%s: fatal error: Xrequest code=%d, Xerror code=%d\n",
- argv0, error->request_code, error->error_code);
-
- return xlib_errorhandler(display, error); /* calls exit() */
-}
+ErrorCode ignored_xerrors[] = { {0,} };
 
 static Window
 findframe(Window *w) {
@@ -81,12 +39,12 @@
         Window ret = {0, };
         uint n;
 
- for(par=w->w; par != scr.root.w; ) {
+ for(par=w->xid; par != scr.root.xid; ) {
                 xw = par;
                 XQueryTree(display, xw, &root, &par, &children, &n);
                 XFree(children);
         }
- ret.w = xw;
+ ret.xid = xw;
         ret.parent = &scr.root;
         return ret;
 }
@@ -98,7 +56,7 @@
         XWindow root;
         uint border, depth;
 
- XGetGeometry(display, win->w, &root,
+ XGetGeometry(display, win->xid, &root,
                      &x, &y, &w, &h,
                      &border, &depth);
         win->r = rectaddpt(Rect(0, 0, w, h),
@@ -119,7 +77,7 @@
         }ARGEND;
 
         s = EARGF(usage());
- if(!getulong(s, &win.w))
+ if(!getulong(s, &win.xid))
                 usage();
 
         if(argc)
@@ -128,7 +86,6 @@
         setlocale(LC_CTYPE, "");
 
         initdisplay();
- xlib_errorhandler = XSetErrorHandler(errorhandler);
 
         frame = findframe(&win);
         getwinsize(&frame);
Received on Sun Oct 18 2009 - 22:09:01 UTC

This archive was generated by hypermail 2.2.0 : Sun Oct 18 2009 - 22:12:06 UTC