diff options
Diffstat (limited to 'meta-xfce/recipes-xfce/xfce4-session/files/0001-Handle-multiple-interactive-session-save-bug-5379.patch')
| -rw-r--r-- | meta-xfce/recipes-xfce/xfce4-session/files/0001-Handle-multiple-interactive-session-save-bug-5379.patch | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/meta-xfce/recipes-xfce/xfce4-session/files/0001-Handle-multiple-interactive-session-save-bug-5379.patch b/meta-xfce/recipes-xfce/xfce4-session/files/0001-Handle-multiple-interactive-session-save-bug-5379.patch new file mode 100644 index 0000000000..38949a5d73 --- /dev/null +++ b/meta-xfce/recipes-xfce/xfce4-session/files/0001-Handle-multiple-interactive-session-save-bug-5379.patch | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | From 9f3077be682355e1cd07e9a9463e76307292208c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Dimitar Zhekov <hamster@mbox.contact.bg> | ||
| 3 | Date: Thu, 30 Aug 2012 22:52:14 +0200 | ||
| 4 | Subject: [PATCH] Handle multiple interactive session save (bug #5379). | ||
| 5 | |||
| 6 | Additionnaly, we now use SmSaveGlobal on log out / shutdown without | ||
| 7 | session save which avoids data loss. Previously clients would not save | ||
| 8 | anything on log out without session save. | ||
| 9 | |||
| 10 | Based on original work by Chris Bainbridge (chris.bainbridge@gmail.com). | ||
| 11 | --- | ||
| 12 | Upstream-status: applied | ||
| 13 | xfce4-session/xfsm-manager.c | 81 ++++++++++++++++++++++++----------------- | ||
| 14 | 1 files changed, 47 insertions(+), 34 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c | ||
| 17 | index bf6a446..35811c5 100644 | ||
| 18 | --- a/xfce4-session/xfsm-manager.c | ||
| 19 | +++ b/xfce4-session/xfsm-manager.c | ||
| 20 | @@ -98,6 +98,7 @@ struct _XfsmManager | ||
| 21 | |||
| 22 | XfsmShutdownType shutdown_type; | ||
| 23 | XfsmShutdown *shutdown_helper; | ||
| 24 | + gboolean save_session; | ||
| 25 | |||
| 26 | gboolean session_chooser; | ||
| 27 | gchar *session_name; | ||
| 28 | @@ -230,6 +231,7 @@ xfsm_manager_init (XfsmManager *manager) | ||
| 29 | manager->failsafe_mode = TRUE; | ||
| 30 | manager->shutdown_type = XFSM_SHUTDOWN_LOGOUT; | ||
| 31 | manager->shutdown_helper = xfsm_shutdown_get (); | ||
| 32 | + manager->save_session = TRUE; | ||
| 33 | |||
| 34 | manager->pending_properties = g_queue_new (); | ||
| 35 | manager->starting_properties = g_queue_new (); | ||
| 36 | @@ -989,7 +991,9 @@ xfsm_manager_interact (XfsmManager *manager, | ||
| 37 | XfsmClient *cl = lp->data; | ||
| 38 | if (xfsm_client_get_state (cl) == XFSM_CLIENT_INTERACTING) | ||
| 39 | { | ||
| 40 | - xfsm_client_set_state (cl, XFSM_CLIENT_WAITFORINTERACT); | ||
| 41 | + /* a client is already interacting, so new client has to wait */ | ||
| 42 | + xfsm_client_set_state (client, XFSM_CLIENT_WAITFORINTERACT); | ||
| 43 | + xfsm_manager_cancel_client_save_timeout(manager, client); | ||
| 44 | return; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | @@ -1138,44 +1142,47 @@ xfsm_manager_save_yourself_global (XfsmManager *manager, | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | - if (!shutdown || shutdown_save) | ||
| 52 | + /* don't save the session if shutting down without save */ | ||
| 53 | + manager->save_session = !shutdown || shutdown_save; | ||
| 54 | + | ||
| 55 | + if (save_type == SmSaveBoth && !manager->save_session) | ||
| 56 | { | ||
| 57 | - xfsm_manager_set_state (manager, | ||
| 58 | - shutdown | ||
| 59 | - ? XFSM_MANAGER_SHUTDOWN | ||
| 60 | - : XFSM_MANAGER_CHECKPOINT); | ||
| 61 | + /* saving the session, so clients should | ||
| 62 | + * (prompt to) save the user data only */ | ||
| 63 | + save_type = SmSaveGlobal; | ||
| 64 | + } | ||
| 65 | |||
| 66 | - /* handle legacy applications first! */ | ||
| 67 | - xfsm_legacy_perform_session_save (); | ||
| 68 | + xfsm_manager_set_state (manager, | ||
| 69 | + shutdown | ||
| 70 | + ? XFSM_MANAGER_SHUTDOWN | ||
| 71 | + : XFSM_MANAGER_CHECKPOINT); | ||
| 72 | |||
| 73 | - for (lp = g_queue_peek_nth_link (manager->running_clients, 0); | ||
| 74 | - lp; | ||
| 75 | - lp = lp->next) | ||
| 76 | - { | ||
| 77 | - XfsmClient *client = lp->data; | ||
| 78 | - XfsmProperties *properties = xfsm_client_get_properties (client); | ||
| 79 | - const gchar *program; | ||
| 80 | + /* handle legacy applications first! */ | ||
| 81 | + if (manager->save_session) | ||
| 82 | + xfsm_legacy_perform_session_save (); | ||
| 83 | |||
| 84 | - /* xterm's session management is broken, so we won't | ||
| 85 | - * send a SAVE YOURSELF to xterms */ | ||
| 86 | - program = xfsm_properties_get_string (properties, SmProgram); | ||
| 87 | - if (program != NULL && strcasecmp (program, "xterm") == 0) | ||
| 88 | - continue; | ||
| 89 | + for (lp = g_queue_peek_nth_link (manager->running_clients, 0); | ||
| 90 | + lp; | ||
| 91 | + lp = lp->next) | ||
| 92 | + { | ||
| 93 | + XfsmClient *client = lp->data; | ||
| 94 | + XfsmProperties *properties = xfsm_client_get_properties (client); | ||
| 95 | + const gchar *program; | ||
| 96 | |||
| 97 | - if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL) | ||
| 98 | - { | ||
| 99 | - SmsSaveYourself (xfsm_client_get_sms_connection (client), save_type, shutdown, | ||
| 100 | - interact_style, fast); | ||
| 101 | - } | ||
| 102 | + /* xterm's session management is broken, so we won't | ||
| 103 | + * send a SAVE YOURSELF to xterms */ | ||
| 104 | + program = xfsm_properties_get_string (properties, SmProgram); | ||
| 105 | + if (program != NULL && strcasecmp (program, "xterm") == 0) | ||
| 106 | + continue; | ||
| 107 | |||
| 108 | - xfsm_client_set_state (client, XFSM_CLIENT_SAVING); | ||
| 109 | - xfsm_manager_start_client_save_timeout (manager, client); | ||
| 110 | + if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL) | ||
| 111 | + { | ||
| 112 | + SmsSaveYourself (xfsm_client_get_sms_connection (client), save_type, shutdown, | ||
| 113 | + interact_style, fast); | ||
| 114 | } | ||
| 115 | - } | ||
| 116 | - else | ||
| 117 | - { | ||
| 118 | - /* shutdown session without saving */ | ||
| 119 | - xfsm_manager_perform_shutdown (manager); | ||
| 120 | + | ||
| 121 | + xfsm_client_set_state (client, XFSM_CLIENT_SAVING); | ||
| 122 | + xfsm_manager_start_client_save_timeout (manager, client); | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | @@ -1249,7 +1256,12 @@ xfsm_manager_save_yourself_done (XfsmManager *manager, | ||
| 127 | XfsmClient *client, | ||
| 128 | gboolean success) | ||
| 129 | { | ||
| 130 | - if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVING && xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL) | ||
| 131 | + /* In xfsm_manager_interact_done we send SmsShutdownCancelled to clients in | ||
| 132 | + XFSM_CLIENT_WAITFORINTERACT state. They respond with SmcSaveYourselfDone | ||
| 133 | + (xsmp_shutdown_cancelled in libxfce4ui library) so we allow it here. */ | ||
| 134 | + if (xfsm_client_get_state (client) != XFSM_CLIENT_SAVING && | ||
| 135 | + xfsm_client_get_state (client) != XFSM_CLIENT_SAVINGLOCAL && | ||
| 136 | + xfsm_client_get_state (client) != XFSM_CLIENT_WAITFORINTERACT) | ||
| 137 | { | ||
| 138 | xfsm_verbose ("Client Id = %s send SAVE YOURSELF DONE, while not being " | ||
| 139 | "in save mode. Prepare to be nuked!\n", | ||
| 140 | @@ -1521,7 +1533,8 @@ xfsm_manager_complete_saveyourself (XfsmManager *manager) | ||
| 141 | xfsm_verbose ("Manager finished SAVE YOURSELF, session data will be stored now.\n\n"); | ||
| 142 | |||
| 143 | /* all clients done, store session data */ | ||
| 144 | - xfsm_manager_store_session (manager); | ||
| 145 | + if (manager->save_session) | ||
| 146 | + xfsm_manager_store_session (manager); | ||
| 147 | |||
| 148 | if (manager->state == XFSM_MANAGER_CHECKPOINT) | ||
| 149 | { | ||
| 150 | -- | ||
| 151 | 1.7.4.4 | ||
| 152 | |||
