GtkApplication: avoid using stale timestamps
Avoid using a stale timestamp (from the last user interaction with the application) when a message arrives from D-Bus requesting that a new window be created. In this case the most-correct thing that we can do is to use no timestamp at all. We modify gdk_x11_display_set_startup_notification_id() to allow a NULL value to mean "reset everything" and then call this function unconditionally on receipt of D-Bus activation requests. The result will be that a missing desktop-startup-id in the platform-data struct will reset the timestamp. Under their default configuration metacity and mutter will both map windows presented with no timestamp in the foreground. This could result in false-positive, but there is very little we can do about that without the original timestamp from the user event. https://bugzilla.gnome.org/show_bug.cgi?id=752000
This commit is contained in:
parent
18dbe181fb
commit
a00a5ed210
@ -2388,6 +2388,8 @@ gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
|
|||||||
g_free (display_x11->startup_notification_id);
|
g_free (display_x11->startup_notification_id);
|
||||||
display_x11->startup_notification_id = g_strdup (startup_id);
|
display_x11->startup_notification_id = g_strdup (startup_id);
|
||||||
|
|
||||||
|
if (startup_id != NULL)
|
||||||
|
{
|
||||||
/* Find the launch time from the startup_id, if it's there. Newer spec
|
/* Find the launch time from the startup_id, if it's there. Newer spec
|
||||||
* states that the startup_id is of the form <unique>_TIME<timestamp>
|
* states that the startup_id is of the form <unique>_TIME<timestamp>
|
||||||
*/
|
*/
|
||||||
@ -2405,6 +2407,8 @@ gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
|
|||||||
if (end != time_str && errno == 0)
|
if (end != time_str && errno == 0)
|
||||||
display_x11->user_time = retval;
|
display_x11->user_time = retval;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
display_x11->user_time = 0;
|
||||||
|
|
||||||
/* Set the startup id on the leader window so it
|
/* Set the startup id on the leader window so it
|
||||||
* applies to all windows we create on this display
|
* applies to all windows we create on this display
|
||||||
@ -2416,6 +2420,13 @@ gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
|
|||||||
PropModeReplace,
|
PropModeReplace,
|
||||||
(guchar *)startup_id, strlen (startup_id));
|
(guchar *)startup_id, strlen (startup_id));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XDeleteProperty (display_x11->xdisplay, display_x11->leader_window,
|
||||||
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"));
|
||||||
|
display_x11->user_time = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gdk_x11_display_supports_composite (GdkDisplay *display)
|
gdk_x11_display_supports_composite (GdkDisplay *display)
|
||||||
|
@ -82,14 +82,11 @@ static void
|
|||||||
gtk_application_impl_x11_before_emit (GtkApplicationImpl *impl,
|
gtk_application_impl_x11_before_emit (GtkApplicationImpl *impl,
|
||||||
GVariant *platform_data)
|
GVariant *platform_data)
|
||||||
{
|
{
|
||||||
const char *startup_notification_id;
|
const char *startup_notification_id = NULL;
|
||||||
|
|
||||||
if (g_variant_lookup (platform_data, "desktop-startup-id",
|
g_variant_lookup (platform_data, "desktop-startup-id", "&s", &startup_notification_id);
|
||||||
"&s", &startup_notification_id))
|
|
||||||
{
|
gdk_x11_display_set_startup_notification_id (gdk_display_get_default (), startup_notification_id);
|
||||||
gdk_x11_display_set_startup_notification_id (gdk_display_get_default (),
|
|
||||||
startup_notification_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user