[hackers] [wmii] Brute force, set the background pixmap of every window on any X event. Temporary.

From: Kris Maglione <jg_AT_suckless.org>
Date: Fri, 01 Jun 2007 01:09:53 -0000

changeset: 2108:f2e8f05273db
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Apr 21 18:46:17 2007 -0400
summary: Brute force, set the background pixmap of every window on any X event. Temporary.

diff -r 7b787d87bd28 -r f2e8f05273db cmd/wmii/client.c
--- a/cmd/wmii/client.c Sat Apr 21 17:20:19 2007 -0400
+++ b/cmd/wmii/client.c Sat Apr 21 18:46:17 2007 -0400
@@ -56,6 +56,7 @@ create_client(XWindow w, XWindowAttribut
         XSelectInput(display, c->w.w, ClientMask);
 
         fwa.override_redirect = True;
+ fwa.background_pixmap = broken->image;
         fwa.event_mask =
                           SubstructureRedirectMask
                         | SubstructureNotifyMask
@@ -66,7 +67,8 @@ create_client(XWindow w, XWindowAttribut
                         | ButtonReleaseMask;
         c->framewin = createwindow(&scr.root, c->r, scr.depth, InputOutput, &fwa,
                           CWOverrideRedirect
- | CWEventMask);
+ | CWEventMask
+ | CWBackPixmap);
         c->framewin->aux = c;
         c->w.aux = c;
         sethandler(c->framewin, &framehandler);
@@ -138,8 +140,10 @@ destroy_client(Client *c) {
         /* In case the client is already unmapped */
         handler = XSetErrorHandler(ignoreerrors);
 
- r = gravclient(c, ZR);
- r = frame2client(nil, r);
+ if(c->sel) {
+ r = gravclient(c, ZR);
+ r = frame2client(nil, r);
+ }
 
         dummy = nil;
         update_client_views(c, &dummy);
diff -r 7b787d87bd28 -r f2e8f05273db cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Sat Apr 21 17:20:19 2007 -0400
+++ b/cmd/wmii/dat.h Sat Apr 21 18:46:17 2007 -0400
@@ -239,6 +239,7 @@ void (*handler[LASTEvent]) (XEvent *);
 void (*handler[LASTEvent]) (XEvent *);
 
 /* Misc */
+Image *broken;
 Bool starting;
 Bool verbose;
 char *user;
diff -r 7b787d87bd28 -r f2e8f05273db cmd/wmii/event.c
--- a/cmd/wmii/event.c Sat Apr 21 17:20:19 2007 -0400
+++ b/cmd/wmii/event.c Sat Apr 21 18:46:17 2007 -0400
@@ -10,9 +10,13 @@
 
 void
 dispatch_event(XEvent *e) {
+ Client *c;
+
         Debug printevent(e);
         if(handler[e->type])
                 handler[e->type](e);
+ for(c = client; c; c = c->next)
+ XSetWindowBackgroundPixmap(display, c->framewin->w, broken->image);
 }
 
 uint
diff -r 7b787d87bd28 -r f2e8f05273db cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Sat Apr 21 17:20:19 2007 -0400
+++ b/cmd/wmii/frame.c Sat Apr 21 18:46:17 2007 -0400
@@ -180,7 +180,7 @@ static void
 static void
 expose_event(Window *w, XExposeEvent *e) {
         Client *c;
-
+
         c = w->aux;
         if(c->sel)
                 draw_frame(c->sel);
@@ -435,6 +435,7 @@ draw_frame(Frame *f) {
         drawstring(screen->ibuf, def.font, r, WEST,
                         f->client->name, col->fg);
 
+ XSetWindowBackgroundPixmap(display, f->client->framewin->w, None);
         copyimage(f->client->framewin, fr, screen->ibuf, ZP);
         XSync(display, False);
 }
diff -r 7b787d87bd28 -r f2e8f05273db cmd/wmii/main.c
--- a/cmd/wmii/main.c Sat Apr 21 17:20:19 2007 -0400
+++ b/cmd/wmii/main.c Sat Apr 21 18:46:17 2007 -0400
@@ -220,11 +220,15 @@ init_screen(WMScreen *screen) {
 
 static void
 cleanup() {
+ Point p;
         Client *c;
 
         for(c=client; c; c=c->next) {
- reparent_client(c, &scr.root, c->sel->r.min);
- if(c->sel->view != screen->sel)
+ p = ZP;
+ if(c->sel)
+ p = c->sel->r.min;
+ reparent_client(c, &scr.root, p);
+ if(c->sel && c->sel->view != screen->sel)
                         unmap_client(c, IconicState);
         }
         XSync(display, False);
@@ -382,10 +386,11 @@ check_9pcon(IxpConn *c) {
 
 int
 main(int argc, char *argv[]) {
- char *wmiirc;
+ char *wmiirc, *str;
         WMScreen *s;
         WinAttr wa;
         int i;
+ ulong col;
 
         wmiirc = "wmiistartrc";
 
@@ -477,6 +482,14 @@ main(int argc, char *argv[]) {
                 initbar(s);
         }
 
+ str = "This app is broken. Disable its transparency feature.";
+ i = textwidth(def.font, str) + labelh(def.font);
+ broken = allocimage(i, labelh(def.font), scr.depth);
+
+ namedcolor("#ff0000", &col);
+ fill(broken, broken->r, scr.black);
+ drawstring(broken, def.font, broken->r, EAST, str, col);
+
         screen->focus = nil;
         setfocus(screen->barwin, RevertToParent);
 
diff -r 7b787d87bd28 -r f2e8f05273db cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Sat Apr 21 17:20:19 2007 -0400
+++ b/cmd/wmii/x11.c Sat Apr 21 18:46:17 2007 -0400
@@ -297,7 +297,6 @@ static void
 static void
 setgccol(Image *dst, ulong col) {
         XSetForeground(display, dst->gc, col);
- XSetBackground(display, dst->gc, col);
 }
 
 /* Drawing */
Received on Fri Jun 01 2007 - 03:09:52 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:01 UTC