From 8adbd2c4277e8e49c0687d8a6d2becdea75d4eb4 Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sat, 4 Jul 2020 11:41:11 +0200 Subject: [PATCH 1/2] Revert "change animation to destroy on change window" This reverts commit 013e1f4d5e2207fda5eec111b5bedeee9adba785. --- src/amor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amor.cpp b/src/amor.cpp index dbdb89d..3c6303b 100644 --- a/src/amor.cpp +++ b/src/amor.cpp @@ -687,7 +687,6 @@ void Amor::slotWindowActivate(WId win) // We are losing focus from the current window mTimer->setSingleShot( true ); mTimer->start( 0 ); - selectAnimation( Destroy ); } else if( mNextTarget ) { // We are setting focus to a new window -- GitLab From e164fe373476059975731f5cd8792d32a204f522 Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sat, 4 Jul 2020 11:45:24 +0200 Subject: [PATCH 2/2] Revert "Prevent choose another window when change active window." The logic removed in this commit was in case we were out of the available area only, so the commit message doesn't make sense. And some avatars have animations for when dragging, so we shouldn't disable those. This reverts commit 758ee761ba63b30ba1f0c21f806f5de67dcaf2a8. --- src/amor.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/amor.cpp b/src/amor.cpp index 3c6303b..caf5580 100644 --- a/src/amor.cpp +++ b/src/amor.cpp @@ -640,18 +640,14 @@ void Amor::slotOffsetChanged(int off) void Amor::slotWidgetDragged(const QPoint &delta, bool release) { - mTimer->stop(); - if( mCurrAnim->frame() ) { int newPosition = mPosition + delta.x(); - if( mCurrAnim->totalMovement() + newPosition > mTargetRect.width() ) { newPosition = mTargetRect.width() - mCurrAnim->totalMovement(); } else if( mCurrAnim->totalMovement() + newPosition < 0 ) { newPosition = -mCurrAnim->totalMovement(); } - mPosition = newPosition; mAmor->move( mTargetRect.x() + mPosition - mCurrAnim->hotspot().x(), mAmor->y() ); @@ -665,16 +661,29 @@ void Amor::slotWidgetDragged(const QPoint &delta, bool release) mConfig.write(); } } - - if (release) { - mTimer->setSingleShot( true ); - mTimer->start( 0 ); - } } void Amor::slotWindowActivate(WId win) { + + // We don't fit on top of this window, see if we can find another one + + KWindowInfo windowInfo( win, NET::WMFrameExtents ); + const QRect desktopArea = mWin->workArea(KWindowSystem::currentDesktop()); + if( windowInfo.frameGeometry().y() - mCurrAnim->hotspot().y() + mConfig.mOffset < desktopArea.y() ) { + for (const WId windowId : KWindowSystem::windows()) { + windowInfo = KWindowInfo( windowId, NET::WMFrameExtents | NET::WMGeometry ); + + if( windowInfo.frameGeometry().y() - mCurrAnim->hotspot().y() + mConfig.mOffset < desktopArea.y() ) { + continue; + } + + win = windowId; + break; + } + } + mTimer->stop(); mNextTarget = win; -- GitLab