https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
m

mohamed rejeb

02/28/2024, 6:29 AM
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

mohamed rejeb

02/28/2024, 9:31 AM
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

Igor Demin

02/28/2024, 11:54 AM
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

rob42

02/28/2024, 7:02 PM
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.
3 Views