From eb0a0fcf2f14f6efc46922fb5dca151b232eeb41 Mon Sep 17 00:00:00 2001 From: APTX Date: Tue, 22 Feb 2022 00:41:24 +0900 Subject: [PATCH] Revert "Add borderless fullscreen" The borderless fullscreen change does not work in KDE. The change was only ever made to workaround AMD drivers. This reverts commit b42eac3af35c4e7f705c32c30c98159f7d56b6e3. --- .../qml/PlayerControls.qml | 27 ++++- uiplugins/ui_desktop_qml_default/qml/main.qml | 106 +----------------- 2 files changed, 29 insertions(+), 104 deletions(-) diff --git a/uiplugins/ui_desktop_qml_default/qml/PlayerControls.qml b/uiplugins/ui_desktop_qml_default/qml/PlayerControls.qml index c9a1301..f00bd55 100644 --- a/uiplugins/ui_desktop_qml_default/qml/PlayerControls.qml +++ b/uiplugins/ui_desktop_qml_default/qml/PlayerControls.qml @@ -115,7 +115,11 @@ Flow { text: "FS" checkable: true onCheckedChanged: { - controlledWindow.borderlessFullScreen = checked + if (!checked) { + controlledWindow.showNormal(); + } else { + controlledWindow.showFullScreen(); + } } } BasicButton { @@ -123,14 +127,31 @@ Flow { text: "OnTop" enabled: !controlledWindow.isFullScreen() checkable: true - onCheckedChanged: controlledWindow.stayOnTop = checked + onCheckedChanged: { + if (!checked) { + controlledWindow.flags = controlledWindow.flags & ~Qt.WindowStaysOnTopHint + } else { + controlledWindow.flags = controlledWindow.flags + | Qt.WindowStaysOnTopHint + | Qt.WindowTitleHint + | Qt.WindowSystemMenuHint + | Qt.WindowMinMaxButtonsHint + | Qt.WindowCloseButtonHint + } + } } BasicButton { id: framelessButton text: "Frameless" enabled: !controlledWindow.isFullScreen() checkable: true - onCheckedChanged: controlledWindow.borderless = checked + onCheckedChanged: { + if (!checked) { + controlledWindow.flags = controlledWindow.flags & ~Qt.FramelessWindowHint + } else { + controlledWindow.flags = controlledWindow.flags | Qt.FramelessWindowHint + } + } } SeekSlider { width: 800 diff --git a/uiplugins/ui_desktop_qml_default/qml/main.qml b/uiplugins/ui_desktop_qml_default/qml/main.qml index 22af8a0..11a7b94 100644 --- a/uiplugins/ui_desktop_qml_default/qml/main.qml +++ b/uiplugins/ui_desktop_qml_default/qml/main.qml @@ -1,5 +1,5 @@ +import QtQuick.Window 2.2 import org.aptx.aniplayer 1.0 -import QtQuick.Window 2.13 import QtQuick 2.7 Window { @@ -7,124 +7,28 @@ Window { width: 300 height: 300 property bool controlsVisible: true - property bool borderlessFullScreen: false - property bool stayOnTop: false - property bool borderless: false - - title: player.displayTitle + //property Visibility previousVisibility: Window.Normal Component.onCompleted: { loadSettings(); window.visible = true } - // TODO remove this once QTBUG-47917/QTCREATORBUG-13347 is actually fixed - // @disable-check M16 onClosing: saveSettings() function isFullScreen() { - return visibility === Window.FullScreen || borderlessFullScreen - } - - StateGroup { - states: [ - State { - name: "borderlessFullScreen" - when: borderlessFullScreen - PropertyChanges { - target: window - borderless: true - stayOnTop: true - x: screen.virtualX - y: screen.virtualY - width: screen.width - height: screen.height - } - }, - State { - name: "borderlessFullScreenInactive" - when: borderlessFullScreen && !active - extend: "borderlessFullScreen" - PropertyChanges { - target: window - stayOnTop: false - } - } - ] - } -/* - onBorderlessFullScreenChanged: { - if (borderlessFullScreen) { - console.log("Turnning borderlessFullScreen on"); - console.log("Window.x: ", x); - console.log("Window.y: ", y); - console.log("Window.width: ", width); - console.log("Window.height: ", height); - nonFullScreenData.x = x; - nonFullScreenData.y = y; - nonFullScreenData.width = width; - nonFullScreenData.height = height; - nonFullScreenData.stayOnTop = stayOnTop; - nonFullScreenData.borderless = borderless; - - borderless = true; - stayOnTop = true; - x = screen.virtualX; - y = screen.virtualY; - console.log("Screen: ", screen); - console.log("Screen.w: ", screen.width); - console.log("Screen.h: ", screen.height); - width = screen.width; - height = screen.height; - } else { - console.log("Turnning borderlessFullScreen off"); - console.log("x: ", x); - console.log("y: ", y); - console.log("width: ", width); - console.log("height: ", height); - width = nonFullScreenData.width; - height = nonFullScreenData.height; - x = nonFullScreenData.x; - y = nonFullScreenData.y; - borderless = nonFullScreenData.borderless; - stayOnTop = nonFullScreenData.stayOnTop; - } - } -*/ - onBorderlessChanged: { - if (borderless) { - flags = flags | Qt.FramelessWindowHint - } else { - flags = flags & ~Qt.FramelessWindowHint - } - } - - onStayOnTopChanged: { - if (stayOnTop) { - flags = flags - | Qt.WindowStaysOnTopHint - | Qt.WindowTitleHint - | Qt.WindowSystemMenuHint - | Qt.WindowMinMaxButtonsHint - | Qt.WindowCloseButtonHint - } else { - flags = flags & ~Qt.WindowStaysOnTopHint - } + return visibility === Window.FullScreen } function saveSettings() { console.log("Saving settings"); - controls.saveSettings(); - // Exit fullscreen here to save geometry without fullscreen - // Fullscreen enabled/disabled state is saved by controls - window.borderlessFullScreen = false; settings.savePlayerState(player); settings.set("x", x); settings.set("y", y); settings.set("width", width); settings.set("height", height); settings.set("controlsVisible", controls.visible); - + controls.saveSettings(); } function loadSettings() { @@ -216,7 +120,7 @@ Window { else if (mouse.button === Qt.MiddleButton) player.togglePlay(); } - cursorShape: !controls.visible && window.isFullScreen() ? Qt.BlankCursor : Qt.ArrowCursor; + cursorShape: !controls.visible && window.visibility === Window.FullScreen ? Qt.BlankCursor : Qt.ArrowCursor; } DropArea { -- 2.52.0