Fix Windows-specific glitches

This commit is contained in:
Alex Spataru 2021-11-18 23:43:12 -06:00
parent b08c6954e3
commit fae3c56c27
3 changed files with 30 additions and 25 deletions

View File

@ -103,6 +103,35 @@ Window {
property alias minimizeEnabled: _title.minimizeEnabled
property alias maximizeEnabled: _title.maximizeEnabled
//
// Ensure that window size & position is valid upon showing
//
Component.onCompleted: {
// Reset window size for whatever reason
if (root.width <= 0 || root.height <= 0) {
root.width = root.minimumWidth
root.height = root.minimumHeight
}
// Startup verifications to ensure that app is displayed inside the screen
if (root.x < 0 || root.x >= Screen.desktopAvailableWidth)
root.x = 100
if (root.y < 0 || root.y >= Screen.desktopAvailableHeight)
root.y = 100
// Startup verifications to ensure that app fits in current screen
if (root.width > Screen.desktopAvailableWidth) {
root.x = 100
root.width = Screen.desktopAvailableWidth - root.x
}
// Startup verifications to ensure that app fits in current screen
if (root.height > Screen.desktopAvailableHeight) {
root.y = 100
root.height = Screen.desktopAvailableHeight - root.y
}
}
//
// Shadow implementation
//

View File

@ -82,30 +82,6 @@ FramelessWindow.CustomWindow {
// Displays the main window & checks for updates
//
function showMainWindow() {
// Reset window size for whatever reason
if (root.width <= 0 || root.height <= 0) {
root.width = root.minimumWidth
root.height = root.minimumHeight
}
// Startup verifications to ensure that app is displayed inside the screen
if (root.x < 0 || root.x >= Screen.desktopAvailableWidth)
root.x = 100
if (root.y < 0 || root.y >= Screen.desktopAvailableHeight)
root.y = 100
// Startup verifications to ensure that app fits in current screen
if (root.width > Screen.desktopAvailableWidth) {
root.x = 100
root.width = Screen.desktopAvailableWidth - root.x
}
// Startup verifications to ensure that app fits in current screen
if (root.height > Screen.desktopAvailableHeight) {
root.y = 100
root.height = Screen.desktopAvailableHeight - root.y
}
// Increment app launch count & hide splash screen
++appLaunchCount
Cpp_ModuleManager.hideSplashscreen()

View File

@ -99,7 +99,7 @@ Item {
// Donations dialog
//
Loader {
asynchronous: true
asynchronous: false
sourceComponent: Windows.Donate {
Component.onCompleted: app.donations = this
}