From ccd200a2ca089aaa73a673d8e42349d24b004105 Mon Sep 17 00:00:00 2001 From: IgorTimofeev Date: Tue, 20 Sep 2022 16:56:12 +0300 Subject: [PATCH] (KDE only) Fixed window close button disappearing after exiting from fullscreen mode --- .../scala/ocelot/desktop/ui/UiHandler.scala | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/scala/ocelot/desktop/ui/UiHandler.scala b/src/main/scala/ocelot/desktop/ui/UiHandler.scala index 8ed590b..008279c 100644 --- a/src/main/scala/ocelot/desktop/ui/UiHandler.scala +++ b/src/main/scala/ocelot/desktop/ui/UiHandler.scala @@ -89,17 +89,31 @@ object UiHandler extends Logging { Display.setDisplayModeAndFullscreen(Display.getDesktopDisplayMode) } else { + // Updating size from settings val settingsSize = Settings.get.windowSize root.size = if (settingsSize.isSet) Size2D(settingsSize.x, settingsSize.y) else Size2D(800, 600) + // Setting normal display mode (non-fullscreen by default) Display.setDisplayMode(new DisplayMode(root.size.width.toInt, root.size.height.toInt)) + // Updating position from settings if (Settings.get.windowPosition.isSet) Display.setLocation(Settings.get.windowPosition.x, Settings.get.windowPosition.y) } - Display.setFullscreen(value) - Display.setResizable(!value) + // Window should be resizable even in fullscreen mode, because some DEs can hide close button after exit from it. + // But it seems like there's lwjgl bug with internal resizable value caching + // How to reproduce: + // 1) Enter fullscreen mode via setDisplayModeAndFullscreen(...) or setFullScreen(true) + // 2) Set window resizable via setResizable(true) + // 3) Exit from fullscreen mode + // 4) Set window resizable again + // Result: + // Window is not resizable and can't be resized with mouse + // Expected behaviour: + // Window should be resizable + Display.setResizable(false) + Display.setResizable(true) Settings.get.windowFullscreen = value }