summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-03-21 15:54:30 +0000
committerDana Jansens <danakj@orodu.net>2007-03-21 15:54:30 +0000
commitfd382fcc36552614176c929c1a1a687fb52c0da0 (patch)
tree92d8e8d9aaba24fa7c1bebc39374030c089ff0c1 /openbox
parente227ac841e1fc7423c90fbd2c13ba379461a39c1 (diff)
allow focus to disappear to black holes. (that is, windows not managed by openbox). the black hole may just be a window on another monitor. keyboard events aren't going to work in this scenario, though.
Diffstat (limited to 'openbox')
-rw-r--r--openbox/event.c23
-rw-r--r--openbox/screen.c2
2 files changed, 19 insertions, 6 deletions
diff --git a/openbox/event.c b/openbox/event.c
index effa166a..2ce29d5c 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -333,6 +333,11 @@ static gboolean wanted_focusevent(XEvent *e)
if (detail == NotifyNonlinearVirtual)
return TRUE;
+ /* This means focus reverted off of a client */
+ if (detail == NotifyPointerRoot || detail == NotifyDetailNone ||
+ detail == NotifyInferior)
+ return TRUE;
+
/* Otherwise.. */
return FALSE;
} else {
@@ -657,17 +662,25 @@ static void event_handle_client(ObClient *client, XEvent *e)
/* Look for the followup FocusIn */
if (!XCheckIfEvent(ob_display, &ce, look_for_focusin, NULL)) {
/* There is no FocusIn, this means focus went to a window that
- is not being managed. most likely, this went to PointerRoot
- or None, meaning the window is no longer around so fallback
- focus, but not to that window */
+ is not being managed, or a window on another screen. */
ob_debug("Focus went to a black hole !\n");
- focus_fallback(FALSE);
} else if (ce.xany.window == e->xany.window) {
/* If focus didn't actually move anywhere, there is nothing to do*/
break;
+ } else if (ce.xfocus.detail == NotifyPointerRoot ||
+ ce.xfocus.detail == NotifyDetailNone) {
+ ob_debug("Focus went to root\n");
+ /* Focus has been reverted to the root window or nothing, so fall
+ back to something other than the window which just had it. */
+ focus_fallback(FALSE);
+ } else if (ce.xfocus.detail == NotifyInferior) {
+ ob_debug("Focus went to parent\n");
+ /* Focus has been reverted to parent, which is our frame window,
+ so fall back to something other than the window which had it. */
+ focus_fallback(FALSE);
} else {
/* Focus did move, so process the FocusIn event */
- ObEventData ed;
+ ObEventData ed = { .ignored = FALSE };
event_process(&ce, &ed);
if (ed.ignored) {
/* The FocusIn was ignored, this means it was on a window
diff --git a/openbox/screen.c b/openbox/screen.c
index 8f1f9396..cf94462c 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -45,7 +45,7 @@
/*! The event mask to grab on the root window */
#define ROOT_EVENTMASK (StructureNotifyMask | PropertyChangeMask | \
EnterWindowMask | LeaveWindowMask | \
- SubstructureRedirectMask | \
+ SubstructureRedirectMask | FocusChangeMask | \
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
guint screen_num_desktops;