wmii

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

commit 7a91559743014e06eacd153f2093293eea1355a3
parent 449df09d6bd4732f5273192d4e686781234ec6a9
Author: Kris Maglione <jg@suckless.org>
Date:   Tue, 26 Jun 2007 20:26:04 -0400

Fix annoyance with window placement. Cleanup.

Diffstat:
cmd/wmii/area.c | 2+-
cmd/wmii/client.c | 11+++++++----
cmd/wmii/fns.h | 3+++
cmd/wmii/main.c | 2+-
cmd/wmii/x11.c | 17++++++++++++++++-
5 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/cmd/wmii/area.c b/cmd/wmii/area.c @@ -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 --git a/cmd/wmii/client.c b/cmd/wmii/client.c @@ -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 @@ frame_hints(Frame *f, Rectangle r, Align sticky) { 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 --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h @@ -217,6 +217,9 @@ ulong getproperty(Window *w, char *prop, char *type, Atom *actual, ulong offset, 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 --git a/cmd/wmii/main.c b/cmd/wmii/main.c @@ -147,7 +147,7 @@ static 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 --git a/cmd/wmii/x11.c b/cmd/wmii/x11.c @@ -546,11 +546,26 @@ 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 freestringlist(char *list[]) { XFreeStringList(list); }