diff --git a/ChangeLog b/ChangeLog index cfd870a52..19b80ca4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-06-17 Thomas Thurman + + * src/screen.[ch] (meta_screen_apply_startup_properties): return a + boolean instead a void, to show whether startup properties were + applied. Also some commenting. + * src/window-props.c: (reload_net_startup_id): Only activate the + window if the startup_id was actually changed. Closes #400167. + 2007-06-16 Damien Carbery * effects.h: MetaCloseEffect and MetaFocusEffect, which were empty diff --git a/src/screen.c b/src/screen.c index a43905b93..362397cac 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2546,7 +2546,15 @@ meta_screen_sn_event (SnMonitorEvent *event, } #endif -void +/* Sets the initial_timestamp and initial_workspace properties + * of a window according to information given us by the + * startup-notification library. + * + * Returns TRUE if startup properties have been applied, and + * FALSE if they have not (for example, if they had already + * been applied.) + */ +gboolean meta_screen_apply_startup_properties (MetaScreen *screen, MetaWindow *window) { @@ -2555,6 +2563,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, GSList *tmp; SnStartupSequence *sequence; + /* Does the window have a startup ID stored? */ startup_id = meta_window_get_startup_id (window); meta_topic (META_DEBUG_STARTUP, @@ -2565,6 +2574,10 @@ meta_screen_apply_startup_properties (MetaScreen *screen, sequence = NULL; if (startup_id == NULL) { + /* No startup ID stored for the window. Let's ask the + * startup-notification library whether there's anything + * stored for the resource name or resource class hints. + */ tmp = screen->startup_sequences; while (tmp != NULL) { @@ -2597,9 +2610,14 @@ meta_screen_apply_startup_properties (MetaScreen *screen, } } + /* Still no startup ID? Bail. */ if (startup_id == NULL) - return; + return FALSE; + /* We might get this far and not know the sequence ID (if the window + * already had a startup ID stored), so let's look for one if we don't + * already know it. + */ if (sequence == NULL) { tmp = screen->startup_sequences; @@ -2621,8 +2639,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, if (sequence != NULL) { - int space; - guint32 timestamp; + gboolean changed_something = FALSE; meta_topic (META_DEBUG_STARTUP, "Found startup sequence for window %s ID \"%s\"\n", @@ -2630,7 +2647,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, if (!window->initial_workspace_set) { - space = sn_startup_sequence_get_workspace (sequence); + int space = sn_startup_sequence_get_workspace (sequence); if (space >= 0) { meta_topic (META_DEBUG_STARTUP, @@ -2639,21 +2656,23 @@ meta_screen_apply_startup_properties (MetaScreen *screen, window->initial_workspace_set = TRUE; window->initial_workspace = space; + changed_something = TRUE; } } if (!window->initial_timestamp_set) { - timestamp = sn_startup_sequence_get_timestamp (sequence); + guint32 timestamp = sn_startup_sequence_get_timestamp (sequence); meta_topic (META_DEBUG_STARTUP, "Setting initial window timestamp to %u based on startup info\n", timestamp); window->initial_timestamp_set = TRUE; window->initial_timestamp = timestamp; + changed_something = TRUE; } - return; + return changed_something; } else { @@ -2663,5 +2682,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, } #endif /* HAVE_STARTUP_NOTIFICATION */ + + return FALSE; } diff --git a/src/screen.h b/src/screen.h index b4ad219fb..e3a0340dd 100644 --- a/src/screen.h +++ b/src/screen.h @@ -207,7 +207,7 @@ void meta_screen_unshow_desktop (MetaScreen *screen); /* Update whether the destkop is being shown for the current active_workspace */ void meta_screen_update_showing_desktop_hint (MetaScreen *screen); -void meta_screen_apply_startup_properties (MetaScreen *screen, +gboolean meta_screen_apply_startup_properties (MetaScreen *screen, MetaWindow *window); void meta_screen_composite_all_windows (MetaScreen *screen); diff --git a/src/window-props.c b/src/window-props.c index d9588d500..3602395aa 100644 --- a/src/window-props.c +++ b/src/window-props.c @@ -797,14 +797,16 @@ reload_net_startup_id (MetaWindow *window, window->initial_timestamp_set = 0; window->initial_workspace_set = 0; - meta_screen_apply_startup_properties (window->screen, window); + if (meta_screen_apply_startup_properties (window->screen, window)) + { - if (window->initial_timestamp_set) - timestamp = window->initial_timestamp; - if (window->initial_workspace_set) - workspace = meta_screen_get_workspace_by_index (window->screen, window->initial_workspace); + if (window->initial_timestamp_set) + timestamp = window->initial_timestamp; + if (window->initial_workspace_set) + workspace = meta_screen_get_workspace_by_index (window->screen, window->initial_workspace); - meta_window_activate_with_workspace (window, timestamp, workspace); + meta_window_activate_with_workspace (window, timestamp, workspace); + } } meta_verbose ("New _NET_STARTUP_ID \"%s\" for %s\n",