Commit 49c1a33a authored by Olivier Fourdan's avatar Olivier Fourdan 🛠
Browse files

client: Rely in XRes reported PID is available



When xfwm4 needs to kill an unresponsive client, it will use the its PID
is known.

However, the _NET_WM_PID as defined in the extended window manager hint
mechanism is unreliable when the client runs within a sandbox, as it is
the client itself who sets that property using its own view of the PID.

The Xserver can provide a more accurate value of the client PID using
the XRes X11 extension, so use that protocol if available.

Signed-off-by: Olivier Fourdan's avatarOlivier Fourdan <fourdan@xfce.org>
parent 010f8281
......@@ -17,7 +17,7 @@
oroborus - (c) 2001 Ken Lynch
xfwm4 - (c) 2002-2011 Olivier Fourdan
xfwm4 - (c) 2002-2020 Olivier Fourdan
*/
......@@ -1793,9 +1793,8 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
clientAddUserTimeWin (c);
clientGetUserTime (c);
/*client PID */
getHint (display_info, c->window, NET_WM_PID, (long *) &pid);
c->pid = (GPid) pid;
/* client PID */
c->pid = getWindowPID (display_info, c->window);
TRACE ("client \"%s\" (0x%lx) PID = %i", c->name, c->window, c->pid);
/* Apply startup notification properties if available */
......
......@@ -17,7 +17,7 @@
oroborus - (c) 2001 Ken Lynch
xfwm4 - (c) 2002-2015 Olivier Fourdan
xfwm4 - (c) 2002-2020 Olivier Fourdan
*/
......@@ -581,6 +581,8 @@ handleKeyPress (DisplayInfo *display_info, XfwmEventKey *event)
static eventFilterStatus
handleKeyRelease (DisplayInfo *display_info, XfwmEventKey *event)
{
Client *c;
TRACE ("entering");
/* Release pending events */
......@@ -1621,6 +1623,7 @@ handleFocusIn (DisplayInfo *display_info, XFocusChangeEvent * ev)
}
}
return EVENT_FILTER_REMOVE;
}
......@@ -1804,11 +1807,12 @@ handlePropertyNotify (DisplayInfo *display_info, XPropertyEvent * ev)
}
else if (ev->atom == display_info->atoms[NET_WM_PID])
{
long pid;
TRACE ("client \"%s\" (0x%lx) has received a NET_WM_PID notify", c->name, c->window);
getHint (display_info, c->window, NET_WM_PID, (long *) &pid);
c->pid = (GPid) pid;
TRACE ("client \"%s\" (0x%lx) updated PID = %i", c->name, c->window, c->pid);
if (c->pid == 0)
{
c->pid = getWindowPID (display_info, c->window);
TRACE ("client \"%s\" (0x%lx) updated PID = %i", c->name, c->window, c->pid);
}
}
else if (ev->atom == display_info->atoms[NET_WM_WINDOW_OPACITY])
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment