From: Mikael Magnusson Date: Fri, 8 Jan 2010 17:06:56 +0000 (+0100) Subject: Crazy focus model. X-Git-Tag: mikabox-3.5-7~37^2~4 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=c9273c98a43fd0596c087a217f2bff2e4c23e365;p=mikachu%2Fopenbox.git Crazy focus model. --- diff --git a/openbox/event.c b/openbox/event.c index 35bbbba2..4ab0a1c5 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -105,6 +105,8 @@ static Time event_curtime = CurrentTime; /*! The source time that started the current X event (user-provided, so not to be trusted) */ static Time event_sourcetime = CurrentTime; +/*! Last time the cursor moved out of the focused window */ +static Time client_left_focused = CurrentTime; /*! The serial of the current X event */ static gulong event_curserial; @@ -811,7 +813,7 @@ void event_enter_client(ObClient *client) return; } - if (client_enter_focusable(client) && client_can_focus(client)) { + if (client_enter_focusable(client) && client_can_focus(client) && (!config_focus_delay || event_time_after(client_left_focused, event_curtime - config_focus_delay /*milliseconds here, so not *1000 */))) { if (config_focus_delay) { ObFocusDelayData *data; @@ -1079,6 +1081,8 @@ static void event_handle_client(ObClient *client, XEvent *e) g_source_remove(focus_delay_timeout_id); if (config_unfocus_leave) event_leave_client(client); + else if (client == focus_client) + client_left_focused = e->xcrossing.time; } break; default: