From ec8f7e1facffa05a95bdb553d91abb915525d4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Thu, 4 Sep 2014 21:13:55 +0200 Subject: [PATCH] ensure disjunct screenedges on overlapping screens If two or more screens overlap (partially or fully) we must not create double edges since kwin would trigger both - since they've the same actions bound (for sure) the action will called twice (so either eg. toggle or skip one VD etc.) BUG: 338381 REVIEW: 120060 --- screenedge.cpp | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/screenedge.cpp b/screenedge.cpp index 75035540f1..7f45d762f2 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -872,23 +872,27 @@ void ScreenEdges::recreateEdges() QList oldEdges(m_edges); m_edges.clear(); const QRect fullArea(0, 0, displayWidth(), displayHeight()); + QRegion processedRegion; for (int i=0; icount(); ++i) { - const QRect screen = screens()->geometry(i); - if (isLeftScreen(screen, fullArea)) { - // left most screen - createVerticalEdge(ElectricLeft, screen, fullArea); - } - if (isRightScreen(screen, fullArea)) { - // right most screen - createVerticalEdge(ElectricRight, screen, fullArea); - } - if (isTopScreen(screen, fullArea)) { - // top most screen - createHorizontalEdge(ElectricTop, screen, fullArea); - } - if (isBottomScreen(screen, fullArea)) { - // bottom most screen - createHorizontalEdge(ElectricBottom, screen, fullArea); + const QRegion screen = QRegion(screens()->geometry(i)).subtracted(processedRegion); + processedRegion += screen; + Q_FOREACH (const QRect &screenPart, screen.rects()) { + if (isLeftScreen(screenPart, fullArea)) { + // left most screen + createVerticalEdge(ElectricLeft, screenPart, fullArea); + } + if (isRightScreen(screenPart, fullArea)) { + // right most screen + createVerticalEdge(ElectricRight, screenPart, fullArea); + } + if (isTopScreen(screenPart, fullArea)) { + // top most screen + createHorizontalEdge(ElectricTop, screenPart, fullArea); + } + if (isBottomScreen(screenPart, fullArea)) { + // bottom most screen + createHorizontalEdge(ElectricBottom, screenPart, fullArea); + } } } // copy over the effect/script reservations from the old edges