X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fevent.c;h=bb138d3dca77815f0766410e492776f7bf4be2fb;hb=420e6f87a6503b713e4d9047f809538ec0c60d41;hp=45434f252d65ec3bb76a6a1a6bd3208d0a4c1221;hpb=0ba8c17565a7d3bb7f376ba5d072e0b70e96dec1;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 45434f25..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,8 +472,9 @@ static void event_process(const XEvent *ec, gpointer data) e->type == MotionNotify) mouse_event(client, e); else if (e->type == KeyPress) - keyboard_event((focus_hilite ? - focus_hilite : client), e); + keyboard_event((focus_cycle_target ? focus_cycle_target : + (focus_hilite ? focus_hilite : client)), + e); } } }