Set missing WM_COMMAND using pid given from libXRes
commitd902477efdfb15466da6644fb1a944c20a935c6c
authorDavid Maciejak <david.maciejak@gmail.com>
Mon, 20 Feb 2023 12:02:28 +0000 (20 20:02 +0800)
committerCarlos R. Mafra <crmafra@gmail.com>
Mon, 20 Feb 2023 15:00:55 +0000 (20 15:00 +0000)
tree4bb6a561cdb2fc34bfef1da4bbd4d6d9b4aac798
parent5ee19c2308b85ab23a8d3644e3cb1d547009a6a3
Set missing WM_COMMAND using pid given from libXRes

For apps which are not setting the window WM_COMMAND property like those old
apps using Motif toolkit (I am thinking of NEdit for example)
it's bringing some issues in windowmaker which is relying on it for a few interactions.
Especially,
*an app without WM_COMMAND will not be saved during the workspace state
(so session restore is not working for them)
*when added to the dock, the settings parameters are empty and need to be filled
*cannot autostart from the dock (even if the settings are manually filled and saved)
*right click on the app titlebar, and choosing Launch has no effect

Most of the time, those apps are also not setting the X11_NET_WM_PID property.
With the pid we could have a chance to find the running program.
To link a window to a pid, there is the X11 Resource extension library (libXRes).
After checking, gnome and xfce are also using the same method to handle such issues.

The patch is checking if the libXRes is present on the system (but it's not mandatory to compile).
Then, it adds a layer on top of wNETWMGetPidForWindow to not only check the window property
but if necessary to get the underlying pid from libXRes if available.
That's solving the points mentioned above.
configure.ac
m4/wm_xext_check.m4
src/main.c
src/window.c