X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=inline;f=openbox%2Fevent.c;h=7c1231f22f2ef8b940ef6d87a6997b5c9c40145d;hb=f85c50bb4a7ea33e6e3733f3f58a35b62fd978ed;hp=93cdf0b220f3b89cd426e1bf276ce9ac13c90c1d;hpb=df436132bda79134e822fd56a896ed28cdc289e0;p=chaz%2Fopenbox diff --git a/openbox/event.c b/openbox/event.c index 93cdf0b2..7c1231f2 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) @@ -342,19 +344,29 @@ static void event_done(gpointer data) frame_adjust_focus(focus_in->frame, TRUE); client_calc_layer(focus_in); } + + focus_hilite = focus_in; } if (focus_out) { if (focus_out == focus_client) focus_set_client(NULL); frame_adjust_focus(focus_out->frame, FALSE); client_calc_layer(focus_out); - } - focus_hilite = focus_in; + if (!focus_in) + focus_hilite = NULL; + } 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 +475,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); } } } @@ -608,7 +618,9 @@ static void event_handle_client(ObClient *client, XEvent *e) e->xfocus.window, client->window, e->xfocus.mode, e->xfocus.detail); #endif - focus_out = client; + g_message("hilite %x client %x", focus_hilite, client); + if (focus_hilite == client) + focus_out = client; if (focus_in == client) focus_in = NULL; break; @@ -1199,6 +1211,11 @@ static void focus_delay_client_dest(ObClient *client, gpointer data) ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func, client); } +void event_halt_focus_delay() +{ + ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func); +} + void event_ignore_queued_enters() { GSList *saved = NULL, *it;