core: Use MetaStartupSequence internally

Replace code in MetaDisplay so it uses MetaStartupSequence
This commit is contained in:
Carlos Garnacho 2018-08-22 23:33:03 +02:00 committed by Georges Basile Stavracas Neto
parent 4d92979b43
commit ec6a536d36

View File

@ -3151,10 +3151,9 @@ gboolean
meta_display_apply_startup_properties (MetaDisplay *display, meta_display_apply_startup_properties (MetaDisplay *display,
MetaWindow *window) MetaWindow *window)
{ {
#ifdef HAVE_STARTUP_NOTIFICATION
const char *startup_id; const char *startup_id;
GSList *l; GSList *startup_sequences, *l;
SnStartupSequence *sequence; MetaStartupSequence *sequence;
/* Does the window have a startup ID stored? */ /* Does the window have a startup ID stored? */
startup_id = meta_window_get_startup_id (window); startup_id = meta_window_get_startup_id (window);
@ -3164,6 +3163,8 @@ meta_display_apply_startup_properties (MetaDisplay *display,
window->desc, window->desc,
startup_id ? startup_id : "(none)"); startup_id ? startup_id : "(none)");
startup_sequences =
meta_startup_notification_get_sequences (display->startup_notification);
sequence = NULL; sequence = NULL;
if (!startup_id) if (!startup_id)
{ {
@ -3171,12 +3172,12 @@ meta_display_apply_startup_properties (MetaDisplay *display,
* startup-notification library whether there's anything * startup-notification library whether there's anything
* stored for the resource name or resource class hints. * stored for the resource name or resource class hints.
*/ */
for (l = display->startup_sequences; l; l = l->next) for (l = startup_sequences; l; l = l->next)
{ {
const char *wmclass; const char *wmclass;
SnStartupSequence *seq = l->data; MetaStartupSequence *seq = l->data;
wmclass = sn_startup_sequence_get_wmclass (seq); wmclass = meta_startup_sequence_get_wmclass (seq);
if (wmclass != NULL && if (wmclass != NULL &&
((window->res_class && ((window->res_class &&
@ -3187,15 +3188,15 @@ meta_display_apply_startup_properties (MetaDisplay *display,
sequence = seq; sequence = seq;
g_assert (window->startup_id == NULL); g_assert (window->startup_id == NULL);
window->startup_id = g_strdup (sn_startup_sequence_get_id (sequence)); window->startup_id = g_strdup (meta_startup_sequence_get_id (sequence));
startup_id = window->startup_id; startup_id = window->startup_id;
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
"Ending legacy sequence %s due to window %s\n", "Ending legacy sequence %s due to window %s\n",
sn_startup_sequence_get_id (sequence), meta_startup_sequence_get_id (sequence),
window->desc); window->desc);
sn_startup_sequence_complete (sequence); meta_startup_sequence_complete (sequence);
break; break;
} }
} }
@ -3211,12 +3212,12 @@ meta_display_apply_startup_properties (MetaDisplay *display,
*/ */
if (sequence == NULL) if (sequence == NULL)
{ {
for (l = display->startup_sequences; l != NULL; l = l->next) for (l = startup_sequences; l != NULL; l = l->next)
{ {
SnStartupSequence *seq = l->data; MetaStartupSequence *seq = l->data;
const char *id; const char *id;
id = sn_startup_sequence_get_id (seq); id = meta_startup_sequence_get_id (seq);
if (strcmp (id, startup_id) == 0) if (strcmp (id, startup_id) == 0)
{ {
@ -3236,7 +3237,7 @@ meta_display_apply_startup_properties (MetaDisplay *display,
if (!window->initial_workspace_set) if (!window->initial_workspace_set)
{ {
int space = sn_startup_sequence_get_workspace (sequence); int space = meta_startup_sequence_get_workspace (sequence);
if (space >= 0) if (space >= 0)
{ {
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
@ -3251,7 +3252,7 @@ meta_display_apply_startup_properties (MetaDisplay *display,
if (!window->initial_timestamp_set) if (!window->initial_timestamp_set)
{ {
guint32 timestamp = sn_startup_sequence_get_timestamp (sequence); guint32 timestamp = meta_startup_sequence_get_timestamp (sequence);
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
"Setting initial window timestamp to %u based on startup info\n", "Setting initial window timestamp to %u based on startup info\n",
timestamp); timestamp);
@ -3270,8 +3271,6 @@ meta_display_apply_startup_properties (MetaDisplay *display,
window->desc, startup_id); window->desc, startup_id);
} }
#endif /* HAVE_STARTUP_NOTIFICATION */
return FALSE; return FALSE;
} }