[hackers] [wmii] Allow Xft to work with transparent windows. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Tue, 4 Aug 2009 00:04:09 +0000 (UTC)

changeset: 2476:61414254ec59
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Aug 03 20:04:05 2009 -0400
files: cmd/wmii/client.c cmd/wmii/event.c cmd/wmii/ewmh.c cmd/wmii/frame.c cmd/wmii/fs.c cmd/wmii/key.c cmd/wmii/main.c cmd/wmii/root.c cmd/wmii/view.c cmd/wmii/x11.c cmd/wmii/xext.c include/x11.h
description:
Allow Xft to work with transparent windows.

diff -r 908809174e4b -r 61414254ec59 cmd/wmii/client.c
--- a/cmd/wmii/client.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/client.c Mon Aug 03 20:04:05 2009 -0400
@@ -105,7 +105,7 @@
                          Pt(wa->width, wa->height));
 
         c->w.type = WWindow;
- c->w.w = w;
+ c->w.xid = w;
         c->w.r = c->r;
 
         depth = scr.depth;
@@ -132,7 +132,7 @@
         fwa.background_pixmap = None;
         fwa.bit_gravity = NorthWestGravity;
         fwa.border_pixel = 0;
- fwa.colormap = XCreateColormap(display, scr.root.w, vis, AllocNone);
+ fwa.colormap = XCreateColormap(display, scr.root.xid, vis, AllocNone);
         fwa.event_mask = SubstructureRedirectMask
                        | SubstructureNotifyMask
                        | StructureNotifyMask
@@ -165,7 +165,7 @@
 
         group_init(c);
 
- grab_button(c->framewin->w, AnyButton, AnyModifier);
+ grab_button(c->framewin->xid, AnyButton, AnyModifier);
 
         for(t=&client ;; t=&t[0]->next)
                 if(!*t) {
@@ -324,7 +324,7 @@
 win2client(XWindow w) {
         Client *c;
         for(c=client; c; c=c->next)
- if(c->w.w == w) break;
+ if(c->w.xid == w) break;
         return c;
 }
 
@@ -561,8 +561,8 @@
         r = rectsubpt(c->r, Pt(c->border, c->border));
 
         e.type = ConfigureNotify;
- e.event = c->w.w;
- e.window = c->w.w;
+ e.event = c->w.xid;
+ e.window = c->w.xid;
         e.above = None;
         e.override_redirect = false;
 
@@ -586,7 +586,7 @@
                 client_message(c, "WM_DELETE_WINDOW", 0);
                 ewmh_pingclient(c);
         }else
- XKillClient(display, c->w.w);
+ XKillClient(display, c->w.xid);
 }
 
 void
@@ -662,14 +662,14 @@
         }
 
         if(from == UrgManager) {
- wmh = XGetWMHints(display, c->w.w);
+ wmh = XGetWMHints(display, c->w.xid);
                 if(wmh == nil)
                         wmh = emallocz(sizeof *wmh);
 
                 wmh->flags &= ~XUrgencyHint;
                 if(urgent)
                         wmh->flags |= XUrgencyHint;
- XSetWMHints(display, c->w.w, wmh);
+ XSetWMHints(display, c->w.xid, wmh);
                 XFree(wmh);
         }
 }
@@ -778,7 +778,7 @@
                 ewmh_prop(c, a);
                 break;
         case XA_WM_TRANSIENT_FOR:
- XGetTransientForHint(display, c->w.w, &c->trans);
+ XGetTransientForHint(display, c->w.xid, &c->trans);
                 break;
         case XA_WM_NORMAL_HINTS:
                 memset(&h, 0, sizeof h);
@@ -792,7 +792,7 @@
                         view_update(c->sel->view);
                 break;
         case XA_WM_HINTS:
- wmh = XGetWMHints(display, c->w.w);
+ wmh = XGetWMHints(display, c->w.xid);
                 if(wmh) {
                         c->noinput = (wmh->flags&InputFocus) && !wmh->input;
                         client_seturgent(c, (wmh->flags & XUrgencyHint) != 0, UrgClient);
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/event.c
--- a/cmd/wmii/event.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/event.c Mon Aug 03 20:04:05 2009 -0400
@@ -25,7 +25,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;
         }
