Fix annoyance with window placement. Cleanup.

This commit is contained in:
Kris Maglione 2007-06-26 20:26:04 -04:00
parent 449df09d6b
commit 7a91559743
5 changed files with 28 additions and 7 deletions

View File

@ -321,7 +321,7 @@ place_frame(Frame *f) {
if(c->trans) if(c->trans)
return; return;
if(c->fullscreen || c->w.hints->position || starting) { if(c->fullscreen || c->w.hints->position || starting) {
f->r = gravclient(c, c->w.r); f->r = gravclient(c, c->r);
return; return;
} }
if(!field) { if(!field) {

View File

@ -92,7 +92,9 @@ manage_client(Client *c) {
Client *trans; Client *trans;
char *tags; 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))) if((trans = win2client(c->trans)))
strncpy(c->tags, trans->tags, sizeof(c->tags)); strncpy(c->tags, trans->tags, sizeof(c->tags));
@ -119,7 +121,7 @@ manage_client(Client *c) {
flushevents(EnterWindowMask, False); flushevents(EnterWindowMask, False);
} }
static int static int /* Temporary Xlib error handler */
ignoreerrors(Display *d, XErrorEvent *e) { ignoreerrors(Display *d, XErrorEvent *e) {
return 0; return 0;
} }
@ -268,7 +270,8 @@ frame_hints(Frame *f, Rectangle r, Align sticky) {
static void static void
set_client_state(Client * c, int state) { set_client_state(Client * c, int state) {
long data[] = { state, None }; 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 void
@ -913,7 +916,7 @@ apply_tags(Client *c, const char *tags) {
update_client_views(c, toks); 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 void

View File

@ -217,6 +217,9 @@ ulong getproperty(Window *w, char *prop, char *type, Atom *actual, ulong offset,
char *gettextproperty(Window*, char*); char *gettextproperty(Window*, char*);
int gettextlistproperty(Window *w, char *name, char **ret[]); int gettextlistproperty(Window *w, char *name, char **ret[]);
void changeproperty(Window*, char *prop, char *type, int width, uchar *data, int n); 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); void setfocus(Window*, int mode);
Point querypointer(Window*); Point querypointer(Window*);
void warppointer(Point); void warppointer(Point);

View File

@ -147,7 +147,7 @@ static void
init_atoms(void) { init_atoms(void) {
Atom net[] = { xatom("_NET_SUPPORTED"), xatom("_NET_WM_NAME") }; 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 static void

View File

@ -546,10 +546,25 @@ xatom(char *name) {
} }
void 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); 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 void
freestringlist(char *list[]) { freestringlist(char *list[]) {
XFreeStringList(list); XFreeStringList(list);