window-tracker: remove now unused launched_pid_to_app

https://bugzilla.gnome.org/show_bug.cgi?id=736527
This commit is contained in:
Sebastian Keller 2014-12-08 20:12:03 +01:00 committed by Jasper St. Pierre
parent 186f9b2e2c
commit 01c6392c13
2 changed files with 2 additions and 60 deletions

View File

@ -1300,24 +1300,6 @@ shell_app_request_quit (ShellApp *app)
return TRUE; return TRUE;
} }
static void
_gather_pid_callback (GDesktopAppInfo *gapp,
GPid pid,
gpointer data)
{
ShellApp *app;
ShellWindowTracker *tracker;
g_return_if_fail (data != NULL);
app = SHELL_APP (data);
tracker = shell_window_tracker_get_default ();
_shell_window_tracker_add_child_process_app (tracker,
pid,
app);
}
#ifdef HAVE_SYSTEMD #ifdef HAVE_SYSTEMD
/* This sets up the launched application to log to the journal /* This sets up the launched application to log to the journal
* using its own identifier, instead of just "gnome-session". * using its own identifier, instead of just "gnome-session".
@ -1369,13 +1351,13 @@ shell_app_launch (ShellApp *app,
ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL, ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL,
context, context,
G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, G_SPAWN_SEARCH_PATH,
#ifdef HAVE_SYSTEMD #ifdef HAVE_SYSTEMD
app_child_setup, (gpointer)shell_app_get_id (app), app_child_setup, (gpointer)shell_app_get_id (app),
#else #else
NULL, NULL, NULL, NULL,
#endif #endif
_gather_pid_callback, app, NULL, NULL,
error); error);
g_object_unref (context); g_object_unref (context);

View File

@ -47,9 +47,6 @@ struct _ShellWindowTracker
/* <MetaWindow * window, ShellApp *app> */ /* <MetaWindow * window, ShellApp *app> */
GHashTable *window_to_app; GHashTable *window_to_app;
/* <int, ShellApp *app> */
GHashTable *launched_pid_to_app;
}; };
G_DEFINE_TYPE (ShellWindowTracker, shell_window_tracker, G_TYPE_OBJECT); G_DEFINE_TYPE (ShellWindowTracker, shell_window_tracker, G_TYPE_OBJECT);
@ -631,8 +628,6 @@ shell_window_tracker_init (ShellWindowTracker *self)
self->window_to_app = g_hash_table_new_full (g_direct_hash, g_direct_equal, self->window_to_app = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) g_object_unref); NULL, (GDestroyNotify) g_object_unref);
self->launched_pid_to_app = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_object_unref);
screen = shell_global_get_screen (shell_global_get ()); screen = shell_global_get_screen (shell_global_get ());
g_signal_connect (G_OBJECT (screen), "startup-sequence-changed", g_signal_connect (G_OBJECT (screen), "startup-sequence-changed",
@ -648,7 +643,6 @@ shell_window_tracker_finalize (GObject *object)
ShellWindowTracker *self = SHELL_WINDOW_TRACKER (object); ShellWindowTracker *self = SHELL_WINDOW_TRACKER (object);
g_hash_table_destroy (self->window_to_app); g_hash_table_destroy (self->window_to_app);
g_hash_table_destroy (self->launched_pid_to_app);
G_OBJECT_CLASS (shell_window_tracker_parent_class)->finalize(object); G_OBJECT_CLASS (shell_window_tracker_parent_class)->finalize(object);
} }
@ -717,40 +711,6 @@ shell_window_tracker_get_app_from_pid (ShellWindowTracker *tracker,
return result; return result;
} }
static void
on_child_exited (GPid pid,
gint status,
gpointer unused_data)
{
ShellWindowTracker *tracker;
tracker = shell_window_tracker_get_default ();
g_hash_table_remove (tracker->launched_pid_to_app, GINT_TO_POINTER((gint)pid));
}
void
_shell_window_tracker_add_child_process_app (ShellWindowTracker *tracker,
GPid pid,
ShellApp *app)
{
gpointer pid_ptr = GINT_TO_POINTER((int)pid);
if (g_hash_table_lookup (tracker->launched_pid_to_app,
&pid_ptr))
return;
g_hash_table_insert (tracker->launched_pid_to_app,
pid_ptr,
g_object_ref (app));
g_child_watch_add (pid, on_child_exited, NULL);
/* TODO: rescan unassociated windows
* Unlikely in practice that the launched app gets ahead of us
* enough to map an X window before we get scheduled after the fork(),
* but adding this note for future reference.
*/
}
static void static void
set_focus_app (ShellWindowTracker *tracker, set_focus_app (ShellWindowTracker *tracker,
ShellApp *new_focus_app) ShellApp *new_focus_app)