Open processing-bot opened 1 year ago
Replied by @icq4ever on Dec 13, 2023, 18:00
I tested with xprop command on linux as follow
xprop -name "sketch_231214a" -f WM_CLASS 8s -set WM_CLASS "Processing"
and confirmed that WM_CLASS added on canvas(running window). now I'm researching how can I add this on source code.
Replied by @icq4ever on Dec 13, 2023, 18:04
https://stackoverflow.com/a/29218320 this thread show where can start point. and similar codes already added here . hmm..
this is the main sketch window maybe ?
I stumbled upon this myself and could reproduce the issue checking with xprop. I'm gonna try to fix it.
@plopez01 I'd love to see this fixed. Even if you don't find a solution, please post what you learn so someone else can build on what you figure out.
Okay, I've done some digging and this is what I got until now.
The first thing I did was track down the window creation when using the P2D or P3D renderer.
When one of this renderers is used a specific implementation of a PSurface
interface is used: PSurfaceJOGL
.
This implementation instead of using AWT to handle window creation, it uses NEWT, a windowing toolkit which is provided by JOGL (the library used to provide OpenGL bindings for Java).
So when initFrame(...)
is called in the PSurfaceJOGL
, window creation is handled by a sub-call to initWindow()
,
NewtFactory.createWindow(...)
,create()
on a specific window implementation, in this case it's very probably jogamp.newt.driver.x11
,WINDOW_CLASS_NAME
field with a default value of "NewtWindow"
, but AFAIK it's not used anywhere, and especially not passed down the window creation pipeline.Pheew, that was a lot of calls, but we finally get to the bottom and we can see the window creation process and especially a call to createJavaWindowProperty(...)
which calls to XChangeProperty
. There are a bunch of calls to this function that set X parameters like the window icon, or set the WM_NAME, which we can see is actually being set to the sketch name right now.
I think the problem is being caused because NEWT doesn't set the WM_CLASS property (maybe they intended at some point because of the unused WINDOW_CLASS_NAME
but never actually got to doing it). This differs from the behaviour with the default renderer which uses the PSurfaceAWT
, in this case X properties I'm guessing are handled by AWT itself and WM_CLASS
is set.
setTitle
.
I could try to create this PR but I don't know if it would be accepted, or how long it would take as it's not just a bug, it expands the public API and would require some thinking on how it should be organized.Please do let me know what you think about this. If missed anything or anyone has any suggestions or comments I will greatly appreciate them!
Funny story
This happened to me the first time I tried to post this comment. Github decieded to play it funny and failed the request to post this comment, when I switched to the "Write" panel to copy what I wrote and try again, it deleted everything, (picture my face thinking I had to write it all again). Then I had a revelation, went to about:processes, looked at the tab PID, went to the Task Manager and dumped the process memory, then I was able to recover all the message from there! (This is actually the second time a memory dump has saved me from losing data). Edit: Later I saw It actually did post my first message... facepalm
Created by: @ColdMacaroni
Description
When running a sketch that uses the P2D or P3D renderer. The WM_CLASS window variable is not set. This makes it difficult (impossible?) to set window rules for the resulting window. (For example, making it so a tiling window manager makes the window float by default, instead of resizing it.)
Expected Behavior
WM_CLASS should be set to
"Processing", "processing-sketch"
or similar. For reference, the main processing app has a WM_CLASS of"Processing", "Processing"
and a sketch with the default renderer has a WM_CLASS of"processing-core-PApplet", "processing-core-PApplet"
.Current Behavior
The WM_CLASS variable is not set. (I don't mean empty, it just doesn't exist)
Steps to Reproduce
xprop
(or another similar tool). To usexprop
, simply run it on a terminal and click on the window. You can also pipe it intogrep
to filter out the other variables:xprop | grep WM_CLASS
Your Environment