On Fri, 15 Aug 2025 17:21:03 GMT, Thiago Milczarek Sayao <tsa...@openjdk.org> 
wrote:

>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinWindow.java 
>> line 161:
>> 
>>> 159:             if (minMaxEnforced) {
>>> 160:                 notifyResize(WindowEvent.RESIZE, pw, ph);
>>> 161:             }
>> 
>> Could this lead to two resize commands in some cases? I can see why this new 
>> logic is needed for the case where the window was already at max (or min) 
>> width and height, but if it wasn't already constrained, wouldn't the resize 
>> event have already happened?
>
> The issue is that the Java side updates the property first, and only 
> afterward requests the Glass native side to apply the change. I've found this 
> to cause many problems and I fixed the same way in  #1789 - when the change 
> can't be applied, it notifies back.

> Could this lead to two resize commands in some cases?

Yes, I was trying not to be too clever with my checks. I figured if the second 
notification wasn't necessary it would be benign. At the very least it won't 
trigger invalidation of the window's width and height properties.

I will tighten this up since I have to tweak the code a bit anyway. I just 
verified that on Windows you can alter the size of a maximized window and the 
OS will keep it in the MAXIMIZED state (as it resizes glass calls notifyResize 
with WindowEvent.MAXIMIZED). This PR can kick the window out of the MAXIMIZED 
or MINIMIZED state incorrectly. Unfortunately it puts the window in the wrong 
internal state without updating the maximized or iconified properties so it's 
not easy to write a test to detect this.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1870#discussion_r2279798272

Reply via email to