mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-24 13:02:48 +01:00
Validate window position configuration based on primary display dimensions
This commit is contained in:
parent
d566703325
commit
aefcbcd2c4
@ -94,8 +94,22 @@ object UiHandler extends Logging {
|
||||
Display.setDisplayMode(new DisplayMode(root.size.width.toInt, root.size.height.toInt))
|
||||
|
||||
// Updating position from settings
|
||||
if (Settings.get.windowPosition.isSet)
|
||||
if (Settings.get.windowPosition.isSet) {
|
||||
// the configuration can have incorrect values for coordinates
|
||||
// and that can cause the window to "disappear" from the screen
|
||||
// TODO: after upgrading to LWJGL 3 consider the multi-monitor setups
|
||||
val desktop = Display.getDesktopDisplayMode
|
||||
if (Settings.get.windowPosition.x < -Settings.get.windowSize.x)
|
||||
Settings.get.windowPosition.x = 0
|
||||
if (Settings.get.windowPosition.x > desktop.getWidth)
|
||||
Settings.get.windowPosition.x = desktop.getWidth - Settings.get.windowSize.x
|
||||
if (Settings.get.windowPosition.y < -Settings.get.windowSize.y)
|
||||
Settings.get.windowPosition.y = 0
|
||||
if (Settings.get.windowPosition.y > desktop.getHeight)
|
||||
Settings.get.windowPosition.y = desktop.getHeight - Settings.get.windowSize.y
|
||||
|
||||
Display.setLocation(Settings.get.windowPosition.x, Settings.get.windowPosition.y)
|
||||
}
|
||||
|
||||
// Window should be resizable after exit from fullscreen mode
|
||||
// But it seems like there's lwjgl bug with internal resizable value caching
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user