Fix mouse focus bugs.

This commit is contained in:
Kris Maglione 2008-06-02 22:31:04 -04:00
parent 512e0d43bb
commit d9cbac523a
7 changed files with 10 additions and 21 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -342,8 +342,7 @@ extern int fmtevent(Fmt*);
check_other_wm = true;
selectinput(&scr.root, SubstructureRedirectMask
| EnterWindowMask
| PointerMotionMask);
| EnterWindowMask);
sync();
check_other_wm = false;

View File

@ -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;