From c9273c98a43fd0596c087a217f2bff2e4c23e365 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 8 Jan 2010 18:06:56 +0100 Subject: [PATCH] Crazy focus model. --- openbox/event.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- 2.34.1