@@ -214,7 +214,7 @@
         if((ev->mode == NotifyWhileGrabbed) && (disp.hasgrab != &c_root))
                 return;
 
- if(ev->window == screen->barwin->w) {
+ if(ev->window == screen->barwin->xid) {
                 print_focus("focusin", nil, "<nil>");
                 disp.focus = nil;
         }
@@ -318,7 +318,7 @@
         Window *w;
 
         ignoreenter = ev->serial;
- if((w = findwin(ev->window)) && (ev->event == w->parent->w)) {
+ if((w = findwin(ev->window)) && (ev->event == w->parent->xid)) {
                 w->mapped = false;
                 if(ev->send_event || w->unmapped-- == 0)
                         handle(w, unmap, ev);
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/ewmh.c Mon Aug 03 20:04:05 2009 -0400
@@ -29,7 +29,7 @@
                 Rect(0, 0, 1, 1), 0 /*depth*/,
                 InputOnly, &wa, 0);
 
- win = ewmhwin->w;
+ win = ewmhwin->xid;
         changeprop_long(&scr.root, Net("SUPPORTING_WM_CHECK"), "WINDOW", &win, 1);
         changeprop_long(ewmhwin, Net("SUPPORTING_WM_CHECK"), "WINDOW", &win, 1);
         changeprop_string(ewmhwin, Net("WM_NAME"), myname);
@@ -80,7 +80,7 @@
 
         vector_linit(&vec);
         for(c=client; c; c=c->next)
- vector_lpush(&vec, c->w.w);
+ vector_lpush(&vec, c->w.xid);
         changeprop_long(&scr.root, Net("CLIENT_LIST"), "WINDOW", vec.ary, vec.n);
         free(vec.ary);
 }
@@ -99,14 +99,14 @@
                 foreach_column(v, s, a)
                         for(f=a->frame; f; f=f->anext)
                                 if(f->client->sel == f)
- vector_lpush(&vec, f->client->w.w);
+ vector_lpush(&vec, f->client->w.xid);
         }
         for(v=view; v; v=v->next) {
                 for(f=v->floating->stack; f; f=f->snext)
                         if(!f->snext) break;
                 for(; f; f=f->sprev)
                         if(f->client->sel == f)
- vector_lpush(&vec, f->client->w.w);
+ vector_lpush(&vec, f->client->w.xid);
         }
 
         changeprop_long(&scr.root, Net("CLIENT_LIST_STACKING"), "WINDOW", vec.ary, vec.n);
@@ -162,7 +162,7 @@
         if(e->ping)
                 return;
 
- client_message(c, Net("WM_PING"), c->w.w);
+ client_message(c, Net("WM_PING"), c->w.xid);
         e->ping = xtime++;
         e->timer = ixp_settimer(&srv, PingTime, pingtimeout, c);
 }
@@ -393,7 +393,7 @@
                         return 0;
                 Dprint(DEwmh, "\t%A\n", l[0]);
                 if(l[0] == NET("WM_PING")) {
- if(e->window != scr.root.w)
+ if(e->window != scr.root.xid)
                                 return -1;
                         c = win2client(l[2]);
                         if(c == nil)
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/frame.c Mon Aug 03 20:04:05 2009 -0400
@@ -528,7 +528,7 @@
          * What's more, the designers of X11 felt that it would be unfair to
          * implementers to make it possible to detect, or forbid, such changes.
          */
- XSetWindowBackgroundPixmap(display, c->framewin->w, None);
+ XSetWindowBackgroundPixmap(display, c->framewin->xid, None);
 
         copyimage(c->framewin, fr, img, ZP);
 }
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/fs.c Mon Aug 03 20:04:05 2009 -0400
@@ -249,8 +249,8 @@
                                                 push_file("sel");
                                                 file->volatil = true;
                                                 file->p.client = c;
- file->id = c->w.w;
- file->index = c->w.w;
+ file->id = c->w.xid;
+ file->index = c->w.xid;
                                         }
                                         if(name)
                                                 goto LastItem;
