GNOME Bugzilla – Bug 637745
Use new GLib application API for launching
Last modified: 2011-02-08 16:12:37 UTC
Launch child processes more directly; we retrieve the PID, and use it to keep track of the .desktop file we launched. Now, when we get a window, since the X window has a PID, we have a pretty strong association. .desktop file <-> PID <-> window And can thus map window back to .desktop file.
Created attachment 176827 [details] [review] Use new GLib application API for launching
Created attachment 177709 [details] [review] Use new GLib application API for launching Update for renamed glib API, minor code cleanup.
Review of attachment 177709 [details] [review]: Basically looks fine to commit, just minor commits. ::: src/shell-app-system.c @@ +1392,3 @@ + + ret = g_desktop_app_info_launch_uris_as_manager (gapp, uris, + (GAppLaunchContext*) context, Use a gobjct-style cast @@ +1400,1 @@ g_object_unref (G_OBJECT (gapp)); We don't use the G_OBJECT() cast in this case (g_object_ref/unref take a gpointer for convenience) ::: src/shell-window-tracker.c @@ +394,3 @@ + pid = meta_window_get_pid (window); + + return g_hash_table_lookup (tracker->launched_pid_to_app, GINT_TO_POINTER (pid)); Would rather you didn't hash_table_lookup() the pid == -1 case @@ +848,3 @@ + + if (g_hash_table_lookup (tracker->launched_pid_to_app, + &pid_int)) You want GINT_TO_POINTER. Maybe some comment here indicating when this is expected to happen would be good. /* Might happen on rapid PID use by the OS */ Or something. @@ +856,3 @@ + g_child_watch_add (pid, on_child_exited, NULL); + /* TODO: rescan unassociated windows + * Very unlikely in practice that the launched app gets ahead of us Perhaps better expressed as _somewhat_ unlikely
Attachment 177709 [details] pushed as a138f59 - Use new GLib application API for launching