diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c index 371ec35ff..21b88dea8 100644 --- a/src/core/startup-notification.c +++ b/src/core/startup-notification.c @@ -38,6 +38,7 @@ * might decide they need to launch it again. */ #define STARTUP_TIMEOUT_MS 15000 +#define UPDATE_CURSOR_TIMEOUT_MS 20 enum { @@ -92,6 +93,8 @@ struct _MetaStartupNotification GSList *startup_sequences; guint startup_sequence_timeout_id; + guint update_cursor_timeout_id; + MetaCursor cursor; }; typedef struct @@ -133,22 +136,53 @@ meta_startup_notification_has_pending_sequences (MetaStartupNotification *sn) } static void -meta_startup_notification_update_feedback (MetaStartupNotification *sn) +meta_startup_notification_update_cursor (MetaStartupNotification *sn) { MetaDisplay *display = sn->display; + MetaCursor cursor; if (meta_startup_notification_has_pending_sequences (sn)) { meta_topic (META_DEBUG_STARTUP, "Setting busy cursor"); - meta_display_set_cursor (display, META_CURSOR_BUSY); + cursor = META_CURSOR_BUSY; } else { meta_topic (META_DEBUG_STARTUP, "Setting default cursor"); - meta_display_set_cursor (display, META_CURSOR_DEFAULT); + cursor = META_CURSOR_DEFAULT; } + + if (sn->cursor != cursor) + { + meta_display_set_cursor (display, cursor); + sn->cursor = cursor; + } +} + +static gboolean +meta_startup_notification_cursor_timeout (gpointer user_data) +{ + MetaStartupNotification *sn = user_data; + + meta_startup_notification_update_cursor (sn); + sn->update_cursor_timeout_id = 0; + + return G_SOURCE_REMOVE; +} + +static void +meta_startup_notification_update_feedback (MetaStartupNotification *sn) +{ + if (sn->update_cursor_timeout_id) + return; + + meta_startup_notification_update_cursor (sn); + sn->update_cursor_timeout_id = + g_timeout_add (UPDATE_CURSOR_TIMEOUT_MS, + meta_startup_notification_cursor_timeout, + sn); } static void @@ -631,6 +665,7 @@ meta_startup_notification_finalize (GObject *object) MetaStartupNotification *sn = META_STARTUP_NOTIFICATION (object); g_clear_handle_id (&sn->startup_sequence_timeout_id, g_source_remove); + g_clear_handle_id (&sn->update_cursor_timeout_id, g_source_remove); g_slist_free_full (sn->startup_sequences, g_object_unref); sn->startup_sequences = NULL;