@@ -262,12 +262,12 @@
                                                 goto NextItem;
                                 }
                                 for(c=client; c; c=c->next) {
- if(!name || c->w.w == id) {
+ if(!name || c->w.xid == id) {
                                                 push_file(sxprint("%C", c));
                                                 file->volatil = true;
                                                 file->p.client = c;
- file->id = c->w.w;
- file->index = c->w.w;
+ file->id = c->w.xid;
+ file->index = c->w.xid;
                                                 assert(file->tab.name);
                                                 if(name)
                                                         goto LastItem;
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/key.c
--- a/cmd/wmii/key.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/key.c Mon Aug 03 20:04:05 2009 -0400
@@ -48,21 +48,21 @@
 
 static void
 grabkey(Key *k) {
- _grab(scr.root.w, k->key, k->mod);
- _grab(scr.root.w, k->key, k->mod | LockMask);
+ _grab(scr.root.xid, k->key, k->mod);
+ _grab(scr.root.xid, k->key, k->mod | LockMask);
         if(numlock_mask) {
- _grab(scr.root.w, k->key, k->mod | numlock_mask);
- _grab(scr.root.w, k->key, k->mod | numlock_mask | LockMask);
+ _grab(scr.root.xid, k->key, k->mod | numlock_mask);
+ _grab(scr.root.xid, k->key, k->mod | numlock_mask | LockMask);
         }
 }
 
 static void
 ungrabkey(Key *k) {
- XUngrabKey(display, k->key, k->mod, scr.root.w);
- XUngrabKey(display, k->key, k->mod | LockMask, scr.root.w);
+ XUngrabKey(display, k->key, k->mod, scr.root.xid);
+ XUngrabKey(display, k->key, k->mod | LockMask, scr.root.xid);
         if(numlock_mask) {
- XUngrabKey(display, k->key, k->mod | numlock_mask, scr.root.w);
- XUngrabKey(display, k->key, k->mod | numlock_mask | LockMask, scr.root.w);
+ XUngrabKey(display, k->key, k->mod | numlock_mask, scr.root.xid);
+ XUngrabKey(display, k->key, k->mod | numlock_mask | LockMask, scr.root.xid);
         }
 }
 
@@ -140,11 +140,11 @@
         Client *c;
 
         c = disp.focus;
- if(c == nil || c->w.w == 0)
+ if(c == nil || c->w.xid == 0)
                 return;
 
         e.time = CurrentTime;
- e.window = c->w.w;
+ e.window = c->w.xid;
         e.display = display;
         e.state = mod;
         e.keycode = key;
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/main.c
--- a/cmd/wmii/main.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/main.c Mon Aug 03 20:04:05 2009 -0400
@@ -45,7 +45,7 @@
         XWindowAttributes wa;
         XWindow d1, d2;
 
- if(XQueryTree(display, scr.root.w, &d1, &d2, &wins, &num)) {
+ if(XQueryTree(display, scr.root.xid, &d1, &d2, &wins, &num)) {
                 for(i = 0; i < num; i++) {
                         if(!XGetWindowAttributes(display, wins[i], &wa))
                                 continue;
@@ -124,7 +124,7 @@
         XAllocNamedColor(display, scr.colormap,
                         "black", &black, &dummy);
         pix = XCreateBitmapFromData(
- display, scr.root.w,
+ display, scr.root.xid,
                         zchar, 1, 1);
 
         cursor[CurNone] = XCreatePixmapCursor(display,
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/root.c
--- a/cmd/wmii/root.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/root.c Mon Aug 03 20:04:05 2009 -0400
@@ -75,7 +75,7 @@
 kdown_event(Window *w, XKeyEvent *e) {
 
         e->state &= valid_mask;
- kpress(w->w, e->state, (KeyCode)e->keycode);
+ kpress(w->xid, e->state, (KeyCode)e->keycode);
 }
 
 static Handlers handlers = {
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/view.c
--- a/cmd/wmii/view.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/view.c Mon Aug 03 20:04:05 2009 -0400
@@ -437,25 +437,25 @@
         /* *sigh */
         for(f=v->floating->stack; f; f=f->snext)
                 if(f->client->w.ewmh.type & TypeDock)
- vector_lpush(&wins, f->client->framewin->w);
+ vector_lpush(&wins, f->client->framewin->xid);
                 else
                         break;
 
         for(; f; f=f->snext)
- vector_lpush(&wins, f->client->framewin->w);
+ vector_lpush(&wins, f->client->framewin->xid);
 
         for(int s=0; s < nscreens; s++)
- vector_lpush(&wins, screens[s]->barwin->w);
+ vector_lpush(&wins, screens[s]->barwin->xid);
 
         for(d = divs; d && d->w->mapped; d = d->next)
- vector_lpush(&wins, d->w->w);
+ vector_lpush(&wins, d->w->xid);
 
         foreach_column(v, s, a)
                 if(a->frame) {
- vector_lpush(&wins, a->sel->client->framewin->w);
+ vector_lpush(&wins, a->sel->client->framewin->xid);
                         for(f=a->frame; f; f=f->anext)
                                 if(f != a->sel)
- vector_lpush(&wins, f->client->framewin->w);
+ vector_lpush(&wins, f->client->framewin->xid);
                 }
 
         ewmh_updatestacking();
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/x11.c Mon Aug 03 20:04:05 2009 -0400
@@ -15,7 +15,7 @@
 const Point ZP = {0, 0};
 const Rectangle ZR = {{0, 0}, {0, 0}};
 
-const Window _pointerwin = { .w = PointerRoot };
+const Window _pointerwin = { .xid = PointerRoot };
 Window* const pointerwin = (Window*)&_pointerwin;
 
 static Map windowmap;
@@ -153,7 +153,7 @@
         Window *w;
 
         w = va_arg(f->args, Window*);
- return fmtprint(f, "0x%ulx", w->w);
+ return fmtprint(f, "0x%ulx", w->xid);
 }
 
 /* Init */
@@ -171,7 +171,7 @@
         scr.white = WhitePixel(display, scr.screen);
         scr.black = BlackPixel(display, scr.screen);
         
- scr.root.w = RootWindow(display, scr.screen);
+ scr.root.xid = RootWindow(display, scr.screen);
         scr.root.r = Rect(0, 0,
                           DisplayWidth(display, scr.screen),
                           DisplayHeight(display, scr.screen));
@@ -237,8 +237,12 @@
 
         img = emallocz(sizeof *img);
         img->type = WImage;
- img->w = XCreatePixmap(display, scr.root.w, w, h, depth);
- img->gc = XCreateGC(display, img->w, 0, nil);
+ img->xid = XCreatePixmap(display, scr.root.xid, w, h, depth);
+ img->gc = XCreateGC(display, img->xid, 0, nil);
+ img->colormap = scr.colormap;
+ img->visual = scr.visual;
+ if(depth == 32)
+ img->visual = render_visual;
         img->depth = depth;
         img->r = Rect(0, 0, w, h);
         return img;
@@ -253,7 +257,7 @@
 
         if(img->xft)
                 XftDrawDestroy(img->xft);
- XFreePixmap(display, img->w);
+ XFreePixmap(display, img->xid);
         XFreeGC(display, img->gc);
         free(img);
 }
@@ -261,7 +265,7 @@
 static XftDraw*
 xftdrawable(Image *img) {
         if(img->xft == nil)
- img->xft = XftDrawCreate(display, img->w, scr.visual, scr.colormap);
+ img->xft = XftDrawCreate(display, img->xid, img->visual, img->colormap);
         return img->xft;
 }
 
@@ -275,17 +279,20 @@
         assert(parent->type == WWindow);
 
         w = emallocz(sizeof *w);
+ w->visual = vis;
         w->type = WWindow;
         w->parent = parent;
+ if(valmask & CWColormap)
+ w->colormap = wa->colormap;
 
- w->w = XCreateWindow(display, parent->w, r.min.x, r.min.y, Dx(r), Dy(r),
+ w->xid = XCreateWindow(display, parent->xid, r.min.x, r.min.y, Dx(r), Dy(r),
                                 0 /* border */, depth, class, vis, valmask, wa);
 #if 0
         print("createwindow_visual(%W, %R, %d, %p, %ud, %p, %x) = %W\n",
                         parent, r, depth, vis, class, wa, valmask, w);
 #endif
         if(class != InputOnly)
- w->gc = XCreateGC(display, w->w, 0, nil);
+ w->gc = XCreateGC(display, w->xid, 0, nil);
 
         w->r = r;
         w->depth = depth;
@@ -303,14 +310,14 @@
 
         w = malloc(sizeof *w);
         w->type = WWindow;
- w->w = xw;
+ w->xid = xw;
         return freelater(w);
 }
 
 void
 reparentwindow(Window *w, Window *par, Point p) {
         assert(w->type == WWindow);
- XReparentWindow(display, w->w, par->w, p.x, p.y);
+ XReparentWindow(display, w->xid, par->xid, p.x, p.y);
         w->parent = par;
         w->r = rectsubpt(w->r, w->r.min);
         w->r = rectaddpt(w->r, p);
@@ -324,19 +331,19 @@
                 XftDrawDestroy(w->xft);
         if(w->gc)
                 XFreeGC(display, w->gc);
- XDestroyWindow(display, w->w);
+ XDestroyWindow(display, w->xid);
         free(w);
 }
 
 void
 setwinattr(Window *w, WinAttr *wa, int valmask) {
         assert(w->type == WWindow);
- XChangeWindowAttributes(display, w->w, valmask, wa);
+ XChangeWindowAttributes(display, w->xid, valmask, wa);
 }
 
 void
 selectinput(Window *w, long mask) {
- XSelectInput(display, w->w, mask);
+ XSelectInput(display, w->xid, mask);
 }
 
 static void
@@ -351,7 +358,7 @@
         wc.width = Dx(r);
         wc.height = Dy(r);
         wc.border_width = border;
- XConfigureWindow(display, w->w, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ XConfigureWindow(display, w->xid, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 
         w->r = r;
         w->border = border;
@@ -362,7 +369,7 @@
 
         assert(w->type == WWindow);
         if(width)
- XSetWindowBorder(display, w->w, pixel);
+ XSetWindowBorder(display, w->xid, pixel);
         if(width != w->border)
                 configwin(w, w->r, width);
 }
@@ -388,7 +395,7 @@
 mapwin(Window *w) {
         assert(w->type == WWindow);
         if(!w->mapped) {
- XMapWindow(display, w->w);
+ XMapWindow(display, w->xid);
                 w->mapped = 1;
                 return 1;
         }
@@ -399,7 +406,7 @@
 unmapwin(Window *w) {
         assert(w->type == WWindow);
         if(w->mapped) {
- XUnmapWindow(display, w->w);
+ XUnmapWindow(display, w->xid);
                 w->mapped = 0;
                 w->unmapped++;
                 return 1;
@@ -410,13 +417,13 @@
 void
 raisewin(Window *w) {
         assert(w->type == WWindow);
- XRaiseWindow(display, w->w);
+ XRaiseWindow(display, w->xid);
 }
 
 void
 lowerwin(Window *w) {
         assert(w->type == WWindow);
- XLowerWindow(display, w->w);
+ XLowerWindow(display, w->xid);
 }
 
 Handlers*
@@ -428,9 +435,9 @@
         assert((w->prev != nil && w->next != nil) || w->next == w->prev);
 
         if(new == nil)
- map_rm(&windowmap, (ulong)w->w);
+ map_rm(&windowmap, (ulong)w->xid);
         else {
- e = map_get(&windowmap, (ulong)w->w, true);
+ e = map_get(&windowmap, (ulong)w->xid, true);
                 *e = w;
         }
         old = w->handler;
@@ -452,8 +459,8 @@
 void
 setshapemask(Window *dst, Image *src, Point pt) {
         /* Assumes that we have the shape extension... */
- XShapeCombineMask (display, dst->w,
- ShapeBounding, pt.x, pt.y, src->w, ShapeSet);
+ XShapeCombineMask (display, dst->xid,
+ ShapeBounding, pt.x, pt.y, src->xid, ShapeSet);
 }
 
 static void
@@ -473,14 +480,14 @@
 
         XSetLineAttributes(display, dst->gc, w, LineSolid, CapButt, JoinMiter);
         setgccol(dst, col);
- XDrawRectangle(display, dst->w, dst->gc,
+ XDrawRectangle(display, dst->xid, dst->gc,
                         r.min.x, r.min.y, Dx(r), Dy(r));
 }
 
 void
 fill(Image *dst, Rectangle r, ulong col) {
         setgccol(dst, col);
- XFillRectangle(display, dst->w, dst->gc,
+ XFillRectangle(display, dst->xid, dst->gc,
                 r.min.x, r.min.y, Dx(r), Dy(r));
 }
 
@@ -504,7 +511,7 @@
         xp = convpts(pt, np);
         XSetLineAttributes(display, dst->gc, w, LineSolid, cap, JoinMiter);
         setgccol(dst, col);
- XDrawLines(display, dst->w, dst->gc, xp, np, CoordModeOrigin);
+ XDrawLines(display, dst->xid, dst->gc, xp, np, CoordModeOrigin);
         free(xp);
 }
 
@@ -514,7 +521,7 @@
 
         xp = convpts(pt, np);
         setgccol(dst, col);
- XFillPolygon(display, dst->w, dst->gc, xp, np, Complex, CoordModeOrigin);
+ XFillPolygon(display, dst->xid, dst->gc, xp, np, Complex, CoordModeOrigin);
         free(xp);
 }
 
@@ -522,7 +529,7 @@
 drawline(Image *dst, Point p1, Point p2, int cap, int w, ulong col) {
         XSetLineAttributes(display, dst->gc, w, LineSolid, cap, JoinMiter);
         setgccol(dst, col);
- XDrawLine(display, dst->w, dst->gc, p1.x, p1.y, p2.x, p2.y);
+ XDrawLine(display, dst->xid, dst->gc, p1.x, p1.y, p2.x, p2.y);
 }
 
 uint
@@ -576,7 +583,7 @@
         setgccol(dst, col);
         switch(font->type) {
         case FFontSet:
- Xutf8DrawString(display, dst->w,
+ Xutf8DrawString(display, dst->xid,
                                 font->font.set, dst->gc,
                                 x, y,
                                 buf, len);
@@ -588,7 +595,7 @@
                 break;
         case FX11:
                 XSetFont(display, dst->gc, font->font.x11->fid);
- XDrawString(display, dst->w, dst->gc,
+ XDrawString(display, dst->xid, dst->gc,
                             x, y, buf, len);
                 break;
         default:
@@ -603,7 +610,7 @@
 void
 copyimage(Image *dst, Rectangle r, Image *src, Point p) {
         XCopyArea(display,
- src->w, dst->w,
+ src->xid, dst->xid,
                   dst->gc,
                   r.min.x, r.min.y, Dx(r), Dy(r),
                   p.x, p.y);
@@ -781,7 +788,7 @@
         XClientMessageEvent e;
 
         e.type = ClientMessage;
- e.window = w->w;
+ e.window = w->xid;
         e.message_type = xatom(name);
         e.format = 32;
         e.data.l[0] = l0;
@@ -794,7 +801,7 @@
 
 void
 sendevent(Window *w, bool propegate, long mask, XEvent *e) {
- XSendEvent(display, w->w, propegate, mask, e);
+ XSendEvent(display, w->xid, propegate, mask, e);
 }
 
 KeyCode
@@ -852,13 +859,13 @@
 /* Properties */
 void
 delproperty(Window *w, char *prop) {
- XDeleteProperty(display, w->w, xatom(prop));
+ XDeleteProperty(display, w->xid, xatom(prop));
 }
 
 void
 changeproperty(Window *w, char *prop, char *type,
                int width, uchar data[], int n) {
- XChangeProperty(display, w->w, xatom(prop), xatom(type), width,
+ XChangeProperty(display, w->xid, xatom(prop), xatom(type), width,
                         PropModeReplace, data, n);
 }
 
@@ -920,7 +927,7 @@
 
         typea = (type ? xatom(type) : 0L);
 
- status = XGetWindowProperty(display, w->w,
+ status = XGetWindowProperty(display, w->xid,
                 xatom(prop), offset, length, false /* delete */,
                 typea, actual, format, &n, &extra, ret);
 
@@ -997,7 +1004,7 @@
         *ret = nil;
         n = 0;
 
- XGetTextProperty(display, w->w, &prop, xatom(name));
+ XGetTextProperty(display, w->xid, &prop, xatom(name));
         if(prop.nitems > 0) {
                 if(Xutf8TextPropertyToTextList(display, &prop, &list, &n) == Success)
                         *ret = list;
@@ -1026,7 +1033,7 @@
         XWindowAttributes wa;
         Point p;
 
- if(!XGetWindowAttributes(display, w->w, &wa))
+ if(!XGetWindowAttributes(display, w->xid, &wa))
                 return ZR;
         p = translate(w, &scr.root, ZP);
         return rectaddpt(Rect(0, 0, wa.width, wa.height), p);
@@ -1034,7 +1041,7 @@
 
 void
 setfocus(Window *w, int mode) {
- XSetInputFocus(display, w->w, mode, CurrentTime);
+ XSetInputFocus(display, w->xid, mode, CurrentTime);
 }
 
 XWindow
@@ -1053,7 +1060,7 @@
         uint ui;
         int i;
         
- XQueryPointer(display, w->w, &win, &win, &i, &i, &pt.x, &pt.y, &ui);
+ XQueryPointer(display, w->xid, &win, &win, &i, &i, &pt.x, &pt.y, &ui);
         return pt;
 }
 
@@ -1064,7 +1071,7 @@
         uint ui;
         int i;
         
- return XQueryPointer(display, scr.root.w, &win, &win, &i, &i,
+ return XQueryPointer(display, scr.root.xid, &win, &win, &i, &i,
                              &pt.x, &pt.y, &ui);
 }
 
@@ -1082,7 +1089,7 @@
                 system(sxprint("DISPLAY=%s wiwarp %d %d", real, pt.x, pt.y));
 
         XWarpPointer(display,
- /* src, dest w */ None, scr.root.w,
+ /* src, dest w */ None, scr.root.xid,
                 /* src_rect */ 0, 0, 0, 0,
                 /* target */ pt.x, pt.y);
 }
@@ -1092,7 +1099,7 @@
         Point pt;
         XWindow w;
 
- XTranslateCoordinates(display, src->w, dst->w, sp.x, sp.y,
+ XTranslateCoordinates(display, src->xid, dst->xid, sp.x, sp.y,
                               &pt.x, &pt.y, &w);
         return pt;
 }
@@ -1103,8 +1110,8 @@
         
         cw = None;
         if(confine)
- cw = confine->w;
- return XGrabPointer(display, w->w, false /* owner events */, mask,
+ cw = confine->xid;
+ return XGrabPointer(display, w->xid, false /* owner events */, mask,
                 GrabModeAsync, GrabModeAsync, cw, cur, CurrentTime
                 ) == GrabSuccess;
 }
@@ -1117,7 +1124,7 @@
 int
 grabkeyboard(Window *w) {
 
- return XGrabKeyboard(display, w->w, true /* owner events */,
+ return XGrabKeyboard(display, w->xid, true /* owner events */,
                 GrabModeAsync, GrabModeAsync, CurrentTime
                 ) == GrabSuccess;
 }
@@ -1145,14 +1152,14 @@
         h->max = Pt(INT_MAX, INT_MAX);
         h->inc = Pt(1,1);
 
- wmh = XGetWMHints(display, w->w);
+ wmh = XGetWMHints(display, w->xid);
         if(wmh) {
                 if(wmh->flags & WindowGroupHint)
                         h->group = wmh->window_group;
                 free(wmh);
         }
 
- if(!XGetWMNormalHints(display, w->w, &xs, &size))
+ if(!XGetWMNormalHints(display, w->xid, &xs, &size))
                 return;
 
         if(xs.flags & PMinSize) {
diff -r 908809174e4b -r 61414254ec59 cmd/wmii/xext.c
--- a/cmd/wmii/xext.c Mon Aug 03 16:33:23 2009 -0400
+++ b/cmd/wmii/xext.c Mon Aug 03 20:04:05 2009 -0400
@@ -55,7 +55,7 @@
                 if(XRRQueryVersion(display, &major, &minor) && major < 1)
                         have_RandR = false;
         if(have_RandR)
- XRRSelectInput(display, scr.root.w, RRScreenChangeNotifyMask);
+ XRRSelectInput(display, scr.root.xid, RRScreenChangeNotifyMask);
 }
 
 static bool
diff -r 908809174e4b -r 61414254ec59 include/x11.h
--- a/include/x11.h Mon Aug 03 16:33:23 2009 -0400
+++ b/include/x11.h Mon Aug 03 20:04:05 2009 -0400
@@ -133,8 +133,10 @@
 
 struct Window {
         int type;
- XID w;
+ XID xid;
         GC gc;
+ Visual* visual;
+ Colormap colormap;
         XftDraw* xft;
         Rectangle r;
         int border;
Received on Tue Aug 04 2009 - 00:04:09 UTC

This archive was generated by hypermail 2.2.0 : Tue Aug 04 2009 - 00:12:06 UTC