mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2026-01-06 11:12:39 +01:00
Allow to turn off window position validation
This commit is contained in:
parent
aefcbcd2c4
commit
169a8dda70
@ -4,18 +4,24 @@
|
||||
ocelot {
|
||||
sound {
|
||||
# Volume level for all sounds in Ocelot. Ranges from 0.0 to 1.0
|
||||
# Set to 0.0 o disable sound completely.
|
||||
# Set to 0.0 to disable sound completely.
|
||||
volumeMaster: 1.0
|
||||
|
||||
# Volume level for computer case beeps. Ranges from 0.0 to 1.0
|
||||
# Set to 0.0 o disable sound completely.
|
||||
# Set to 0.0 to disable sound completely.
|
||||
volumeBeep: 0.4
|
||||
|
||||
# Volume level for environmental sounds (like computer fans or HDD activity). Ranges from 0.0 to 1.0
|
||||
# Set to 0.0 o disable sound completely.
|
||||
# Set to 0.0 to disable sound completely.
|
||||
volumeEnvironment: 1.0
|
||||
}
|
||||
|
||||
window {
|
||||
# This will prevent the Ocelot window from "disappearing" from the primary monitor.
|
||||
# But that can also mess with multi-monitor setup. Feel free to turn it off in that case.
|
||||
validatePosition: true
|
||||
}
|
||||
|
||||
workspace {
|
||||
# If true, "node-related" windows (like screens, computer case details, etc.) would
|
||||
# stick to the workspace and keep their relative position to node blocks whenever
|
||||
|
||||
@ -19,6 +19,7 @@ class Settings(val config: Config) extends SettingsData {
|
||||
|
||||
windowSize = config.getInt2D("ocelot.window.size")
|
||||
windowPosition = config.getInt2D("ocelot.window.position")
|
||||
windowValidatePosition = config.getBooleanOrElse("ocelot.window.validatePosition", true)
|
||||
windowFullscreen = config.getBooleanOrElse("ocelot.window.fullscreen", default = false)
|
||||
|
||||
// Windows uses life-hack when it sets position to (-8,-8) for maximized windows to hide the frame.
|
||||
@ -129,6 +130,7 @@ object Settings extends Logging {
|
||||
.withValuePreserveOrigin("ocelot.sound.volumeEnvironment", settings.volumeEnvironment)
|
||||
.withValuePreserveOrigin("ocelot.sound.volumeInterface", settings.volumeInterface)
|
||||
.withValue("ocelot.window.position", settings.windowPosition)
|
||||
.withValuePreserveOrigin("ocelot.window.validatePosition", settings.windowValidatePosition)
|
||||
.withValue("ocelot.window.size", settings.windowSize)
|
||||
.withValuePreserveOrigin("ocelot.window.fullscreen", settings.windowFullscreen)
|
||||
.withValue("ocelot.workspace.recent", settings.recentWorkspace)
|
||||
|
||||
@ -95,19 +95,20 @@ object UiHandler extends Logging {
|
||||
|
||||
// Updating position from settings
|
||||
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
|
||||
|
||||
if (Settings.get.windowValidatePosition) {
|
||||
// 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)
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ class SettingsData {
|
||||
|
||||
var windowSize: Int2D = new Int2D()
|
||||
var windowPosition: Int2D = new Int2D()
|
||||
var windowValidatePosition: Boolean = true
|
||||
var windowFullscreen: Boolean = false
|
||||
|
||||
var recentWorkspace: Option[String] = None
|
||||
@ -32,6 +33,7 @@ class SettingsData {
|
||||
this.volumeInterface = data.volumeInterface
|
||||
|
||||
this.windowPosition = data.windowPosition
|
||||
this.windowValidatePosition = data.windowValidatePosition
|
||||
this.windowSize = data.windowSize
|
||||
this.windowFullscreen = data.windowFullscreen
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user