diff --git a/ChangeLog b/ChangeLog index 7c26e44ed..a90d5529f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-08-07 Elijah Newren + + Patch from Vytautas Liuolia to react to _NET_STARTUP_ID changes, + as proposed for the new startup-notification/EWMH spec. #347515 + + * src/window-props.c (reload_net_startup_id): be sure to act on + the new id instead of just recording it + + * src/window.[ch] (window_activate, meta_window_activate, + meta_window_activate_with_workspace, meta_window_client_message): + change window_activate() to take a workspace parameter instead of + hardcoding to the current workspace, add + meta_window_activate_with_workspace() function needed by + reload_net_startup_id(). + 2006-08-07 Thomas Thurman * src/frames.h: add new MetaButtonSpace struct; use it for diff --git a/src/window-props.c b/src/window-props.c index a84e25fc8..7c20de50b 100644 --- a/src/window-props.c +++ b/src/window-props.c @@ -687,12 +687,31 @@ static void reload_net_startup_id (MetaWindow *window, MetaPropValue *value) { + guint32 timestamp = window->net_wm_user_time; + MetaWorkspace *workspace = NULL; + g_free (window->startup_id); if (value->type != META_PROP_VALUE_INVALID) window->startup_id = g_strdup (value->v.str); else window->startup_id = NULL; + + /* Update timestamp and workspace on a running window */ + if (!window->constructing) + { + window->initial_timestamp_set = 0; + window->initial_workspace_set = 0; + + 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); + + meta_window_activate_with_workspace (window, timestamp, workspace); + } meta_verbose ("New _NET_STARTUP_ID \"%s\" for %s\n", window->startup_id ? window->startup_id : "unset", diff --git a/src/window.c b/src/window.c index 0d56e69d0..72821bd7e 100644 --- a/src/window.c +++ b/src/window.c @@ -2489,7 +2489,8 @@ unminimize_window_and_all_transient_parents (MetaWindow *window) static void window_activate (MetaWindow *window, guint32 timestamp, - MetaClientType source_indication) + MetaClientType source_indication, + MetaWorkspace *workspace) { gboolean can_ignore_outdated_timestamps; meta_topic (META_DEBUG_FOCUS, @@ -2529,11 +2530,11 @@ window_activate (MetaWindow *window, /* disable show desktop mode unless we're a desktop component */ maybe_leave_show_desktop_mode (window); - /* Get window on current workspace */ - if (!meta_window_located_on_workspace (window, - window->screen->active_workspace)) - meta_window_change_workspace (window, - window->screen->active_workspace); + /* Get window on current or given workspace */ + if (workspace == NULL) + workspace = window->screen->active_workspace; + if (!meta_window_located_on_workspace (window, workspace)) + meta_window_change_workspace (window, workspace); if (window->shaded) meta_window_unshade (window); @@ -2562,7 +2563,19 @@ meta_window_activate (MetaWindow *window, * we were such. If we change the pager behavior later, we could revisit * this and just add extra flags to window_activate. */ - window_activate (window, timestamp, META_CLIENT_TYPE_PAGER); + window_activate (window, timestamp, META_CLIENT_TYPE_PAGER, NULL); +} + +void +meta_window_activate_with_workspace (MetaWindow *window, + guint32 timestamp, + MetaWorkspace *workspace) +{ + /* We're not really a pager, but the behavior we want is the same as if + * we were such. If we change the pager behavior later, we could revisit + * this and just add extra flags to window_activate. + */ + window_activate (window, timestamp, META_CLIENT_TYPE_APPLICATION, workspace); } /* Manually fix all the weirdness explained in the big comment at the @@ -4743,7 +4756,7 @@ meta_window_client_message (MetaWindow *window, /* Client using older EWMH _NET_ACTIVE_WINDOW without a timestamp */ timestamp = meta_display_get_current_time (window->display); - window_activate (window, timestamp, source_indication); + window_activate (window, timestamp, source_indication, NULL); return TRUE; } diff --git a/src/window.h b/src/window.h index e1d93d662..5a6af5851 100644 --- a/src/window.h +++ b/src/window.h @@ -401,6 +401,10 @@ void meta_window_unstick (MetaWindow *window); void meta_window_activate (MetaWindow *window, guint32 current_time); +void meta_window_activate_with_workspace (MetaWindow *window, + guint32 current_time, + MetaWorkspace *workspace); + void meta_window_make_fullscreen (MetaWindow *window); void meta_window_unmake_fullscreen (MetaWindow *window);