[hackers] [wmii] Fix mouse focus bugs. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Sat, 30 Aug 2008 21:49:26 +0000 (UTC)

changeset: 2342:748ffb2ab9bf
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Jun 02 22:31:04 2008 -0400
files: cmd/wmii/client.c cmd/wmii/dat.h cmd/wmii/event.c cmd/wmii/fns.h cmd/wmii/frame.c cmd/wmii/main.c cmd/wmii/message.c
description:
Fix mouse focus bugs.

diff -r b1f98dc5ca55 -r 748ffb2ab9bf cmd/wmii/client.c
--- a/cmd/wmii/client.c Mon Jun 02 11:58:27 2008 -0400
+++ b/cmd/wmii/client.c Mon Jun 02 22:31:04 2008 -0400
@@ -227,8 +227,6 @@
                 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 @@
         group_remove(c);
         event("DestroyClient %C\n", c);
 
- ignoreenter = true;
         flushevents(FocusChangeMask, true);
         free(c->w.hints);
         free(c);
@@ -852,7 +849,7 @@
         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 -r b1f98dc5ca55 -r 748ffb2ab9bf cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Mon Jun 02 11:58:27 2008 -0400
+++ b/cmd/wmii/dat.h Mon Jun 02 22:31:04 2008 -0400
@@ -365,7 +365,7 @@
 /* Misc */
 EXTERN bool starting;
 EXTERN bool resizing;
-EXTERN bool ignoreenter;
+EXTERN long ignoreenter;
 EXTERN char* user;
 EXTERN char* execstr;
 EXTERN int debugflag;
diff -r b1f98dc5ca55 -r 748ffb2ab9bf cmd/wmii/event.c
--- a/cmd/wmii/event.c Mon Jun 02 11:58:27 2008 -0400
+++ b/cmd/wmii/event.c Mon Jun 02 22:31:04 2008 -0400
@@ -136,6 +136,7 @@
 configurenotify(XConfigureEvent *ev) {
         Window *w;
 
+ ignoreenter = ev->serial;
         if((w = findwin(ev->window)))
                 handle(w, config, ev);
 }
@@ -306,8 +307,6 @@
 motionnotify(XMotionEvent *ev) {
         Window *w;
 
- ignoreenter = false;
-
         xtime = ev->time;
         if((w = findwin(ev->window)))
                 handle(w, motion, ev);
diff -r b1f98dc5ca55 -r 748ffb2ab9bf cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Mon Jun 02 11:58:27 2008 -0400
+++ b/cmd/wmii/fns.h Mon Jun 02 22:31:04 2008 -0400
@@ -200,7 +200,6 @@
 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 -r b1f98dc5ca55 -r 748ffb2ab9bf cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Mon Jun 02 11:58:27 2008 -0400
+++ b/cmd/wmii/frame.c Mon Jun 02 22:31:04 2008 -0400
@@ -201,7 +201,6 @@
 config_event(Window *w, XConfigureEvent *e) {
 
         USED(w, e);
- ignoreenter = true;
 }
 
 static void
@@ -212,9 +211,10 @@
         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 -r b1f98dc5ca55 -r 748ffb2ab9bf cmd/wmii/main.c
--- a/cmd/wmii/main.c Mon Jun 02 11:58:27 2008 -0400
+++ b/cmd/wmii/main.c Mon Jun 02 22:31:04 2008 -0400
@@ -342,8 +342,7 @@
 
         check_other_wm = true;
         selectinput(&scr.root, SubstructureRedirectMask
- | EnterWindowMask
- | PointerMotionMask);
+ | EnterWindowMask);
         sync();
 
         check_other_wm = false;
diff -r b1f98dc5ca55 -r 748ffb2ab9bf cmd/wmii/message.c
--- a/cmd/wmii/message.c Mon Jun 02 11:58:27 2008 -0400
+++ b/cmd/wmii/message.c Mon Jun 02 22:31:04 2008 -0400
@@ -134,11 +134,6 @@
 static int
 getsym(char *s) {
         return _bsearch(s, symtab, nelem(symtab));
-}
-
-int
-getdebug(char *s) {
- return _bsearch(s, debugtab, nelem(debugtab));
 }
 
 static bool
@@ -289,11 +284,11 @@
 }
 
 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 @@
                 add = '+';
                 if(opt[0] == '+' || opt[0] == '-')
                         add = *opt++;
- d = getdebug(opt);
+ d = _bsearch(opt, debugtab, nelem(debugtab));
                 if(d == -1) {
                         bufprint(", %s", opt);
                         continue;
Received on Sat Aug 30 2008 - 21:49:26 UTC

This archive was generated by hypermail 2.2.0 : Sat Aug 30 2008 - 22:00:08 UTC