when screenlocker is shown, we finish moveresize window.

when we use mouse to moveing window, then press Meta + L to lock
screen, then you release mouse, type password to unlock screen,
you will find the window still in moving status.
that means, at this point, the mouse has not pressed any buttons,
but the window will always follow the mouse movement.
wilder/Plasma/6.3
Vlad Zahorodnii 1 year ago
parent 5592b4ca74
commit 4d6c8ca9f6
  1. 12
      autotests/integration/lockscreen.cpp
  2. 16
      src/workspace.cpp
  3. 2
      src/workspace.h

@ -577,20 +577,20 @@ void LockScreenTest::testMoveWindow()
Test::keyboardKeyReleased(KEY_RIGHT, timestamp++);
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
// while locking our window should continue to be in move resize
// interactive move resize session should end when the screen is locked
LOCK;
QCOMPARE(workspace()->moveResizeWindow(), window);
QVERIFY(window->isInteractiveMove());
QCOMPARE(workspace()->moveResizeWindow(), nullptr);
QVERIFY(!window->isInteractiveMove());
Test::keyboardKeyPressed(KEY_RIGHT, timestamp++);
Test::keyboardKeyReleased(KEY_RIGHT, timestamp++);
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
UNLOCK;
QCOMPARE(workspace()->moveResizeWindow(), window);
QVERIFY(window->isInteractiveMove());
QCOMPARE(workspace()->moveResizeWindow(), nullptr);
QVERIFY(!window->isInteractiveMove());
Test::keyboardKeyPressed(KEY_RIGHT, timestamp++);
Test::keyboardKeyReleased(KEY_RIGHT, timestamp++);
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 2);
QCOMPARE(interactiveMoveResizeSteppedSpy.count(), 1);
Test::keyboardKeyPressed(KEY_ESC, timestamp++);
Test::keyboardKeyReleased(KEY_ESC, timestamp++);
QVERIFY(!window->isInteractiveMove());

@ -69,6 +69,10 @@
#include "x11window.h"
#include <KStartupInfo>
#endif
// screenlocker
#if KWIN_BUILD_SCREENLOCKER
#include <KScreenLocker/KsldApp>
#endif
// KDE
#include <KConfig>
#include <KConfigGroup>
@ -262,6 +266,10 @@ void Workspace::init()
if (waylandServer()) {
connect(waylandServer()->externalBrightness(), &ExternalBrightnessV1::devicesChanged, this, &Workspace::updateOutputConfiguration);
}
#if KWIN_BUILD_SCREENLOCKER
connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::locked, this, &Workspace::slotEndInteractiveMoveResize);
#endif
}
QString Workspace::getPlacementTrackerHash()
@ -1436,6 +1444,14 @@ void Workspace::slotDesktopRemoved(VirtualDesktop *desktop)
m_focusChain->removeDesktop(desktop);
}
void Workspace::slotEndInteractiveMoveResize()
{
auto moveResizeWindow = workspace()->moveResizeWindow();
if (moveResizeWindow) {
moveResizeWindow->endInteractiveMoveResize();
}
}
#if KWIN_BUILD_X11
void Workspace::selectWmInputEventMask()
{

@ -542,6 +542,8 @@ public Q_SLOTS:
void slotSetupWindowShortcut();
void setupWindowShortcutDone(bool);
void slotEndInteractiveMoveResize();
private Q_SLOTS:
void desktopResized();
#if KWIN_BUILD_X11

Loading…
Cancel
Save