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
This commit is contained in:
Thomas Thurman 2007-06-18 02:37:14 +00:00 committed by Thomas James Alexander Thurman
parent b996cd03be
commit e6083f64fb
4 changed files with 45 additions and 14 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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",