summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-01-25 04:02:55 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-01-25 04:02:55 +0000
commit06a19ba6934aae0f365ee821a3e9cc9515818647 (patch)
treee4676ade9f86098e4d3abb9b04261172ae21864d /gdk
parent570ad468e06ff019e88bad55de8ec309439f739b (diff)
downloadgtk+-06a19ba6934aae0f365ee821a3e9cc9515818647.tar.gz
Initialize user_time from DESKTOP_STARTUP_ID. (#165131, Elijah Newren)
2005-01-24 Matthias Clasen <mclasen@redhat.com> * gdk/x11/gdkdisplay-x11.c (_gdk_windowing_set_default_display): Initialize user_time from DESKTOP_STARTUP_ID. (#165131, Elijah Newren)
Diffstat (limited to 'gdk')
-rw-r--r--gdk/x11/gdkdisplay-x11.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index a046e5e644..b46356bde6 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include <unistd.h>
#include <glib.h>
@@ -842,10 +843,30 @@ _gdk_windowing_set_default_display (GdkDisplay *display)
startup_id = g_getenv ("DESKTOP_STARTUP_ID");
if (startup_id && *startup_id != '\0')
{
+ gchar *time_str;
+
if (!g_utf8_validate (startup_id, -1, NULL))
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
else
display_x11->startup_notification_id = g_strdup (startup_id);
+
+ /* 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>
+ */
+ time_str = g_strrstr (startup_id, "_TIME");
+ if (time_str != NULL)
+ {
+ gulong retval;
+ gchar *end;
+ errno = 0;
+
+ /* Skip past the "_TIME" part */
+ time_str += 5;
+
+ retval = strtoul (time_str, &end, 0);
+ if (end != time_str && errno == 0)
+ display_x11->user_time = retval;
+ }
/* Clear the environment variable so it won't be inherited by
* child processes and confuse things.