[gnome-shell/T27795: 116/138] shell-app: avoid focus steal prevention when activating from browser
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/T27795: 116/138] shell-app: avoid focus steal prevention when activating from browser
- Date: Tue, 1 Oct 2019 23:39:05 +0000 (UTC)
commit 5eaf5e3fb28705304e1761eb3e3aeb8f06385ce7
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 5e39c121e1..08ac352bc8 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -403,6 +403,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]