changeset: 2085:78e01a1fbbbb
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Apr 16 20:30:23 2007 -0400
summary: Revert to grabbing AnyButton/AnyModifier on frame windows. Misc fixes.
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/area.c
--- a/cmd/wmii/area.c Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/area.c Mon Apr 16 20:30:23 2007 -0400
@@ -171,7 +171,6 @@ attach_to_area(Area *a, Frame *f, Bool s
if(!a->floating)
arrange_column(a, False);
- update_client_grab(f->client);
if(a->frame)
assert(a->sel);
}
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/client.c
--- a/cmd/wmii/client.c Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/client.c Mon Apr 16 20:30:23 2007 -0400
@@ -61,14 +61,16 @@ create_client(XWindow w, XWindowAttribut
| ButtonPressMask
| ButtonReleaseMask;
c->framewin = createwindow(&scr.root, c->rect, scr.depth, InputOutput, &fwa,
- CWOverrideRedirect
- | CWEventMask
- | CWBackPixmap
- | CWBackingStore);
+ CWOverrideRedirect
+ | CWEventMask
+ | CWBackPixmap
+ | CWBackingStore);
c->framewin->aux = c;
c->win.aux = c;
sethandler(c->framewin, &framehandler);
sethandler(&c->win, &handlers);
+
+ grab_button(c->framewin->w, AnyButton, AnyModifier);
for(t=&client ;; t=&(*t)->next)
if(!*t) {
@@ -235,7 +237,6 @@ focusin_event(Window *w, XFocusChangeEve
old = screen->focus;
screen->focus = c;
if(c != old) {
- update_client_grab(c);
if(c->sel)
draw_frame(c->sel);
if(old && old->sel)
@@ -260,7 +261,6 @@ focusout_event(Window *w, XFocusChangeEv
//print_focus(&c_magic, "<magic>");
screen->focus = &c_magic;
}
- update_client_grab(c);
if(c->sel)
draw_frame(c->sel);
}
@@ -283,6 +283,17 @@ map_event(Window *w, XMapEvent *e) {
c = w->aux;
if(c == selclient())
focus_client(c);
+}
+
+static void
+property_event(Window *w, XPropertyEvent *e) {
+ Client *c;
+
+ if(e->state == PropertyDelete)
+ return;
+
+ c = w->aux;
+ prop_client(c, e->atom);
}
static Handlers handlers = {
@@ -293,11 +304,12 @@ static Handlers handlers = {
.focusout = focusout_event,
.map = map_event,
.unmap = unmap_event,
+ .property = property_event,
};
Client *
selclient() {
- if(screen->sel && screen->sel->sel->sel)
+ if(screen->sel->sel->sel)
return screen->sel->sel->sel->client;
return nil;
}
@@ -310,70 +322,40 @@ win2client(XWindow w) {
return c;
}
-Frame *
-win2frame(XWindow w) {
- Client *c;
- for(c=client; c; c=c->next)
- if(c->framewin->w == w) break;
- if(c)
- return c->sel;
- return nil;
-}
-
static void
update_client_name(Client *c) {
XTextProperty name;
- XClassHint ch;
+ XClassHint ch = {0};
int n;
char **list = nil;
+ c->name[0] = 0;
+
name.nitems = 0;
- c->name[0] = 0;
XGetTextProperty(display, c->win.w, &name, atom[NetWMName]);
if(!name.nitems)
XGetWMName(display, c->win.w, &name);
if(!name.nitems)
return;
+
if(name.encoding == XA_STRING)
strncpy(c->name, (char *)name.value, sizeof(c->name));
- else {
- if(XmbTextPropertyToTextList(display, &name, &list, &n) >= Success
- && n > 0 && *list)
- {
+ else if(XmbTextPropertyToTextList(display, &name, &list, &n) >= Success)
+ if(n > 0 && *list) {
strncpy(c->name, *list, sizeof(c->name));
XFreeStringList(list);
}
- }
XFree(name.value);
- if(XGetClassHint(display, c->win.w, &ch)) {
- snprintf(c->props, sizeof(c->props),
- "%s:%s:%s",
- str_nil(ch.res_class),
- str_nil(ch.res_name),
- c->name);
- if(ch.res_class)
- XFree(ch.res_class);
- if(ch.res_name)
- XFree(ch.res_name);
- }
-}
-
-void
-update_client_grab(Client *c) {
- Frame *f;
- f = c->sel;
- if((f->client != selclient())
- || (f->area->floating && f != f->area->stack)) {
- if(verbose)
- fprintf(stderr, "update_client_grab(%p) AnyButton => %s\n", c, str_nil(c->name));
- grab_button(c->framewin->w, AnyButton, AnyModifier);
- }else {
- if(verbose)
- fprintf(stderr, "update_client_grab(%p) def.mod => %s\n", c, str_nil(c->name));
- XUngrabButton(display, AnyButton, AnyModifier, c->framewin->w);
- grab_button(c->framewin->w, Button1, def.mod);
- grab_button(c->framewin->w, Button3, def.mod);
- }
+
+ XGetClassHint(display, c->win.w, &ch);
+ snprintf(c->props, sizeof(c->props), "%s:%s:%s",
+ str_nil(ch.res_class),
+ str_nil(ch.res_name),
+ c->name);
+ if(ch.res_class)
+ XFree(ch.res_class);
+ if(ch.res_name)
+ XFree(ch.res_name);
}
void
@@ -737,10 +719,9 @@ focus_client(Client *c) {
if(c && verbose)
fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : "<nil>"),
(c ? c->name : "<nil>"));
- if(c) {
+ if(c)
XSetInputFocus(display, c->win.w, RevertToParent, CurrentTime);
- update_client_grab(c);
- }else
+ else
XSetInputFocus(display, screen->barwin->w, RevertToParent, CurrentTime);
}
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/column.c
--- a/cmd/wmii/column.c Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/column.c Mon Apr 16 20:30:23 2007 -0400
@@ -19,15 +19,6 @@ char *modes[] = {
[Colstack] = "stack",
[Colmax] = "max",
};
-
-Divide *
-win2div(XWindow w) {
- Divide *d;
-
- for(d = divs; d; d = d->next)
- if(d->w->w == w) return d;
- return nil;
-}
int
str2colmode(const char *str) {
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/event.c
--- a/cmd/wmii/event.c Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/event.c Mon Apr 16 20:30:23 2007 -0400
@@ -271,14 +271,12 @@ propertynotify(XEvent *e) {
propertynotify(XEvent *e) {
XPropertyEvent *ev;
Window *w;
- Client *c;
ev = &e->xproperty;
- w = findwin(e->xany.window);
- if(ev->state == PropertyDelete)
- return; /* ignore */
- if((c = win2client(ev->window)))
- prop_client(c, ev->atom);
+ if((w = findwin(e->xany.window))) {
+ if(w->handler->property)
+ w->handler->property(w, ev);
+ }
}
static void
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/fns.h Mon Apr 16 20:30:23 2007 -0400
@@ -48,14 +48,11 @@ void move_client(Client*, char *arg);
void move_client(Client*, char *arg);
void size_client(Client*, char *arg);
Client *selclient();
-Frame *win2frame(XWindow);
Client *win2client(XWindow);
-void update_client_grab(Client*);
void apply_rules(Client*);
void apply_tags(Client*, const char*);
/* column.c */
-Divide *win2div(XWindow);
void update_divs();
void draw_div(Divide*);
void arrange_column(Area*, Bool dirty);
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/frame.c Mon Apr 16 20:30:23 2007 -0400
@@ -178,7 +178,11 @@ expose_event(Window *w, XExposeEvent *e)
Client *c;
c = w->aux;
- draw_frame(c->sel);
+ if(c->sel)
+ draw_frame(c->sel);
+ else
+ fprintf(stderr, "Badness: Expose event on a client frame which shouldn't be visible: %x\n",
+ (uint)c->win.w);
}
static void
@@ -277,7 +281,6 @@ frame_to_top(Frame *f) {
f->snext = a->stack;
a->stack = f;
- update_client_grab(f->client);
return True;
}
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/fs.c Mon Apr 16 20:30:23 2007 -0400
@@ -248,8 +248,7 @@ parse_colors(char **buf, int *buflen, CT
}
char *
-message_root(char *message)
-{
+message_root(char *message) {
uint n;
if(!strchr(message, ' ')) {
@@ -302,7 +301,6 @@ message_root(char *message)
return Ebadvalue;
strncpy(def.grabmod, message, sizeof(def.grabmod));
def.mod = mod;
- restack_view(screen->sel);
}
else
return Ebadcmd;
diff -r 67ee8151232b -r 78e01a1fbbbb cmd/wmii/view.c
--- a/cmd/wmii/view.c Mon Apr 16 19:54:31 2007 -0400
+++ b/cmd/wmii/view.c Mon Apr 16 20:30:23 2007 -0400
@@ -131,10 +131,9 @@ focus_view(WMScreen *s, View *v) {
update_divs();
for(c=client; c; c=c->next)
if((f = c->sel)) {
- if(f->view == v) {
+ if(f->view == v)
resize_client(c, &f->rect);
- update_client_grab(c);
- } else {
+ else {
unmap_frame(c);
unmap_client(c, IconicState);
}
Received on Fri Jun 01 2007 - 03:09:15 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:55 UTC