/*! 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;
ob_debug_type(OB_DEBUG_FOCUS, "using enter event with serial %lu "
"on client 0x%x", event_curserial, client->window);
- if (client_enter_focusable(client) && client_can_focus(client)) {
+ if (client_enter_focusable(client) && client_can_focus(client) && (!config_focus_delay || (!client_left_focused || event_time_after(client_left_focused, event_curtime - config_focus_delay /*milliseconds here, so not *1000 */)))) {
if (config_focus_delay) {
ObFocusDelayData *data;
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: