changeset: 1986:60312c132bea
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Mar 03 01:36:03 2007 -0500
summary: Process any queued focus events before deciding whether to set focus. This fixes several focus bugs.
diff -r b8fe0f1230f3 -r 60312c132bea client.c
--- a/client.c Fri Mar 02 23:40:24 2007 -0500
+++ b/client.c Sat Mar 03 01:36:03 2007 -0500
@@ -155,7 +155,7 @@ manage_client(Client *c) {
update_views();
XSync(blz.dpy, False);
- if(c->sel->area->view == screen->sel)
+ if(c->sel->view == screen->sel)
focus(c, True);
flush_masked_events(EnterWindowMask);
}
@@ -595,6 +595,12 @@ apply_sizehints(Client *c, XRectangle *r
void
focus_client(Client *c) {
+ XEvent ev;
+
+ while(XCheckMaskEvent(blz.dpy, FocusChangeMask, &ev))
+ if(handler[ev.xany.type])
+ handler[ev.xany.type](&ev);
+
if(verbose)
fprintf(stderr, "focus_client(%p) => %s\n", c, (c ? c->name : nil));
if(screen->focus != c) {
diff -r b8fe0f1230f3 -r 60312c132bea event.c
--- a/event.c Fri Mar 02 23:40:24 2007 -0500
+++ b/event.c Sat Mar 03 01:36:03 2007 -0500
@@ -115,13 +115,14 @@ configurerequest(XEvent *e) {
if(ev->value_mask & CWBorderWidth)
c->border = ev->border_width;
gravitate_client(c, False);
-
+
if((c->rect.height == screen->rect.height)
&&(c->rect.width == screen->rect.width)) {
c->fullscreen = True;
if(c->sel) {
if(!c->sel->area->floating)
send_to_area(c->sel->view->area, c->sel);
+ focus_client(c);
restack_view(c->sel->view);
}
}
@@ -172,13 +173,19 @@ enternotify(XEvent *e) {
if(ev->mode != NotifyNormal)
return;
+
if((c = client_of_win(ev->window))) {
if(ev->detail != NotifyInferior) {
+ if(verbose)
+ fprintf(stderr, "enter_notify(c) => %s\n", c->name);
focus(c, False);
set_cursor(c, cursor[CurNormal]);
- }
+ }else if(verbose)
+ fprintf(stderr, "enter_notify(c[NotifyInferior]) => %s\n", c->name);
}
else if((f = frame_of_win(ev->window))) {
+ if(verbose)
+ fprintf(stderr, "enter_notify(f) => %s\n", f->client->name);
if(f->area->floating || !f->collapsed)
focus(f->client, False);
set_frame_cursor(f, ev->x, ev->y);
@@ -404,7 +411,7 @@ check_x_event(IXPConn *c) {
XEvent ev;
while(XPending(blz.dpy)) {
XNextEvent(blz.dpy, &ev);
- if(verbose)
+ if(verbose & 0)
printevent(&ev);
if(handler[ev.type])
handler[ev.type](&ev);
Received on Sat Mar 03 2007 - 07:38:33 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:06 UTC