Update frame config when needed

Update resizable only when it is really changed as it messes up window
sometimes if fullscreen

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-07-22 14:27:00 +02:00
parent 25ab36d56e
commit 28dd5f477c

View File

@@ -167,7 +167,7 @@ public class ClientUI
return; return;
} }
SwingUtilities.invokeLater(this::updateFrameConfig); SwingUtilities.invokeLater(() -> updateFrameConfig(event.getKey().equals("lockWindowSize")));
} }
@Subscribe @Subscribe
@@ -338,7 +338,7 @@ public class ClientUI
keyManager.registerKeyListener(uiKeyListener); keyManager.registerKeyListener(uiKeyListener);
// Update config // Update config
updateFrameConfig(); updateFrameConfig(true);
// Decorate window with custom chrome and titlebar if needed // Decorate window with custom chrome and titlebar if needed
final boolean withTitleBar = config.enableCustomChrome(); final boolean withTitleBar = config.enableCustomChrome();
@@ -692,7 +692,7 @@ public class ClientUI
} }
} }
private void updateFrameConfig() private void updateFrameConfig(boolean updateResizable)
{ {
if (frame == null) if (frame == null)
{ {
@@ -704,7 +704,11 @@ public class ClientUI
frame.setAlwaysOnTop(config.gameAlwaysOnTop()); frame.setAlwaysOnTop(config.gameAlwaysOnTop());
} }
frame.setResizable(!config.lockWindowSize()); if (updateResizable)
{
frame.setResizable(!config.lockWindowSize());
}
frame.setExpandResizeType(config.automaticResizeType()); frame.setExpandResizeType(config.automaticResizeType());
frame.setContainedInScreen(config.containInScreen() && config.enableCustomChrome()); frame.setContainedInScreen(config.containInScreen() && config.enableCustomChrome());