mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
window: Use client PID for meta_window_get_pid()
The shell uses the PID of windows to map them to apps or to find out which window/app triggered a dialog. It currently fails to do that in some situations on Wayland, because meta_window_get_pid() only returns a valid PID for x11 clients. So use the client PID instead of the X11-exclusive _NET_WM_PID property to find out the PID of the process that started the window. We can do that by simply renaming the already existing meta_window_get_client_pid() API to meta_window_get_pid() and moving the old API providing the _NET_WM_PID to meta_window_get_netwm_pid(). https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1180
This commit is contained in:
parent
11f224f4b0
commit
dac09a8e23
@ -95,7 +95,7 @@ meta_window_delete (MetaWindow *window,
|
||||
void
|
||||
meta_window_kill (MetaWindow *window)
|
||||
{
|
||||
pid_t pid = meta_window_get_client_pid (window);
|
||||
pid_t pid = meta_window_get_pid (window);
|
||||
|
||||
if (pid > 0)
|
||||
{
|
||||
|
@ -821,8 +821,6 @@ gboolean meta_window_handle_ui_frame_event (MetaWindow *window,
|
||||
void meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||
const ClutterEvent *event);
|
||||
|
||||
uint32_t meta_window_get_client_pid (MetaWindow *window);
|
||||
|
||||
void meta_window_get_client_area_rect (const MetaWindow *window,
|
||||
cairo_rectangle_int_t *rect);
|
||||
void meta_window_get_titlebar_rect (MetaWindow *window,
|
||||
|
@ -902,7 +902,7 @@ meta_window_update_sandboxed_app_id (MetaWindow *window)
|
||||
|
||||
g_clear_pointer (&window->sandboxed_app_id, g_free);
|
||||
|
||||
pid = meta_window_get_client_pid (window);
|
||||
pid = meta_window_get_pid (window);
|
||||
|
||||
if (pid == 0)
|
||||
return;
|
||||
@ -7584,7 +7584,7 @@ meta_window_get_transient_for (MetaWindow *window)
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_client_pid:
|
||||
* meta_window_get_pid:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Returns the pid of the process that created this window, if available
|
||||
@ -7593,26 +7593,11 @@ meta_window_get_transient_for (MetaWindow *window)
|
||||
* Return value: the pid, or 0 if not known.
|
||||
*/
|
||||
uint32_t
|
||||
meta_window_get_client_pid (MetaWindow *window)
|
||||
{
|
||||
return META_WINDOW_GET_CLASS (window)->get_client_pid (window);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_pid:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* Returns pid of the process that created this window, if known (obtained from
|
||||
* the _NET_WM_PID property).
|
||||
*
|
||||
* Return value: the pid, or -1 if not known.
|
||||
*/
|
||||
int
|
||||
meta_window_get_pid (MetaWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (META_IS_WINDOW (window), -1);
|
||||
g_return_val_if_fail (META_IS_WINDOW (window), 0);
|
||||
|
||||
return window->net_wm_pid;
|
||||
return META_WINDOW_GET_CLASS (window)->get_client_pid (window);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -328,7 +328,7 @@ META_EXPORT
|
||||
guint32 meta_window_get_user_time (MetaWindow *window);
|
||||
|
||||
META_EXPORT
|
||||
int meta_window_get_pid (MetaWindow *window);
|
||||
uint32_t meta_window_get_pid (MetaWindow *window);
|
||||
|
||||
META_EXPORT
|
||||
const char *meta_window_get_client_machine (MetaWindow *window);
|
||||
|
@ -713,7 +713,7 @@ window_created_cb (MetaDisplay *display,
|
||||
{
|
||||
/* Ignore all internal windows */
|
||||
if (!window->xwindow ||
|
||||
meta_window_get_client_pid (window) == getpid ())
|
||||
meta_window_get_pid (window) == getpid ())
|
||||
return;
|
||||
|
||||
manager->x11_windows = g_list_prepend (manager->x11_windows, window);
|
||||
|
Loading…
Reference in New Issue
Block a user