-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On Windows and on OSX with the default renderer, Sketch windows will open behind other windows #5
Comments
Commit 4cf255b is an ugly hack but alleviates the symptoms of this bug. That change needs to be removed when this bug gets a real fix. |
Windows had the same problem and the ugly hack was expanded to include Windows also. However, on Windows, when using the P2D renderer, forcing the window to be on top somehow triggers Processing to think the window was resized. When the window is resized, it re-applies the background color. This will overwrite any drawing activity that took place in setup. |
I investigated this further and I see that in Processing, the below code using an Open GL renderer has a problem on any OS:
The screen gets reset to the background color when I dug into the Processing code and I highly suspect the bug is in Jogamp, not Processing. I doubt a fix will happen and most likely I will need to add a workaround to py5 to alleviate these symptoms. |
Continued from here: processing/processing4#261
Well, that's just my example demo'ing the issue. If you draw to the window in In any case, here's where this is actually coming up: On Windows in py5, for whatever reason the Sketch window always opens behind other Windows. It's not Processing's fault, it must have something to do with the interaction between jpype and Processing. These kinds of idiosyncrasies appear now and then, and I need to write some code in py5 to smooth things out. Calling I could add some code to cache the pixels between the end of |
I see what you mean about "compounding a hack." I suspect that JOGL might possibly have been compounding a hack on native window managers: https://jogamp.org/bugzilla/show_bug.cgi?id=1222 If the native manager only supports level assignment on window creation, then the only way that you can change the level is to recreate the window.
Again, I haven't traced things through JOGL, but there is a chance that the content is disappearing precisely because they can't change the native window object, they can only destroy and recreate it. Which means, if they (JOGL) aren't copying your content forward when they do that, then you may have to.... |
Ha -- just noticed that the 2015 |
Interesting, and great research! This is helpful.
I understand what you are saying. Caching the pixels between
That's beautiful! |
@jeremydouglass I fixed this. And the reality of what JOGL is doing is even uglier than what we previously thought. Previously I was making two calls to
I tried implementing code to capture the pixels after A side effect of this is that on Windows, while using an OpenGL renderer, if the user makes their own call to While investigating this I observed that without any calls to |
An alternative approach is to get the window handle and use a Python automation library to click on the window or somehow move it to the front. I don't like this idea so much either as it would add a new package dependency to py5 to facilitate a hack, but since a hack of some kind is necessary, I would consider it. Do you know of any good Python automation libraries that would be good candidate for this? |
woohoo!
Got it. A headache, but a solution. One question -- where does the Windows+OpenGL
I'm not sure. Honestly, I'd support your instinct to avoid the added dependencies, partly because you'd probably need multiple OS-specific click libraries (unless you only need this for Windows, maybe pywinauto?), but especially because click-based solutions may be unreliable and may also introduce inconsistent focus problems (some paths / methods give the clicked window focus, some don't, results unreliable). But if there is a silver bullet out there, I hope you find it. |
Windows == headaches
It is in
Right, I'd only need it for Windows, so perhaps it wouldn't be that bad. I agree that click based solutions are unreliable, but maybe I can do something if I get the handle id? I don't know. In any case, I'm happy with this solution for now and will re-address it again at a later date. |
On OSX Sketches using the default renderer to not get focus on sketch start. The Sketch window will be behind other windows, forcing me to hunt for it. The window will not have a dock icon I can click on to bring it to the front.
Steps to reproduce:
jupyter console
) and the Sketch is behind the terminal window, and the terminal window has focus and is partially transparent, I can still interact with the Sketch. The above Sketch will respond to mouse movements through the terminal window. This is only the case when the window first opens; if it gets focus and loses it, it won't happen anymore. It is as if the window knows it should have focus but does not.The text was updated successfully, but these errors were encountered: