diff --git a/frame/dsutility.cpp b/frame/dsutility.cpp index c90e51911..fc2d74fb1 100644 --- a/frame/dsutility.cpp +++ b/frame/dsutility.cpp @@ -32,11 +32,15 @@ class UtilityPrivate : public DObjectPrivate Utility *Utility::instance() { static Utility* g_instance = nullptr; + auto platformName = QGuiApplication::platformName(); if (g_instance == nullptr) { + if (QStringLiteral("wayland") == platformName) { + g_instance = new Utility(); + } #ifdef BUILD_WITH_X11 - g_instance = new X11Utility(); -#else - g_instance = new Utility(); + else if (QStringLiteral("xcb") == platformName) { + g_instance = new X11Utility(); + } #endif } return g_instance; diff --git a/frame/qml/PanelMenu.qml b/frame/qml/PanelMenu.qml index bde630dd7..b0cfe0faa 100644 --- a/frame/qml/PanelMenu.qml +++ b/frame/qml/PanelMenu.qml @@ -64,9 +64,9 @@ Item { { if (!menuWindow) return - - menuWindow.currentItem = null + menuWindow.close() + menuWindow.currentItem = null } Connections { diff --git a/frame/qml/PanelMenuWindow.qml b/frame/qml/PanelMenuWindow.qml index ad383058b..f27ea6a88 100644 --- a/frame/qml/PanelMenuWindow.qml +++ b/frame/qml/PanelMenuWindow.qml @@ -8,5 +8,5 @@ import QtQuick.Window 2.15 PanelPopupWindow { id: root - flags: Qt.Tool | Qt.X11BypassWindowManagerHint | Qt.WindowStaysOnTopHint + flags: (Qt.platform.pluginName === "xcb" ? Qt.Tool | Qt.X11BypassWindowManagerHint : Qt.ToolTip) | Qt.WindowStaysOnTopHint } diff --git a/frame/qml/PanelPopup.qml b/frame/qml/PanelPopup.qml index 202e4937c..593dc5ce8 100644 --- a/frame/qml/PanelPopup.qml +++ b/frame/qml/PanelPopup.qml @@ -65,8 +65,8 @@ Item { if (!popupWindow) return - popupWindow.currentItem = null popupWindow.close() + popupWindow.currentItem = null } Connections { diff --git a/frame/qml/PanelPopupWindow.qml b/frame/qml/PanelPopupWindow.qml index f6fbeee03..a5098465d 100644 --- a/frame/qml/PanelPopupWindow.qml +++ b/frame/qml/PanelPopupWindow.qml @@ -17,6 +17,10 @@ Window { x: selectValue(transientParent ? transientParent.x + xOffset : 0, Screen.virtualX + 10, Screen.virtualX + Screen.width - root.width - 10) y: selectValue(transientParent ? transientParent.y + yOffset : 0, Screen.virtualY + 10, Screen.virtualY + Screen.height - root.height - 10) function selectValue(value, min, max) { + // wayland do not need to be limitted in the screen, this has been done by compositor + if (Qt.platform.pluginName === "wayland") + return value + if (value < min) return min if (value > max) @@ -31,7 +35,7 @@ Window { value: root.transientParent ? root.transientParent.screen: undefined } // TODO: it's a qt bug which make Qt.Popup can not get input focus - flags: Qt.Tool + flags: Qt.platform.pluginName === "xcb" ? Qt.Tool : Qt.ToolTip D.DWindow.enabled: true D.DWindow.windowRadius: D.DTK.platformTheme.windowRadius < 0 ? 4 : D.DTK.platformTheme.windowRadius D.DWindow.enableSystemResize: false diff --git a/frame/qml/PanelToolTipWindow.qml b/frame/qml/PanelToolTipWindow.qml index 005c27f77..83a64a2fc 100644 --- a/frame/qml/PanelToolTipWindow.qml +++ b/frame/qml/PanelToolTipWindow.qml @@ -10,7 +10,7 @@ import org.deepin.dtk 1.0 as D PanelPopupWindow { id: root - flags: Qt.Tool | Qt.WindowStaysOnTopHint + flags: (Qt.platform.pluginName === "xcb" ? Qt.Tool : Qt.ToolTip) | Qt.WindowStaysOnTopHint D.DWindow.windowRadius: 4 D.DWindow.shadowRadius: 8 }