summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Thurman <thomas@thurman.org.uk>2007-06-18 02:37:14 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2007-06-18 02:37:14 +0000
commite6083f64fbd4316ab723af424d2eb297afbc74b8 (patch)
tree09c9d7e2cb6851eaf7ff74fd84e2d3ac488bc951
parentb996cd03beb3c96c467059e97120f8a2ba81a3ef (diff)
downloadmetacity-e6083f64fbd4316ab723af424d2eb297afbc74b8.tar.gz
return a boolean instead a void, to show whether startup properties were
2007-06-17 Thomas Thurman <thomas@thurman.org.uk> * 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. svn path=/trunk/; revision=3245
-rw-r--r--ChangeLog8
-rw-r--r--src/screen.c35
-rw-r--r--src/screen.h2
-rw-r--r--src/window-props.c14
4 files changed, 45 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index cfd870a5..19b80ca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 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 <damien.carbery@sun.com>
* effects.h: MetaCloseEffect and MetaFocusEffect, which were empty
diff --git a/src/screen.c b/src/screen.c
index a43905b9..362397ca 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 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 d9588d50..3602395a 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",