Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TODO] chore: blockActivateSurface should not part of interface #401

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/config/treelandconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/config/treelandconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down
10 changes: 0 additions & 10 deletions src/core/treeland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/core/treeland.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 0 additions & 3 deletions src/interfaces/proxyinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
2 changes: 0 additions & 2 deletions src/plugins/multitaskview/multitaskview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
20 changes: 9 additions & 11 deletions src/seat/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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();
}
Expand Down
5 changes: 3 additions & 2 deletions src/seat/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -347,4 +345,7 @@ private Q_SLOTS:
UserModel *m_userModel{ nullptr };

quint32 m_atomDeepinNoTitlebar;

CurrentMode m_currentMode{ CurrentMode::Normal };
bool m_blockRequestKeyboardFocus { false };
};