Commit e6083f64 authored by Thomas Thurman's avatar Thomas Thurman Committed by Thomas James Alexander Thurman
Browse files

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
parent b996cd03
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> 2007-06-16 Damien Carbery <damien.carbery@sun.com>
* effects.h: MetaCloseEffect and MetaFocusEffect, which were empty * effects.h: MetaCloseEffect and MetaFocusEffect, which were empty
......
...@@ -2546,7 +2546,15 @@ meta_screen_sn_event (SnMonitorEvent *event, ...@@ -2546,7 +2546,15 @@ meta_screen_sn_event (SnMonitorEvent *event,
} }
#endif #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, meta_screen_apply_startup_properties (MetaScreen *screen,
MetaWindow *window) MetaWindow *window)
{ {
...@@ -2555,6 +2563,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, ...@@ -2555,6 +2563,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
GSList *tmp; GSList *tmp;
SnStartupSequence *sequence; SnStartupSequence *sequence;
/* Does the window have a startup ID stored? */
startup_id = meta_window_get_startup_id (window); startup_id = meta_window_get_startup_id (window);
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
...@@ -2565,6 +2574,10 @@ meta_screen_apply_startup_properties (MetaScreen *screen, ...@@ -2565,6 +2574,10 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
sequence = NULL; sequence = NULL;
if (startup_id == 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; tmp = screen->startup_sequences;
while (tmp != NULL) while (tmp != NULL)
{ {
...@@ -2597,9 +2610,14 @@ meta_screen_apply_startup_properties (MetaScreen *screen, ...@@ -2597,9 +2610,14 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
} }
} }
/* Still no startup ID? Bail. */
if (startup_id == NULL) 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) if (sequence == NULL)
{ {
tmp = screen->startup_sequences; tmp = screen->startup_sequences;
...@@ -2621,8 +2639,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, ...@@ -2621,8 +2639,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
if (sequence != NULL) if (sequence != NULL)
{ {
int space; gboolean changed_something = FALSE;
guint32 timestamp;
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
"Found startup sequence for window %s ID \"%s\"\n", "Found startup sequence for window %s ID \"%s\"\n",
...@@ -2630,7 +2647,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, ...@@ -2630,7 +2647,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
if (!window->initial_workspace_set) if (!window->initial_workspace_set)
{ {
space = sn_startup_sequence_get_workspace (sequence); int space = sn_startup_sequence_get_workspace (sequence);
if (space >= 0) if (space >= 0)
{ {
meta_topic (META_DEBUG_STARTUP, meta_topic (META_DEBUG_STARTUP,
...@@ -2639,21 +2656,23 @@ meta_screen_apply_startup_properties (MetaScreen *screen, ...@@ -2639,21 +2656,23 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
window->initial_workspace_set = TRUE; window->initial_workspace_set = TRUE;
window->initial_workspace = space; window->initial_workspace = space;
changed_something = TRUE;
} }
} }
if (!window->initial_timestamp_set) 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, 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);
window->initial_timestamp_set = TRUE; window->initial_timestamp_set = TRUE;
window->initial_timestamp = timestamp; window->initial_timestamp = timestamp;
changed_something = TRUE;
} }
return; return changed_something;
} }
else else
{ {
...@@ -2663,5 +2682,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen, ...@@ -2663,5 +2682,7 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
} }
#endif /* HAVE_STARTUP_NOTIFICATION */ #endif /* HAVE_STARTUP_NOTIFICATION */
return FALSE;
} }
...@@ -207,7 +207,7 @@ void meta_screen_unshow_desktop (MetaScreen *screen); ...@@ -207,7 +207,7 @@ void meta_screen_unshow_desktop (MetaScreen *screen);
/* Update whether the destkop is being shown for the current active_workspace */ /* Update whether the destkop is being shown for the current active_workspace */
void meta_screen_update_showing_desktop_hint (MetaScreen *screen); 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); MetaWindow *window);
void meta_screen_composite_all_windows (MetaScreen *screen); void meta_screen_composite_all_windows (MetaScreen *screen);
......
...@@ -797,14 +797,16 @@ reload_net_startup_id (MetaWindow *window, ...@@ -797,14 +797,16 @@ reload_net_startup_id (MetaWindow *window,
window->initial_timestamp_set = 0; window->initial_timestamp_set = 0;
window->initial_workspace_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) if (window->initial_timestamp_set)
timestamp = window->initial_timestamp; timestamp = window->initial_timestamp;
if (window->initial_workspace_set) if (window->initial_workspace_set)
workspace = meta_screen_get_workspace_by_index (window->screen, window->initial_workspace); 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", meta_verbose ("New _NET_STARTUP_ID \"%s\" for %s\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment