Fix ShellAppSystem's use of no_focus_window, clean up state handling

First, we were passing an incorrect timestamp to
meta_display_focus_the_no_focus_window - fix that.

The invocation of set_focus_app to the started app there couldn't
really work, because (if the above call had worked) we'd get the
X reply *after* the started app.

What we need to untangle here is the distinction that's now made in
ShellApp between _STATE_STARTING and _STATE_RUNNING.  A nice way to
start doing this is to rebase ShellWindowTracker to only be concerned
with app states.  Concretely, the current "has windows implies
running" logic now lives just inside shell-app.c.

Rename the app-running-changed signal to be app-state-changed.  This
will ultimately be useful so that inside the panel, we can track
the last started app.

https://bugzilla.gnome.org/show_bug.cgi?id=620899
This commit is contained in:
Colin Walters
2010-06-07 16:31:30 -04:00
parent 3fe7b13959
commit e4a6bf994f
6 changed files with 45 additions and 40 deletions

View File

@ -313,9 +313,9 @@ increment_usage_for_app (ShellAppUsage *self,
}
static void
on_app_running_changed (ShellWindowTracker *tracker,
ShellApp *app,
gpointer user_data)
on_app_state_changed (ShellWindowTracker *tracker,
ShellApp *app,
gpointer user_data)
{
ShellAppUsage *self = SHELL_APP_USAGE (user_data);
UsageData *usage;
@ -326,7 +326,7 @@ on_app_running_changed (ShellWindowTracker *tracker,
usage = get_usage_for_app (self, app);
running = shell_app_get_n_windows (app) > 0;
running = shell_app_get_state (app) == SHELL_APP_STATE_RUNNING;
usage->last_seen = get_time ();
}
@ -389,7 +389,7 @@ shell_app_usage_init (ShellAppUsage *self)
tracker = shell_window_tracker_get_default ();
g_signal_connect (tracker, "notify::focus-app", G_CALLBACK (on_focus_app_changed), self);
g_signal_connect (tracker, "app-running-changed", G_CALLBACK (on_app_running_changed), self);
g_signal_connect (tracker, "app-state-changed", G_CALLBACK (on_app_state_changed), self);
session_bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
self->session_proxy = dbus_g_proxy_new_for_name (session_bus, "org.gnome.SessionManager",