From 5fecaf3fe7699886928fbc160dc69ea1da5ac8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 24 Mar 2016 14:42:18 +0100 Subject: [PATCH] Revert "desktop grid: zoom hovered window" Summary: This reverts commit 14d1fdf63fc27d908f062695e85fa55dde725b55. The zoom effect is definitely the wrong way, it's broken (can be triggered without moving the mouse, expands windows outside of their allotted area (looks like broken sizing/placement), isn't animated so feels very choppy, isn't using well-known highlight semantics), the result is that it feels unnatural and jarring. To be honest, when I looked at it, I was looking for a bug in the code, e.g. margins not being taken into account. It didn't come up in me that this could be wanted behavior, until I read the code. As to the original commit message: The highlight is useless for this case, as any window can be dragged or activated, highlighted or not. What *could* work is to somehow intensify the colors, but that again would have to be animated, and play well with the ongoing desktop-zoom animation, the mouse pointer location changes relative to the window, so it's really complex to get right. I thought of this for a while, I don't think the complexity that has to be implemented is worth the benefit, because, what does highlighted really mean here? "window is under the mouse" isn't a useful metric, as we don't know if the user is changing desktops or rearranging windows, and "window under mouse" changes depending on the zoom level, "window can be dragged or activated" also isn't a useful metric, as I can do that with any window, anyway. Test Plan: Tested with patch applied, desktopgrid windows don't jump around anymore. Reviewers: graesslin Reviewed By: graesslin Subscribers: plasma-devel Projects: #plasma Differential Revision: https://phabricator.kde.org/D1209 --- effects/desktopgrid/desktopgrid.cpp | 19 ------------------- effects/desktopgrid/desktopgrid.h | 1 - 2 files changed, 20 deletions(-) diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 0996462897..df70a8f8e2 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -55,7 +55,6 @@ DesktopGridEffect::DesktopGridEffect() , wasDesktopMove(false) , isValidMove(false) , windowMove(NULL) - , m_highlightWindow(nullptr) , windowMoveDiff() , gridSize() , orientation(Qt::Horizontal) @@ -284,14 +283,8 @@ void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W } } - const bool isOnThisDesktop = !w->isOnAllDesktops() || paintingDesktop == highlightedDesktop; - const bool zoom = w == m_highlightWindow && isOnThisDesktop; qreal xScale = data.xScale(); qreal yScale = data.yScale(); - if (zoom) { - xScale *= 1.05f; - yScale *= 1.05f; - } data.multiplyBrightness(1.0 - (0.3 * (1.0 - hoverTimeline[paintingDesktop - 1]->currentValue()))); @@ -316,10 +309,6 @@ void DesktopGridEffect::paintWindow(EffectWindow* w, int mask, QRegion region, W if (w->isDesktop()) quadsAdded = false; } - if (zoom) { - transformedGeo.translate(-0.025f*transformedGeo.width(), - -0.025f*transformedGeo.height()); - } if (!quadsAdded) { foreach (const WindowQuad & quad, data.quads) { QRect quadRect( @@ -466,14 +455,6 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) if (e->type() == QEvent::MouseMove) { int d = posToDesktop(me->pos()); - if (!(wasDesktopMove || wasWindowMove)) { - EffectWindow *oldHighlightWindow = m_highlightWindow; - m_highlightWindow = windowAt(me->pos()); - if (m_highlightWindow && m_highlightWindow->isDesktop()) - m_highlightWindow = nullptr; - if (oldHighlightWindow != m_highlightWindow) - effects->addRepaintFull(); - } if (windowMove != NULL && (me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) { // Handle window moving diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h index 8d62ea3116..59ea7a6f61 100644 --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -155,7 +155,6 @@ private: bool keyboardGrab; bool wasWindowMove, wasDesktopMove, isValidMove; EffectWindow* windowMove; - EffectWindow* m_highlightWindow; QPoint windowMoveDiff; QPoint dragStartPos;