-static void event_client_dest(ObClient *client, gpointer data)
-{
- if (client == focus_in)
- focus_in = NULL;
- if (client == focus_out)
- focus_out = NULL;
- if (client == focus_hilite)
- focus_hilite = NULL;
-}
-
-static void event_done(gpointer data)
-{
- static ObClient *last = NULL;
-
- /* sometimes focus_hilite can be on an unfocused window, this make sure
- it loses its focus hilite when focus moves */
- if (focus_hilite &&
- (focus_in && focus_hilite != focus_in) &&
- (focus_out && focus_hilite != focus_out))
- {
- frame_adjust_focus(focus_hilite->frame, FALSE);
- }
-
- if (focus_in) {
- if (focus_in != focus_client) {
- focus_set_client(focus_in);
- 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);
-
- if (!focus_in)
- focus_hilite = NULL;
- }
-
- if (focus_client != last) {
- if (!focus_client) {
- Window w;
- gint r;
-
- /* is focus anywhere valid? */
- XGetInputFocus(ob_display, &w, &r);
-
-#ifdef DEBUG_FOCUS
- ob_debug("Focus was found on 0x%x revert %d\n", w, r);
-#endif
-
- if (!w || w == PointerRoot)
- focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
- }
- last = focus_client;
- }
-
- focus_in = focus_out = NULL;
-}
-