X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=inline;f=openbox%2Fevent.c;h=bb138d3dca77815f0766410e492776f7bf4be2fb;hb=90abec9c3017f05b14f85d85105df0c62622ad9a;hp=cd0163f27119a21cc09b26db568a4b5728ef30f8;hpb=8e34732b3a6d19c64addc6e7f8cdc7bbf6293f1f;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index cd0163f2..bb138d3d 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -321,6 +321,8 @@ static void event_client_dest(ObClient *client, gpointer data) focus_in = NULL; if (client == focus_out) focus_out = NULL; + if (client == focus_hilite) + focus_hilite = NULL; } static void event_done(gpointer data) @@ -353,8 +355,15 @@ static void event_done(gpointer data) focus_hilite = focus_in; if (focus_client != last) { - if (!focus_client) - focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); + if (!focus_client) { + Window w; + int r; + + /* is focus anywhere valid? */ + XGetInputFocus(ob_display, &w, &r); + if (!w || w == RootWindow(ob_display, ob_screen)) + focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); + } last = focus_client; } @@ -463,11 +472,9 @@ static void event_process(const XEvent *ec, gpointer data) e->type == MotionNotify) mouse_event(client, e); else if (e->type == KeyPress) - /* when in the middle of a focus cycling action, this - causes the window which appears to be focused to be - the one on which the actions will be executed */ - keyboard_event((focus_cycle_target ? - focus_cycle_target : client), e); + keyboard_event((focus_cycle_target ? focus_cycle_target : + (focus_hilite ? focus_hilite : client)), + e); } } }