Discussion:
Undecorated Stages should display minimize & maximize animations on Windows
Fluid Logix
2018-10-09 04:24:48 UTC
Permalink
As the title says. Currently, undecorated Stages on Windows just instantly
disappear/appear when iconified/maximized. This looks quite unprofessional.

In addition to this, undecorated Stages cannot be minimized/restored by
clicking the taskbar-icon, without some JNA hackery.

For more details, see this StackOverflow post:
https://stackoverflow.com/questions/51008461/javafx-minimizing-maximing-undecorated-stage-with-animations
Michael Ennen
2018-10-09 05:37:32 UTC
Permalink
I am not familiar with Windows styling but looking at the native code in
the Stackoverflow
answer it seems that it's a matter of setting the bit mask for
"WS_MINIMIZEBOX" for the
window? Looking at the native code:

https://github.com/javafxports/openjdk-jfx/blob/develop/modules/javafx.graphics/src/main/native-glass/win/GlassWindow.cpp#L1233

In com.sun.glass.ui.Window there are different types of windows:

https://github.com/javafxports/openjdk-jfx/blob/develop/modules/javafx.graphics/src/main/java/com/sun/glass/ui/Window.java#L114

I believe that the UTILITY mask corresponds to an undecorated stage, but am
not positive.
However, "WS_MINIMIZEBOX" is only set when:

if (mask & com_sun_glass_ui_Window_MINIMIZABLE) {
dwStyle |= WS_MINIMIZEBOX;
}

In other words, when the Window.MINIMIZABLE bit mask is set.

I am not sure if it is as simple as adding:

if (mask & com_sun_glass_ui_Window_UTILITY) {
dwStyle |= WS_MINIMIZEBOX;
dwExStyle |= WS_EX_TOOLWINDOW;
}

It looks like the Electron developers have already encountered a similar
issue
and done all of the research necessary:

https://github.com/electron/electron/issues/751
https://github.com/electron/electron/pull/800

If someone was motivated enough it should be possible to fix this behavior
by
applying the approach used above at the places I outlined in the OpenJFX
source.

Cheers,
Michael Ennen
Post by Fluid Logix
As the title says. Currently, undecorated Stages on Windows just instantly
disappear/appear when iconified/maximized. This looks quite unprofessional.
In addition to this, undecorated Stages cannot be minimized/restored by
clicking the taskbar-icon, without some JNA hackery.
https://stackoverflow.com/questions/51008461/javafx-minimizing-maximing-undecorated-stage-with-animations
Loading...