Can we make the window undecorated at runtime in w...
# compose-desktop
m
Can we make the window undecorated at runtime in windows? I'm getting an error saying that the window is displayable, I want to add a full-screen option, and I'm trying to avoid creating a new window for full screen.
m
It's working fine for macos but not for windows. I need to create a seperate window for full screen to set
undecorated
to true.
The transition to full screen is not that smooth because I'm creating a new window, I'm trying to figure out a way to change
undecorated
at runtime without causing a crash.
i
Swing which we use as implementation doesn't support changing
undecorated
after the window is visible (maybe the native API as well, not sure). We can support changing
undecorated
on the Compose level, but we would also recreate the whole window (though, we can keep the content/composition state intact)
r
You could achieve this using win32 directly. This is not too crazy to achieve with JNA. You'll want to call SetWindowLongPtr and explore setting GWL_STYLE.
Copy code
User32.INSTANCE.SetWindowLongPtr(hWnd, WinUser.GWL_STYLE, TheNewStyleHere)
I believe a zero value will give you a plain, undecorated window. You'd want to store the previous value (via GetWindowLongPtr) in order to swap back to it. https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles
This can be done at runtime. Not sure why Swing wouldn't expose it.