Set ignoreenter indiscriminantly. Closes issue #196.

This commit is contained in:
Kris Maglione 2010-06-24 10:39:42 -04:00
parent 8177ac58d7
commit 5a6c5c1b4d
13 changed files with 25 additions and 24 deletions

View File

@ -1,13 +1,13 @@
pkgname=wmii-hg
pkgver=2739
pkgver=2740
pkgrel=1
pkgdesc="The latest hg pull of wmii, a lightweight, dynamic window manager for X11"
url="http://wmii.suckless.org"
license=(MIT)
arch=(i686 x86_64)
depends=(libx11 libxinerama libxrandr)
makedepends=(mercurial libixp-hg)
makedepends=(mercurial "libixp-hg>="$(sed -rn <mk/wmii.mk 's/.*IXP_NEEDAPI=([0-9]+).*/\1/p'))
optdepends=("plan9port: for use of the alternative plan9port wmiirc" \
"python: for use of the alternative Python wmiirc" \
"ruby-rumai: for use of the alternative Ruby wmiirc" \

View File

@ -489,6 +489,7 @@ focus(Client *c, bool user) {
View *v;
Frame *f;
Dprint(DFocus, "focus(%#C, %d)\n", c, user);
if(!c->nofocus || user)
if((f = c->sel)) {
v = f->view;
@ -892,7 +893,7 @@ enter_event(Window *w, void *aux, XCrossingEvent *e) {
c = aux;
if(e->detail != NotifyInferior) {
if(e->detail != NotifyVirtual)
if(e->serial != ignoreenter && disp.focus != c) {
if(e->serial > event_lastconfigure && disp.focus != c) {
Dprint(DFocus, "enter_notify([%#C]%s)\n", c, c->name);
focus(c, false);
}
@ -983,18 +984,6 @@ static Handlers handlers = {
.property = property_event,
};
static bool
ignoreenter_event(Window *w, void *aux, XAnyEvent *e) {
ignoreenter = e->serial;
return true;
}
static Handlers ignorehandlers = {
.map = (bool(*)(Window*, void*, XMapEvent*))ignoreenter_event,
.unmap = (bool(*)(Window*, void*, XUnmapEvent*))ignoreenter_event,
.config = (bool(*)(Window*, void*, XConfigureEvent*))ignoreenter_event,
};
/* Other */
void
client_setviews(Client *c, char **tags) {

View File

@ -205,11 +205,12 @@ enter_event(Window *w, void *aux, XCrossingEvent *e) {
c = aux;
f = c->sel;
if(disp.focus != c || selclient() != c) {
Dprint(DFocus, "%E\n", e);
Dprint(DFocus, "enter_notify(f) => [%#C]%s%s\n",
f->client, f->client->name,
ignoreenter == e->serial ? " (ignored)" : "");
e->serial <= event_lastconfigure ? " (ignored)" : "");
if(e->detail != NotifyInferior)
if(e->serial != ignoreenter && !f->collapsed)
if(e->serial > event_lastconfigure && !f->collapsed)
focus(f->client, false);
}
mouse_checkresize(f, Pt(e->x, e->y), false);
@ -225,9 +226,6 @@ expose_event(Window *w, void *aux, XExposeEvent *e) {
c = aux;
if(c->sel)
frame_draw(c->sel);
else
fprint(2, "Badness: Expose event on a client frame which shouldn't be visible: %#C\n",
c);
return false;
}

View File

@ -121,6 +121,7 @@ unflush(int fd, char *in, int len, bool binary) {
else
out += res;
} while(n > 0);
if(in < start + len) {
nextra = min(sizeof extra, len - (in - start));
memcpy(extra, in, nextra);

View File

@ -42,7 +42,7 @@ void event_fdclosed(IxpConn*);
void event_fdready(IxpConn*);
void event_preselect(IxpServer*);
#endif
void event_updatextime(void);
long event_updatextime(void);
void event_buttonpress(XButtonPressedEvent*);
void event_buttonrelease(XButtonPressedEvent*);
@ -68,6 +68,7 @@ void event_selectionclear(XSelectionClearEvent*);
void event_selectionrequest(XSelectionRequestEvent*);
void event_unmapnotify(XUnmapEvent*);
extern long event_lastconfigure;
extern long event_xtime;
extern bool event_looprunning;
extern void (*event_debug)(XEvent*);

View File

@ -7,6 +7,8 @@ void
event_configurenotify(XConfigureEvent *ev) {
Window *w;
if(!ev->send_event)
event_lastconfigure = ev->serial;
if((w = findwin(ev->window)))
event_handle(w, config, ev);
}

View File

@ -7,6 +7,8 @@ void
event_destroynotify(XDestroyWindowEvent *ev) {
Window *w;
if(!ev->send_event)
event_lastconfigure = ev->serial;
if((w = findwin(ev->window)))
event_handle(w, destroy, ev);
}

View File

@ -5,6 +5,7 @@
typedef bool (*Handler)(Window*, void*, XEvent*);
void (*event_debug)(XEvent*);
long event_lastconfigure;
long event_xtime;
bool event_looprunning;

View File

@ -7,6 +7,8 @@ void
event_mapnotify(XMapEvent *ev) {
Window *w;
if(!ev->send_event)
event_lastconfigure = ev->serial;
if((w = findwin(ev->event)))
event_handle(w, map, ev);
if(ev->send_event && (w = findwin(ev->event)))

View File

@ -7,6 +7,8 @@ void
event_reparentnotify(XReparentEvent *ev) {
Window *target, *w;
if(!ev->send_event)
event_lastconfigure = ev->serial;
w = nil;
if((target = findwin(ev->window)) && (w = findwin(ev->parent)))
target->parent = w;

View File

@ -7,6 +7,8 @@ void
event_unmapnotify(XUnmapEvent *ev) {
Window *w;
if(!ev->send_event)
event_lastconfigure = ev->serial;
if((w = findwin(ev->window))) {
if(!ev->send_event)
w->mapped = false;

View File

@ -15,7 +15,7 @@ findtime(Display *d, XEvent *e, XPointer v) {
return false;
}
void
long
event_updatextime(void) {
Window *w;
WinAttr wa;
@ -29,5 +29,6 @@ event_updatextime(void) {
XIfEvent(display, &e, findtime, (void*)w);
destroywindow(w);
return event_xtime;
}