X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus.c;h=f88ad26f3277b29e389ef034086ae3977a521f1b;hb=141c249b8cd3b94a722acc8c0225b3cbf83e5042;hp=7a686800de9ea81d5ac01f5004107d4c49b47f22;hpb=bfb800c032e1dd50f5d1c37d1ce8ac9239947b01;p=chaz%2Fopenbox diff --git a/openbox/focus.c b/openbox/focus.c index 7a686800..f88ad26f 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -219,8 +219,11 @@ ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old) #endif ob_debug_type(OB_DEBUG_FOCUS, "trying omnipresentness\n"); - if (allow_refocus && old && old->desktop == DESKTOP_ALL) + if (allow_refocus && old && old->desktop == DESKTOP_ALL && + client_normal(old)) + { return old; + } ob_debug_type(OB_DEBUG_FOCUS, "trying the focus order\n"); @@ -239,13 +242,15 @@ ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old) a splashscreen or a desktop window (save the desktop as a backup fallback though) */ - if (client_can_focus(c) && c->desktop == screen_desktop && - !c->iconic) + if (client_can_focus(c) && !c->iconic) { - if (client_normal(c)) { + if (c->desktop == screen_desktop && client_normal(c)) { ob_debug_type(OB_DEBUG_FOCUS, "found in focus order\n"); return it->data; - } else if (c->type == OB_CLIENT_TYPE_DESKTOP && !desktop) + } else if ((c->desktop == screen_desktop || + c->desktop == DESKTOP_ALL) && + c->type == OB_CLIENT_TYPE_DESKTOP && + desktop == NULL) desktop = c; } } @@ -253,16 +258,14 @@ ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old) /* as a last resort fallback to the desktop window if there is one. (if there's more than one, then the one most recently focused.) */ + ob_debug_type(OB_DEBUG_FOCUS, "found desktop: \n", !!desktop); return desktop; } void focus_fallback(gboolean allow_refocus) { ObClient *new; - ObClient *old; - - /* save this before moving focus away to nothing */ - old = focus_client; + ObClient *old = focus_client; /* unfocus any focused clients.. they can be focused by Pointer events and such, and then when I try focus them, I won't get a FocusIn event @@ -282,6 +285,8 @@ void focus_nothing() screen_install_colormap(NULL, TRUE); } + focus_client = NULL; + /* when nothing will be focused, send focus to the backup target */ XSetInputFocus(ob_display, screen_support_win, RevertToPointerRoot, event_curtime); @@ -329,16 +334,13 @@ static void popup_cycle(ObClient *c, gboolean show) void focus_cycle_draw_indicator() { if (!focus_cycle_target) { - XEvent e; - XUnmapWindow(ob_display, focus_indicator.top.win); XUnmapWindow(ob_display, focus_indicator.left.win); XUnmapWindow(ob_display, focus_indicator.right.win); XUnmapWindow(ob_display, focus_indicator.bottom.win); /* kill enter events cause by this unmapping */ - XSync(ob_display, FALSE); - while (XCheckTypedEvent(ob_display, EnterNotify, &e)); + event_ignore_queued_enters(); } else { /* if (focus_cycle_target)