diff options
author | Thomas Thurman <thomas@thurman.org.uk> | 2007-06-18 02:54:55 +0000 |
---|---|---|
committer | Thomas James Alexander Thurman <tthurman@src.gnome.org> | 2007-06-18 02:54:55 +0000 |
commit | 4a5182dca3c4614f979c4a7a462be027e3ebac3d (patch) | |
tree | 5133690399da30d8a5ca0357906ac1eca56736ad | |
parent | b700066bc3b24b1576dd9c0a71b84e4ca5700c5c (diff) | |
download | metacity-4a5182dca3c4614f979c4a7a462be027e3ebac3d.tar.gz |
return a boolean instead of a void, to show whether startup properties
2007-06-17 Thomas Thurman <thomas@thurman.org.uk>
* src/screen.[ch] (meta_screen_apply_startup_properties): return a
boolean instead of 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.
svn path=/branches/gnome-2-18/; revision=3246
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/screen.c | 35 | ||||
-rw-r--r-- | src/screen.h | 2 | ||||
-rw-r--r-- | src/window-props.c | 14 |
4 files changed, 45 insertions, 14 deletions
@@ -1,3 +1,11 @@ +2007-06-17 Thomas Thurman <thomas@thurman.org.uk> + + * src/screen.[ch] (meta_screen_apply_startup_properties): return a + boolean instead of 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-05-28 Elijah Newren <newren gmail com> * configure.in: post-release version bump to 2.18.5 diff --git a/src/screen.c b/src/screen.c index f5336680..a5133c63 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2542,7 +2542,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) { @@ -2551,6 +2559,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, @@ -2561,6 +2570,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) { @@ -2593,9 +2606,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; @@ -2617,8 +2635,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", @@ -2626,7 +2643,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, @@ -2635,21 +2652,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 { @@ -2659,5 +2678,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 b4ad219f..e3a0340d 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 2506e625..58b31128 100644 --- a/src/window-props.c +++ b/src/window-props.c @@ -712,14 +712,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", |