[hackers] [wmii] Fix annoyance with window placement. Cleanup.

From: Kris Maglione <jg_AT_suckless.org>
Date: Wed Jun 27 02:27:43 2007

changeset: 2168:fba62db5fae7
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Jun 26 20:26:04 2007 -0400
summary: Fix annoyance with window placement. Cleanup.

diff -r 348ce251ee3f -r fba62db5fae7 cmd/wmii/area.c
--- a/cmd/wmii/area.c Tue Jun 26 19:41:59 2007 -0400
+++ b/cmd/wmii/area.c Tue Jun 26 20:26:04 2007 -0400
@@ -321,7 +321,7 @@ place_frame(Frame *f) {
         if(c->trans)
                 return;
         if(c->fullscreen || c->w.hints->position || starting) {
- f->r = gravclient(c, c->w.r);
+ f->r = gravclient(c, c->r);
                 return;
         }
         if(!field) {
diff -r 348ce251ee3f -r fba62db5fae7 cmd/wmii/client.c
--- a/cmd/wmii/client.c Tue Jun 26 19:41:59 2007 -0400
+++ b/cmd/wmii/client.c Tue Jun 26 20:26:04 2007 -0400
@@ -92,7 +92,9 @@ manage_client(Client *c) {
         Client *trans;
         char *tags;
 
- tags = gettextproperty(&c->w, "_WIN_TAGS");
+ tags = gettextproperty(&c->w, "_WMII_TAGS");
+ if(tags == nil)
+ tags = gettextproperty(&c->w, "_WIN_TAGS");
 
         if((trans = win2client(c->trans)))
                 strncpy(c->tags, trans->tags, sizeof(c->tags));
@@ -119,7 +121,7 @@ manage_client(Client *c) {
         flushevents(EnterWindowMask, False);
 }
 
-static int
+static int /* Temporary Xlib error handler */
 ignoreerrors(Display *d, XErrorEvent *e) {
         return 0;
 }
@@ -268,7 +270,8 @@ static void
 static void
 set_client_state(Client * c, int state) {
         long data[] = { state, None };
- changeprop(&c->w, "WM_STATE", "WM_STATE", data, nelem(data));
+
+ changeprop_long(&c->w, "WM_STATE", "WM_STATE", data, nelem(data));
 }
 
 void
@@ -913,7 +916,7 @@ apply_tags(Client *c, const char *tags)
 
         update_client_views(c, toks);
 
- changeprop(&c->w, "_WIN_TAGS", "UTF8_STRING", c->tags, strlen(c->tags));
+ changeprop_char(&c->w, "_WMII_TAGS", "UTF8_STRING", c->tags, strlen(c->tags));
 }
 
 void
diff -r 348ce251ee3f -r fba62db5fae7 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Tue Jun 26 19:41:59 2007 -0400
+++ b/cmd/wmii/fns.h Tue Jun 26 20:26:04 2007 -0400
@@ -217,6 +217,9 @@ char *gettextproperty(Window*, char*);
 char *gettextproperty(Window*, char*);
 int gettextlistproperty(Window *w, char *name, char **ret[]);
 void changeproperty(Window*, char *prop, char *type, int width, uchar *data, int n);
+void changeprop_char(Window *w, char *prop, char *type, char data[], int len);
+void changeprop_short(Window *w, char *prop, char *type, short data[], int len);
+void changeprop_long(Window *w, char *prop, char *type, long data[], int len);
 void setfocus(Window*, int mode);
 Point querypointer(Window*);
 void warppointer(Point);
diff -r 348ce251ee3f -r fba62db5fae7 cmd/wmii/main.c
--- a/cmd/wmii/main.c Tue Jun 26 19:41:59 2007 -0400
+++ b/cmd/wmii/main.c Tue Jun 26 20:26:04 2007 -0400
@@ -147,7 +147,7 @@ init_atoms(void) {
 init_atoms(void) {
         Atom net[] = { xatom("_NET_SUPPORTED"), xatom("_NET_WM_NAME") };
 
- changeprop(&scr.root, "_NET_SUPPORTED", "ATOM", net, nelem(net));
+ changeprop_long(&scr.root, "_NET_SUPPORTED", "ATOM", net, nelem(net));
 }
 
 static void
diff -r 348ce251ee3f -r fba62db5fae7 cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Tue Jun 26 19:41:59 2007 -0400
+++ b/cmd/wmii/x11.c Tue Jun 26 20:26:04 2007 -0400
@@ -546,8 +546,23 @@ xatom(char *name) {
 }
 
 void
-changeproperty(Window *w, char *prop, char *type, int width, uchar *data, int n) {
+changeproperty(Window *w, char *prop, char *type, int width, uchar data[], int n) {
         XChangeProperty(display, w->w, xatom(prop), xatom(type), width, PropModeReplace, data, n);
+}
+
+void
+changeprop_char(Window *w, char *prop, char *type, char data[], int len) {
+ changeproperty(w, prop, type, 8, (uchar*)data, len);
+}
+
+void
+changeprop_short(Window *w, char *prop, char *type, short data[], int len) {
+ changeproperty(w, prop, type, 16, (uchar*)data, len);
+}
+
+void
+changeprop_long(Window *w, char *prop, char *type, long data[], int len) {
+ changeproperty(w, prop, type, 32, (uchar*)data, len);
 }
 
 void
Received on Wed Jun 27 2007 - 02:27:43 UTC

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