[gnome-shell/eos3.8: 96/255] shell-app: avoid focus steal prevention when activating from browser
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 96/255] shell-app: avoid focus steal prevention when activating from browser
- Date: Wed, 10 Jun 2020 19:06:02 +0000 (UTC)
commit 8453c0d5fee75a34a681b7c79293dfb07292fd82
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Mon Nov 24 18:26:09 2014 -0800
shell-app: avoid focus steal prevention when activating from browser
When an application is activated from the exploration center, we call
into the eos-launch utility, which will trigger a Launch() RPC to the
shell. Unfortunately we have no way of obtaining a valid timestamp for
the user interaction in that scenario.
shell_app_activate_window() has no provisioning for being called
with a zero timestamp, since the rest of the API always will have a
valid timestamp, as it's called from within the shell itself.
Handle that case by obtaining a timestamp with an X server roundtrip,
and prevent focus stealing prevention from accidentally kicking in.
[endlessm/eos-shell#3312]
src/shell-app.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index 60096717d5..e3adf084a5 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -418,6 +418,17 @@ shell_app_activate_window (ShellApp *app,
guint32 last_user_timestamp = meta_display_get_last_user_time (display);
MetaWindow *most_recent_transient;
+ /* HACK: we shouldn't really get this far with a zero timestamp,
+ * but shell_app_activate_window() can be called from shell_app_activate_full()
+ * which will not be able to fetch a valid timestamp in some cases - e.g.
+ * if we're just activating an app over DBus from Chromium.
+ * Since passing a zero timestamp will trigger focus stealing prevention,
+ * and passing zero to meta_window_activate() will trigger a WM warning,
+ * just fetch the timestamp here instead.
+ */
+ if (timestamp == 0)
+ timestamp = meta_display_get_current_time_roundtrip (display);
+
if (meta_display_xserver_time_is_before (display, timestamp, last_user_timestamp))
{
meta_window_set_demands_attention (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]