diff --git a/src/config/treelandconfig.cpp b/src/config/treelandconfig.cpp index 10d32e1ce..67a4fda53 100644 --- a/src/config/treelandconfig.cpp +++ b/src/config/treelandconfig.cpp @@ -393,22 +393,6 @@ uint32_t TreelandConfig::windowTitlebarHeight() return m_windowTitlebarHeight; } -void TreelandConfig::setBlockActivateSurface(bool block) -{ - if (m_blockActivateSurface == block) { - return; - } - - m_blockActivateSurface = block; - - Q_EMIT blockActivateSurfaceChanged(); -} - -bool TreelandConfig::blockActivateSurface() const -{ - return m_blockActivateSurface; -} - uint TreelandConfig::multitaskviewTopContentMargin() const { return m_multitaskviewTopContentMargin; diff --git a/src/config/treelandconfig.h b/src/config/treelandconfig.h index b3fdbaa37..0cc866330 100644 --- a/src/config/treelandconfig.h +++ b/src/config/treelandconfig.h @@ -40,7 +40,6 @@ class TreelandConfig Q_PROPERTY(uint windowOpacity READ windowOpacity WRITE setWindowOpacity NOTIFY windowOpacityChanged FINAL) Q_PROPERTY(uint windowThemeType READ windowThemeType WRITE setWindowThemeType NOTIFY windowThemeTypeChanged FINAL) Q_PROPERTY(uint windowTitlebarHeight READ windowTitlebarHeight WRITE setWindowTitlebarHeight NOTIFY windowTitlebarHeightChanged FINAL) - Q_PROPERTY(bool blockActivateSurface READ blockActivateSurface WRITE setBlockActivateSurface NOTIFY blockActivateSurfaceChanged FINAL) Q_PROPERTY(uint multitaskviewTopContentMargin READ multitaskviewTopContentMargin WRITE setMultitaskviewTopContentMargin NOTIFY multitaskviewTopContentMarginChanged FINAL) Q_PROPERTY(uint multitaskviewBottomContentMargin READ multitaskviewBottomContentMargin WRITE setMultitaskviewBottomContentMargin NOTIFY multitaskviewBottomContentMarginChanged FINAL) Q_PROPERTY(uint multitaskviewHorizontalMargin READ multitaskviewHorizontalMargin WRITE setMultitaskviewHorizontalMargin NOTIFY multitaskviewHorizontalMarginChanged FINAL) @@ -122,9 +121,6 @@ class TreelandConfig void setWindowTitlebarHeight(uint titlebarHeight); uint32_t windowTitlebarHeight(); - void setBlockActivateSurface(bool block); - bool blockActivateSurface() const; - uint multitaskviewTopContentMargin() const; void setMultitaskviewTopContentMargin(uint newMultitaskviewTopContentMargin); diff --git a/src/core/treeland.cpp b/src/core/treeland.cpp index b2d458c9e..531203125 100644 --- a/src/core/treeland.cpp +++ b/src/core/treeland.cpp @@ -358,16 +358,6 @@ RootSurfaceContainer *Treeland::rootSurfaceContainer() const return d->helper->rootSurfaceContainer(); } -void Treeland::blockActivateSurface(bool block) -{ - TreelandConfig::ref().setBlockActivateSurface(block); -} - -bool Treeland::isBlockActivateSurface() const -{ - return TreelandConfig::ref().blockActivateSurface(); -} - bool Treeland::ActivateWayland(QDBusUnixFileDescriptor _fd) { Q_D(Treeland); diff --git a/src/core/treeland.h b/src/core/treeland.h index b029efa82..947a897d9 100644 --- a/src/core/treeland.h +++ b/src/core/treeland.h @@ -41,9 +41,6 @@ class Treeland Workspace *workspace() const override; RootSurfaceContainer *rootSurfaceContainer() const override; - void blockActivateSurface(bool block) override; - bool isBlockActivateSurface() const override; - Q_SIGNALS: void socketDisconnected(); diff --git a/src/interfaces/proxyinterface.h b/src/interfaces/proxyinterface.h index d0d1a65ff..10888af34 100644 --- a/src/interfaces/proxyinterface.h +++ b/src/interfaces/proxyinterface.h @@ -19,7 +19,4 @@ class TreelandProxyInterface virtual Workspace *workspace() const = 0; virtual RootSurfaceContainer *rootSurfaceContainer() const = 0; - - virtual void blockActivateSurface(bool block) = 0; - virtual bool isBlockActivateSurface() const = 0; }; diff --git a/src/plugins/multitaskview/multitaskview.cpp b/src/plugins/multitaskview/multitaskview.cpp index 552a212b2..4b36d7811 100644 --- a/src/plugins/multitaskview/multitaskview.cpp +++ b/src/plugins/multitaskview/multitaskview.cpp @@ -51,8 +51,6 @@ void Multitaskview::setActiveReason(ActiveReason activeReason) void Multitaskview::exit(SurfaceWrapper *surface, bool immediately) { - TreelandConfig::ref().setBlockActivateSurface(false); - if (surface) { Helper::instance()->forceActivateSurface(surface); } else if (Helper::instance()->workspace()->current()->latestActiveSurface()) { diff --git a/src/seat/helper.cpp b/src/seat/helper.cpp index ddb9caac4..a3fb226dd 100644 --- a/src/seat/helper.cpp +++ b/src/seat/helper.cpp @@ -1093,12 +1093,6 @@ void Helper::setSocketEnabled(bool newEnabled) void Helper::activateSurface(SurfaceWrapper *wrapper, Qt::FocusReason reason) { - if (TreelandConfig::ref().blockActivateSurface() && wrapper) { - if (wrapper->shellSurface()->hasCapability(WToplevelSurface::Capability::Activate)) { - workspace()->pushActivedSurface(wrapper); - } - return; - } if (!wrapper || !wrapper->shellSurface()->hasCapability(WToplevelSurface::Capability::Activate)) { if (!wrapper) @@ -1114,10 +1108,15 @@ void Helper::activateSurface(SurfaceWrapper *wrapper, Qt::FocusReason reason) } } - if (!wrapper - || (wrapper->shellSurface()->hasCapability(WToplevelSurface::Capability::Focus) - && wrapper->acceptKeyboardFocus())) + + if (!wrapper) { + requestKeyboardFocusForSurface(nullptr, reason); + } else if (!m_blockRequestKeyboardFocus + && wrapper->shellSurface()->hasCapability(WToplevelSurface::Capability::Focus) + && wrapper->acceptKeyboardFocus()) { + // TODO: maybe allow get focus for lockscreen overlay surface requestKeyboardFocusForSurface(wrapper, reason); + } } void Helper::forceActivateSurface(SurfaceWrapper *wrapper, Qt::FocusReason reason) @@ -1922,9 +1921,8 @@ void Helper::setCurrentMode(CurrentMode mode) if (m_currentMode == mode) return; - TreelandConfig::ref().setBlockActivateSurface(mode != CurrentMode::Normal); - m_currentMode = mode; + m_blockRequestKeyboardFocus = mode != CurrentMode::Normal; Q_EMIT currentModeChanged(); } diff --git a/src/seat/helper.h b/src/seat/helper.h index dfee4f04e..a986faf34 100644 --- a/src/seat/helper.h +++ b/src/seat/helper.h @@ -284,8 +284,6 @@ private Q_SLOTS: static Helper *m_instance; - CurrentMode m_currentMode{ CurrentMode::Normal }; - // qtquick helper WOutputRenderWindow *m_renderWindow = nullptr; QQuickItem *m_dockPreview = nullptr; @@ -347,4 +345,7 @@ private Q_SLOTS: UserModel *m_userModel{ nullptr }; quint32 m_atomDeepinNoTitlebar; + + CurrentMode m_currentMode{ CurrentMode::Normal }; + bool m_blockRequestKeyboardFocus { false }; };