mirror of
https://github.com/brl/mutter.git
synced 2025-02-18 06:04:10 +00:00
Use correct timestamp for focus stealing prevention
When window initially maps, use the more recent of NET_WM_USER_TIME and startup notification timestamps to compare against last known user action to decide whether to focus the window or not. Once we show the window, clear the initial_timestamp_set flag, so the startup notification timestamp is not taken into account again. Based on patch for metacity by Alexander Larsson http://bugzilla.gnome.org/show_bug.cgi?id=573922
This commit is contained in:
parent
bca3eaf709
commit
ae32ac86b4
@ -2042,13 +2042,22 @@ intervening_user_event_occurred (MetaWindow *window)
|
|||||||
/* To determine the "launch" time of an application,
|
/* To determine the "launch" time of an application,
|
||||||
* startup-notification can set the TIMESTAMP and the
|
* startup-notification can set the TIMESTAMP and the
|
||||||
* application (usually via its toolkit such as gtk or qt) can
|
* application (usually via its toolkit such as gtk or qt) can
|
||||||
* set the _NET_WM_USER_TIME. If both are set, then it means
|
* set the _NET_WM_USER_TIME. If both are set, we need to be
|
||||||
* the user has interacted with the application since it
|
* using the newer of the two values.
|
||||||
* launched, and _NET_WM_USER_TIME is the value that should be
|
*
|
||||||
* used in the comparison.
|
* See http://bugzilla.gnome.org/show_bug.cgi?id=573922
|
||||||
*/
|
*/
|
||||||
compare = window->initial_timestamp_set ? window->initial_timestamp : 0;
|
compare = 0;
|
||||||
compare = window->net_wm_user_time_set ? window->net_wm_user_time : compare;
|
if (window->net_wm_user_time_set &&
|
||||||
|
window->initial_timestamp_set)
|
||||||
|
compare =
|
||||||
|
XSERVER_TIME_IS_BEFORE (window->net_wm_user_time,
|
||||||
|
window->initial_timestamp) ?
|
||||||
|
window->initial_timestamp : window->net_wm_user_time;
|
||||||
|
else if (window->net_wm_user_time_set)
|
||||||
|
compare = window->net_wm_user_time;
|
||||||
|
else if (window->initial_timestamp_set)
|
||||||
|
compare = window->initial_timestamp;
|
||||||
|
|
||||||
if ((focus_window != NULL) &&
|
if ((focus_window != NULL) &&
|
||||||
XSERVER_TIME_IS_BEFORE (compare, focus_window->net_wm_user_time))
|
XSERVER_TIME_IS_BEFORE (compare, focus_window->net_wm_user_time))
|
||||||
@ -2584,6 +2593,15 @@ meta_window_show (MetaWindow *window)
|
|||||||
window->desc);
|
window->desc);
|
||||||
invalidate_work_areas (window);
|
invalidate_work_areas (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now that we have shown the window, we no longer want to consider the
|
||||||
|
* initial timestamp in any subsequent deliberations whether to focus this
|
||||||
|
* window or not, so clear the flag.
|
||||||
|
*
|
||||||
|
* See http://bugzilla.gnome.org/show_bug.cgi?id=573922
|
||||||
|
*/
|
||||||
|
window->initial_timestamp_set = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user