diff --git a/ChangeLog b/ChangeLog index fe91723936..f961bf2d11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-01-24 Matthias Clasen + + * gdk/x11/gdkdisplay-x11.c (_gdk_windowing_set_default_display): + Initialize user_time from DESKTOP_STARTUP_ID. (#165131, + Elijah Newren) + 2005-01-24 Federico Mena Quintero * gtk/gtkfilechooserdefault.c: Removed leftover comments. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index fe91723936..f961bf2d11 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2005-01-24 Matthias Clasen + + * gdk/x11/gdkdisplay-x11.c (_gdk_windowing_set_default_display): + Initialize user_time from DESKTOP_STARTUP_ID. (#165131, + Elijah Newren) + 2005-01-24 Federico Mena Quintero * gtk/gtkfilechooserdefault.c: Removed leftover comments. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index fe91723936..f961bf2d11 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2005-01-24 Matthias Clasen + + * gdk/x11/gdkdisplay-x11.c (_gdk_windowing_set_default_display): + Initialize user_time from DESKTOP_STARTUP_ID. (#165131, + Elijah Newren) + 2005-01-24 Federico Mena Quintero * gtk/gtkfilechooserdefault.c: Removed leftover comments. 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 #include +#include #include #include @@ -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 _TIME + */ + 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.