diff --git a/kcmkwin/kwinscreenedges/kwinscreenedge.cpp b/kcmkwin/kwinscreenedges/kwinscreenedge.cpp index 931f55d22c..b12d9e4525 100644 --- a/kcmkwin/kwinscreenedges/kwinscreenedge.cpp +++ b/kcmkwin/kwinscreenedges/kwinscreenedge.cpp @@ -42,6 +42,12 @@ void KWinScreenEdge::monitorHideEdge(ElectricBorder border, bool hidden) monitor()->setEdgeHidden(edge, hidden); } +void KWinScreenEdge::monitorEnableEdge(ElectricBorder border, bool enabled) +{ + const int edge = KWinScreenEdge::electricBorderToMonitorEdge(border); + monitor()->setEdgeEnabled(edge, enabled); +} + void KWinScreenEdge::monitorAddItem(const QString &item) { for (int i = 0; i < 8; i++) { diff --git a/kcmkwin/kwinscreenedges/kwinscreenedge.h b/kcmkwin/kwinscreenedges/kwinscreenedge.h index 4787223243..5c9e65a147 100644 --- a/kcmkwin/kwinscreenedges/kwinscreenedge.h +++ b/kcmkwin/kwinscreenedges/kwinscreenedge.h @@ -40,6 +40,7 @@ public: ~KWinScreenEdge() override; void monitorHideEdge(ElectricBorder border, bool hidden); + void monitorEnableEdge(ElectricBorder border, bool enabled); void monitorAddItem(const QString &item); void monitorItemSetEnabled(int index, bool enabled); diff --git a/kcmkwin/kwinscreenedges/monitor.cpp b/kcmkwin/kwinscreenedges/monitor.cpp index 73b709b7bc..4a830f1b19 100644 --- a/kcmkwin/kwinscreenedges/monitor.cpp +++ b/kcmkwin/kwinscreenedges/monitor.cpp @@ -138,6 +138,13 @@ bool Monitor::edge(int edge) const return items[ edge ]->brush() == Qt::green; } +void Monitor::setEdgeEnabled(int edge, bool enabled) +{ + for (QAction *action : qAsConst(popup_actions[edge])) { + action->setEnabled(enabled); + } +} + void Monitor::setEdgeHidden(int edge, bool set) { hidden[ edge ] = set; diff --git a/kcmkwin/kwinscreenedges/monitor.h b/kcmkwin/kwinscreenedges/monitor.h index aa50dcd076..2188cca149 100644 --- a/kcmkwin/kwinscreenedges/monitor.h +++ b/kcmkwin/kwinscreenedges/monitor.h @@ -49,6 +49,7 @@ public: explicit Monitor(QWidget* parent); void setEdge(int edge, bool set); bool edge(int edge) const; + void setEdgeEnabled(int edge, bool enabled); void setEdgeHidden(int edge, bool set); bool edgeHidden(int edge) const; void clear(); diff --git a/kcmkwin/kwinscreenedges/touch.cpp b/kcmkwin/kwinscreenedges/touch.cpp index fd040f4b08..6ccbfd9d2a 100644 --- a/kcmkwin/kwinscreenedges/touch.cpp +++ b/kcmkwin/kwinscreenedges/touch.cpp @@ -299,6 +299,12 @@ void KWinScreenEdgesConfig::monitorShowEvent() bool reasonable = focusPolicy != "FocusStrictlyUnderMouse" && focusPolicy != "FocusUnderMouse"; m_form->monitorItemSetEnabled(TabBox, reasonable); m_form->monitorItemSetEnabled(TabBoxAlternative, reasonable); + + // Disable Edge if TouchEdges group entries are immutable + m_form->monitorEnableEdge(ElectricTop, !m_settings->isTopImmutable()); + m_form->monitorEnableEdge(ElectricRight, !m_settings->isRightImmutable()); + m_form->monitorEnableEdge(ElectricBottom, !m_settings->isBottomImmutable()); + m_form->monitorEnableEdge(ElectricLeft, !m_settings->isLeftImmutable()); } ElectricBorderAction KWinScreenEdgesConfig::electricBorderActionFromString(const QString &string)