commit d9cbac523a6de129c1df57a676248586c2e34038
parent 512e0d43bb1c925441e7f1f68e605c8dea6d5019
Author: Kris Maglione <jg@suckless.org>
Date: Mon, 2 Jun 2008 22:31:04 -0400
Fix mouse focus bugs.
Diffstat:
7 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c
@@ -227,8 +227,6 @@ client_manage(Client *c) {
frame_restack(c->sel, c->sel->area->sel);
view_restack(c->sel->view);
}
-
- ignoreenter = true;
}
static int /* Temporary Xlib error handler */
@@ -286,7 +284,6 @@ client_destroy(Client *c) {
group_remove(c);
event("DestroyClient %C\n", c);
- ignoreenter = true;
flushevents(FocusChangeMask, true);
free(c->w.hints);
free(c);
@@ -852,7 +849,7 @@ enter_event(Window *w, XCrossingEvent *e) {
c = w->aux;
if(e->detail != NotifyInferior) {
if(e->detail != NotifyVirtual)
- if(!ignoreenter && screen->focus != c) {
+ if(e->serial != ignoreenter && screen->focus != c) {
Dprint(DFocus, "enter_notify([%C]%s)\n", c, c->name);
focus(c, false);
}
diff --git a/cmd/wmii/dat.h b/cmd/wmii/dat.h
@@ -365,7 +365,7 @@ EXTERN XHandler handler[LASTEvent];
/* Misc */
EXTERN bool starting;
EXTERN bool resizing;
-EXTERN bool ignoreenter;
+EXTERN long ignoreenter;
EXTERN char* user;
EXTERN char* execstr;
EXTERN int debugflag;
diff --git a/cmd/wmii/event.c b/cmd/wmii/event.c
@@ -136,6 +136,7 @@ static void
configurenotify(XConfigureEvent *ev) {
Window *w;
+ ignoreenter = ev->serial;
if((w = findwin(ev->window)))
handle(w, config, ev);
}
@@ -306,8 +307,6 @@ static void
motionnotify(XMotionEvent *ev) {
Window *w;
- ignoreenter = false;
-
xtime = ev->time;
if((w = findwin(ev->window)))
handle(w, motion, ev);
diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h
@@ -200,7 +200,6 @@ void warning(const char*, ...);
void debug(int, const char*, ...);
void dprint(const char*, ...);
void dwrite(int, void*, int, bool);
-int getdebug(char*);
bool setdebug(int);
void vdebug(int, const char*, va_list);
diff --git a/cmd/wmii/frame.c b/cmd/wmii/frame.c
@@ -201,7 +201,6 @@ static void
config_event(Window *w, XConfigureEvent *e) {
USED(w, e);
- ignoreenter = true;
}
static void
@@ -212,9 +211,10 @@ enter_event(Window *w, XCrossingEvent *e) {
c = w->aux;
f = c->sel;
if(screen->focus != c || selclient() != c) {
- Dprint(DFocus, "enter_notify(f) => %s\n", f->client->name);
+ Dprint(DFocus, "enter_notify(f) => [%C]%s%s\n",
+ f->client, f->client->name, ignoreenter == e->serial ? " (ignored)" : "");
if(e->detail != NotifyInferior)
- if(!ignoreenter && (f->area->floating || !f->collapsed))
+ if(e->serial != ignoreenter && (f->area->floating || !f->collapsed))
focus(f->client, false);
}
mouse_checkresize(f, Pt(e->x, e->y), false);
diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c
@@ -342,8 +342,7 @@ extern int fmtevent(Fmt*);
check_other_wm = true;
selectinput(&scr.root, SubstructureRedirectMask
- | EnterWindowMask
- | PointerMotionMask);
+ | EnterWindowMask);
sync();
check_other_wm = false;
diff --git a/cmd/wmii/message.c b/cmd/wmii/message.c
@@ -136,11 +136,6 @@ getsym(char *s) {
return _bsearch(s, symtab, nelem(symtab));
}
-int
-getdebug(char *s) {
- return _bsearch(s, debugtab, nelem(debugtab));
-}
-
static bool
setdef(int *ptr, char *s, char *tab[], int ntab) {
int i;
@@ -289,11 +284,11 @@ getulong(const char *s, ulong *ret) {
}
static char*
-strend(const char *s, int n) {
+strend(char *s, int n) {
int len;
len = strlen(s);
- return (char*)(uintptr_t)s + max(0, len - n);
+ return s + max(0, len - n);
}
static Client*
@@ -599,7 +594,7 @@ msg_debug(IxpMsg *m) {
add = '+';
if(opt[0] == '+' || opt[0] == '-')
add = *opt++;
- d = getdebug(opt);
+ d = _bsearch(opt, debugtab, nelem(debugtab));
if(d == -1) {
bufprint(", %s", opt);
continue;