diff options
author | Benedikt Meurer <benny@xfce.org> | 2004-05-20 21:53:47 +0000 |
---|---|---|
committer | Benedikt Meurer <benny@xfce.org> | 2004-05-20 21:53:47 +0000 |
commit | 59ac30178f924ea8fd077e9a02dd2b067c2c7e50 (patch) | |
tree | 8cd108b6ca4bb49efe98eb5228ecc20158cf86d8 | |
parent | 2cc5333b16cf121302aed5dfcd584a8e276d9d8c (diff) | |
download | xfce4-session-59ac30178f924ea8fd077e9a02dd2b067c2c7e50.tar.gz |
Fix a nasty bug. Until now each application was assigned a new session id,
regardless of whether the application was freshly started or restored. This
fixes the problem, that xfwm4 wasn't able to restore window attributes on
startup. When updating, you need to rm -f ~/.cache/xfce4-session/xfce4-session*
to get it fixed.
(Old svn revision: 4569)
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | xfce4-session.spec.in | 1 | ||||
-rw-r--r-- | xfce4-session/xfsm-global.c | 1 | ||||
-rw-r--r-- | xfce4-session/xfsm-global.h | 1 | ||||
-rw-r--r-- | xfce4-session/xfsm-manager.c | 37 | ||||
-rw-r--r-- | xfce4-session/xfsm-startup.c | 9 |
6 files changed, 41 insertions, 10 deletions
@@ -1,2 +1,4 @@ Benedikt Meurer <benny@xfce.org> Oliver M. Bolzer <oliver@debian.org> + +Parts of the code were copied from gnome-session. diff --git a/xfce4-session.spec.in b/xfce4-session.spec.in index e5d38a7b..bb359003 100644 --- a/xfce4-session.spec.in +++ b/xfce4-session.spec.in @@ -34,6 +34,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc AUTHORS COPYING ChangeLog ChangeLog.pre-xfce-devel NEWS README TODO +%{_sysconfdir}/xdg/ %{_sysconfdir}/xfce4/ %{_datadir}/themes/ %{_datadir}/locale/ diff --git a/xfce4-session/xfsm-global.c b/xfce4-session/xfsm-global.c index 35a0a9c2..1a5036ea 100644 --- a/xfce4-session/xfsm-global.c +++ b/xfce4-session/xfsm-global.c @@ -36,6 +36,7 @@ /* global variables */ gboolean verbose = FALSE; +GList *starting_properties = NULL; GList *pending_properties = NULL; GList *restart_properties = NULL; GList *running_clients = NULL; diff --git a/xfce4-session/xfsm-global.h b/xfce4-session/xfsm-global.h index feb7aea5..9b566821 100644 --- a/xfce4-session/xfsm-global.h +++ b/xfce4-session/xfsm-global.h @@ -37,6 +37,7 @@ struct _FailsafeClient extern gboolean verbose; +extern GList *starting_properties; extern GList *pending_properties; extern GList *restart_properties; extern GList *running_clients; diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c index b6230fb7..e4c70c5f 100644 --- a/xfce4-session/xfsm-manager.c +++ b/xfce4-session/xfsm-manager.c @@ -388,7 +388,7 @@ xfsm_manager_generate_client_id (SmsConn sms_conn) addr = g_strdup_printf ("0%.8x", g_random_int ()); } - id = (char *) malloc (50); + id = (char *) g_malloc (50); g_snprintf (id, 50, "1%s%.13ld%.10d%.4d", addr, (long) time (NULL), (int) getpid (), sequence); sequence = (sequence + 1) % 10000; @@ -417,26 +417,45 @@ gboolean xfsm_manager_register_client (XfsmClient *client, const gchar *previous_id) { - XfsmProperties *properties; + XfsmProperties *properties = NULL; gchar *client_id; GList *lp; if (previous_id != NULL) { - for (lp = pending_properties; lp != NULL; lp = lp->next) - if (strcmp (XFSM_PROPERTIES (lp->data)->client_id, previous_id) == 0) - break; - + for (lp = starting_properties; lp != NULL; lp = lp->next) + { + if (strcmp (XFSM_PROPERTIES (lp->data)->client_id, previous_id) == 0) + { + properties = XFSM_PROPERTIES (lp->data); + starting_properties = g_list_remove (starting_properties, + properties); + break; + } + } + + if (properties == NULL) + { + for (lp = pending_properties; lp != NULL; lp = lp->next) + { + if (!strcmp (XFSM_PROPERTIES (lp->data)->client_id, previous_id)) + { + properties = XFSM_PROPERTIES (lp->data); + pending_properties = g_list_remove (pending_properties, + properties); + break; + } + } + } + /* If previous_id is invalid, the SM will send a BadValue error message * to the client and reverts to register state waiting for another * RegisterClient message. */ - if (lp == NULL) + if (properties == NULL) return FALSE; - properties = XFSM_PROPERTIES (lp->data); xfsm_client_set_initial_properties (client, properties); - pending_properties = g_list_remove (pending_properties, properties); } else { diff --git a/xfce4-session/xfsm-startup.c b/xfce4-session/xfsm-startup.c index 2d96e9db..98be073d 100644 --- a/xfce4-session/xfsm-startup.c +++ b/xfce4-session/xfsm-startup.c @@ -242,6 +242,7 @@ static gboolean xfsm_startup_continue_session (const gchar *previous_id) { XfsmProperties *properties; + GList *lp; properties = (XfsmProperties *) g_list_nth_data (pending_properties, 0); if (properties != NULL) @@ -253,11 +254,17 @@ xfsm_startup_continue_session (const gchar *previous_id) xfsm_start_application (properties->restart_command, NULL, NULL, NULL, NULL, NULL); pending_properties = g_list_remove (pending_properties, properties); - xfsm_properties_free (properties); + starting_properties = g_list_append (starting_properties, properties); /* more to come... */ return FALSE; } + + /* start up done, free all properties that failed to restart correctly */ + for (lp = starting_properties; lp != NULL; lp = lp->next) + xfsm_properties_free (XFSM_PROPERTIES (lp->data)); + g_list_free (starting_properties); + starting_properties = NULL; return TRUE; } |