2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2016-02-11 11:48:42 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
2016-02-11 11:48:42 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2016-02-11 11:48:42 +00:00
|
|
|
#include "kwin_wayland_test.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2022-08-29 07:55:49 +00:00
|
|
|
#include "core/output.h"
|
2022-11-05 10:43:41 +00:00
|
|
|
#include "core/outputbackend.h"
|
2016-02-11 11:48:42 +00:00
|
|
|
#include "cursor.h"
|
2017-03-26 13:53:09 +00:00
|
|
|
#include "effects.h"
|
2023-03-23 11:39:20 +00:00
|
|
|
#include "libkwineffects/kwineffects.h"
|
2016-04-06 15:25:24 +00:00
|
|
|
#include "options.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
#include "pointer_input.h"
|
2016-02-11 11:48:42 +00:00
|
|
|
#include "screenedge.h"
|
2022-09-02 08:18:15 +00:00
|
|
|
#include "utils/xcursortheme.h"
|
2021-08-13 08:41:57 +00:00
|
|
|
#include "virtualdesktops.h"
|
2022-04-22 09:27:33 +00:00
|
|
|
#include "wayland/clientconnection.h"
|
|
|
|
#include "wayland/seat_interface.h"
|
2016-02-11 11:48:42 +00:00
|
|
|
#include "wayland_server.h"
|
2022-04-22 17:39:12 +00:00
|
|
|
#include "window.h"
|
2016-02-11 11:48:42 +00:00
|
|
|
#include "workspace.h"
|
|
|
|
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
#include <KWayland/Client/buffer.h>
|
2016-02-11 11:48:42 +00:00
|
|
|
#include <KWayland/Client/compositor.h>
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <KWayland/Client/connection_thread.h>
|
2016-02-11 11:48:42 +00:00
|
|
|
#include <KWayland/Client/pointer.h>
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
#include <KWayland/Client/region.h>
|
2016-02-11 11:48:42 +00:00
|
|
|
#include <KWayland/Client/seat.h>
|
2017-04-10 16:19:45 +00:00
|
|
|
#include <KWayland/Client/server_decoration.h>
|
2016-02-11 11:48:42 +00:00
|
|
|
#include <KWayland/Client/shm_pool.h>
|
|
|
|
#include <KWayland/Client/surface.h>
|
|
|
|
|
2016-02-17 16:04:11 +00:00
|
|
|
#include <linux/input.h>
|
|
|
|
|
2016-02-11 11:48:42 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2020-05-18 19:37:41 +00:00
|
|
|
static PlatformCursorImage loadReferenceThemeCursor_helper(const KXcursorTheme &theme,
|
|
|
|
const QByteArray &name)
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
{
|
2020-05-18 19:37:41 +00:00
|
|
|
const QVector<KXcursorSprite> sprites = theme.shape(name);
|
|
|
|
if (sprites.isEmpty()) {
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
return PlatformCursorImage();
|
|
|
|
}
|
|
|
|
|
2021-05-02 10:37:45 +00:00
|
|
|
return PlatformCursorImage(sprites.constFirst().data(), sprites.constFirst().hotspot());
|
2020-05-18 19:37:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static PlatformCursorImage loadReferenceThemeCursor(const QByteArray &name)
|
|
|
|
{
|
|
|
|
const Cursor *pointerCursor = Cursors::self()->mouse();
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2022-10-19 07:10:03 +00:00
|
|
|
const KXcursorTheme theme(pointerCursor->themeName(), pointerCursor->themeSize(), kwinApp()->devicePixelRatio());
|
2020-05-18 19:37:41 +00:00
|
|
|
if (theme.isEmpty()) {
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
return PlatformCursorImage();
|
|
|
|
}
|
|
|
|
|
2020-05-18 19:37:41 +00:00
|
|
|
PlatformCursorImage platformCursorImage = loadReferenceThemeCursor_helper(theme, name);
|
|
|
|
if (!platformCursorImage.isNull()) {
|
|
|
|
return platformCursorImage;
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
}
|
|
|
|
|
2020-05-18 19:37:41 +00:00
|
|
|
const QVector<QByteArray> alternativeNames = Cursor::cursorAlternativeNames(name);
|
|
|
|
for (const QByteArray &alternativeName : alternativeNames) {
|
|
|
|
platformCursorImage = loadReferenceThemeCursor_helper(theme, alternativeName);
|
|
|
|
if (!platformCursorImage.isNull()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2020-05-18 19:37:41 +00:00
|
|
|
return platformCursorImage;
|
|
|
|
}
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2020-05-18 19:37:41 +00:00
|
|
|
static PlatformCursorImage loadReferenceThemeCursor(const CursorShape &shape)
|
|
|
|
{
|
|
|
|
return loadReferenceThemeCursor(shape.name());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
}
|
|
|
|
|
2016-02-11 11:48:42 +00:00
|
|
|
static const QString s_socketName = QStringLiteral("wayland_test_kwin_pointer_input-0");
|
|
|
|
|
|
|
|
class PointerInputTest : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
|
|
void initTestCase();
|
|
|
|
void init();
|
|
|
|
void cleanup();
|
|
|
|
void testWarpingUpdatesFocus();
|
|
|
|
void testWarpingGeneratesPointerMotion();
|
2017-03-26 13:53:09 +00:00
|
|
|
void testWarpingDuringFilter();
|
2022-02-23 20:48:18 +00:00
|
|
|
void testWarpingBetweenWindows();
|
2016-02-11 13:20:06 +00:00
|
|
|
void testUpdateFocusAfterScreenChange();
|
2021-07-16 13:25:39 +00:00
|
|
|
void testUpdateFocusOnDecorationDestroy();
|
2016-02-17 16:04:11 +00:00
|
|
|
void testModifierClickUnrestrictedMove_data();
|
|
|
|
void testModifierClickUnrestrictedMove();
|
2022-08-12 13:22:06 +00:00
|
|
|
void testModifierClickUnrestrictedFullscreenMove();
|
2018-10-07 19:02:09 +00:00
|
|
|
void testModifierClickUnrestrictedMoveGlobalShortcutsDisabled();
|
2016-02-18 07:27:28 +00:00
|
|
|
void testModifierScrollOpacity_data();
|
|
|
|
void testModifierScrollOpacity();
|
2018-10-07 19:02:09 +00:00
|
|
|
void testModifierScrollOpacityGlobalShortcutsDisabled();
|
2016-02-18 08:18:39 +00:00
|
|
|
void testScrollAction();
|
2016-02-18 12:02:07 +00:00
|
|
|
void testFocusFollowsMouse();
|
2016-02-22 09:07:02 +00:00
|
|
|
void testMouseActionInactiveWindow_data();
|
|
|
|
void testMouseActionInactiveWindow();
|
|
|
|
void testMouseActionActiveWindow_data();
|
|
|
|
void testMouseActionActiveWindow();
|
2016-02-24 16:18:08 +00:00
|
|
|
void testCursorImage();
|
2016-02-25 08:04:29 +00:00
|
|
|
void testEffectOverrideCursorImage();
|
2017-03-25 17:41:28 +00:00
|
|
|
void testPopup();
|
2017-04-10 16:19:45 +00:00
|
|
|
void testDecoCancelsPopup();
|
2017-04-15 09:36:21 +00:00
|
|
|
void testWindowUnderCursorWhileButtonPressed();
|
2018-07-10 18:09:22 +00:00
|
|
|
void testConfineToScreenGeometry_data();
|
|
|
|
void testConfineToScreenGeometry();
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
void testResizeCursor_data();
|
|
|
|
void testResizeCursor();
|
|
|
|
void testMoveCursor();
|
2019-08-27 15:01:14 +00:00
|
|
|
void testHideShowCursor();
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
void testDefaultInputRegion();
|
|
|
|
void testEmptyInputRegion();
|
2016-02-11 11:48:42 +00:00
|
|
|
|
|
|
|
private:
|
2016-02-11 13:20:06 +00:00
|
|
|
void render(KWayland::Client::Surface *surface, const QSize &size = QSize(100, 50));
|
2016-02-11 11:48:42 +00:00
|
|
|
KWayland::Client::Compositor *m_compositor = nullptr;
|
|
|
|
KWayland::Client::Seat *m_seat = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
void PointerInputTest::initTestCase()
|
|
|
|
{
|
2022-04-22 17:39:12 +00:00
|
|
|
qRegisterMetaType<KWin::Window *>();
|
2020-07-07 09:32:29 +00:00
|
|
|
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
2020-12-09 13:06:15 +00:00
|
|
|
QVERIFY(waylandServer()->init(s_socketName));
|
2022-11-16 21:03:50 +00:00
|
|
|
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));
|
2016-02-11 11:48:42 +00:00
|
|
|
|
2016-02-17 16:04:11 +00:00
|
|
|
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
|
|
|
|
2017-09-24 12:51:35 +00:00
|
|
|
if (!QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("icons/DMZ-White/index.theme")).isEmpty()) {
|
|
|
|
qputenv("XCURSOR_THEME", QByteArrayLiteral("DMZ-White"));
|
|
|
|
} else {
|
|
|
|
// might be vanilla-dmz (e.g. Arch, FreeBSD)
|
|
|
|
qputenv("XCURSOR_THEME", QByteArrayLiteral("Vanilla-DMZ"));
|
|
|
|
}
|
2016-04-05 06:36:53 +00:00
|
|
|
qputenv("XCURSOR_SIZE", QByteArrayLiteral("24"));
|
2017-09-18 19:05:34 +00:00
|
|
|
qputenv("XKB_DEFAULT_RULES", "evdev");
|
2022-05-19 08:30:26 +00:00
|
|
|
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
2016-02-25 12:51:45 +00:00
|
|
|
|
2016-02-11 11:48:42 +00:00
|
|
|
kwinApp()->start();
|
2020-07-07 09:32:29 +00:00
|
|
|
QVERIFY(applicationStartedSpy.wait());
|
2022-07-11 10:41:15 +00:00
|
|
|
const auto outputs = workspace()->outputs();
|
2021-08-31 07:03:05 +00:00
|
|
|
QCOMPARE(outputs.count(), 2);
|
|
|
|
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
|
|
|
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
2016-02-11 11:48:42 +00:00
|
|
|
setenv("QT_QPA_PLATFORM", "wayland", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::init()
|
|
|
|
{
|
2022-03-23 10:13:38 +00:00
|
|
|
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::Decoration | Test::AdditionalWaylandInterface::XdgDecorationV1));
|
2016-06-30 11:32:54 +00:00
|
|
|
QVERIFY(Test::waitForWaylandPointer());
|
|
|
|
m_compositor = Test::waylandCompositor();
|
|
|
|
m_seat = Test::waylandSeat();
|
2016-02-11 11:48:42 +00:00
|
|
|
|
2021-08-28 18:58:29 +00:00
|
|
|
workspace()->setActiveOutput(QPoint(640, 512));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPoint(640, 512));
|
2016-02-11 11:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::cleanup()
|
|
|
|
{
|
2016-06-30 11:32:54 +00:00
|
|
|
Test::destroyWaylandConnection();
|
2016-02-11 11:48:42 +00:00
|
|
|
}
|
|
|
|
|
2016-02-11 13:20:06 +00:00
|
|
|
void PointerInputTest::render(KWayland::Client::Surface *surface, const QSize &size)
|
2016-02-11 11:48:42 +00:00
|
|
|
{
|
2016-06-30 11:32:54 +00:00
|
|
|
Test::render(surface, size, Qt::blue);
|
|
|
|
Test::flushWaylandConnection();
|
2016-02-11 11:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testWarpingUpdatesFocus()
|
|
|
|
{
|
|
|
|
// this test verifies that warping the pointer creates pointer enter and leave events
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2016-02-11 11:48:42 +00:00
|
|
|
// create pointer and signal spy for enter and leave signals
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left);
|
2016-02-11 11:48:42 +00:00
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
|
|
|
// currently there should not be a focused pointer surface
|
|
|
|
QVERIFY(!waylandServer()->seat()->focusedPointerSurface());
|
|
|
|
QVERIFY(!pointer->enteredSurface());
|
|
|
|
|
|
|
|
// enter
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPoint(25, 25));
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
QCOMPARE(enteredSpy.count(), 1);
|
2016-08-04 08:39:23 +00:00
|
|
|
QCOMPARE(enteredSpy.first().at(1).toPointF(), QPointF(25, 25));
|
2016-02-11 11:48:42 +00:00
|
|
|
// window should have focus
|
2022-08-16 11:43:33 +00:00
|
|
|
QCOMPARE(pointer->enteredSurface(), surface.get());
|
2016-02-11 11:48:42 +00:00
|
|
|
// also on the server
|
|
|
|
QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface());
|
|
|
|
|
|
|
|
// and out again
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPoint(250, 250));
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(leftSpy.wait());
|
|
|
|
QCOMPARE(leftSpy.count(), 1);
|
|
|
|
// there should not be a focused pointer surface anymore
|
|
|
|
QVERIFY(!waylandServer()->seat()->focusedPointerSurface());
|
|
|
|
QVERIFY(!pointer->enteredSurface());
|
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testWarpingGeneratesPointerMotion()
|
|
|
|
{
|
|
|
|
// this test verifies that warping the pointer creates pointer motion events
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2016-02-11 11:48:42 +00:00
|
|
|
// create pointer and signal spy for enter and motion
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy movedSpy(pointer, &KWayland::Client::Pointer::motion);
|
2016-02-11 11:48:42 +00:00
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
|
|
|
// enter
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerMotion(QPointF(25, 25), 1);
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
2016-08-04 08:39:23 +00:00
|
|
|
QCOMPARE(enteredSpy.first().at(1).toPointF(), QPointF(25, 25));
|
2016-02-11 11:48:42 +00:00
|
|
|
|
|
|
|
// now warp
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPoint(26, 26));
|
2016-02-11 11:48:42 +00:00
|
|
|
QVERIFY(movedSpy.wait());
|
2016-08-04 08:39:23 +00:00
|
|
|
QCOMPARE(movedSpy.count(), 1);
|
2016-02-11 11:48:42 +00:00
|
|
|
QCOMPARE(movedSpy.last().first().toPointF(), QPointF(26, 26));
|
|
|
|
}
|
|
|
|
|
2017-03-26 13:53:09 +00:00
|
|
|
void PointerInputTest::testWarpingDuringFilter()
|
|
|
|
{
|
|
|
|
// this test verifies that pointer motion is handled correctly if
|
|
|
|
// the pointer gets warped during processing of input events
|
|
|
|
|
|
|
|
// create pointer
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy movedSpy(pointer, &KWayland::Client::Pointer::motion);
|
2017-03-26 13:53:09 +00:00
|
|
|
|
|
|
|
// warp cursor into expected geometry
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(10, 10));
|
2017-03-26 13:53:09 +00:00
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2017-03-26 13:53:09 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2017-03-26 13:53:09 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2017-03-26 13:53:09 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
|
|
|
QCOMPARE(window->pos(), QPoint(0, 0));
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(exclusiveContains(window->frameGeometry(), Cursors::self()->mouse()->pos()));
|
2017-03-26 13:53:09 +00:00
|
|
|
|
2022-05-08 12:19:51 +00:00
|
|
|
// is WindowView effect for top left screen edge loaded
|
|
|
|
QVERIFY(static_cast<EffectsHandlerImpl *>(effects)->isEffectLoaded("windowview"));
|
2017-03-26 13:53:09 +00:00
|
|
|
QVERIFY(movedSpy.isEmpty());
|
|
|
|
quint32 timestamp = 0;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerMotion(QPoint(0, 0), timestamp++);
|
2017-03-26 13:53:09 +00:00
|
|
|
// screen edges push back
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(Cursors::self()->mouse()->pos(), QPoint(1, 1));
|
2017-03-26 13:53:09 +00:00
|
|
|
QVERIFY(movedSpy.wait());
|
|
|
|
QCOMPARE(movedSpy.count(), 2);
|
|
|
|
QCOMPARE(movedSpy.at(0).first().toPoint(), QPoint(0, 0));
|
|
|
|
QCOMPARE(movedSpy.at(1).first().toPoint(), QPoint(1, 1));
|
|
|
|
}
|
|
|
|
|
2022-02-23 20:48:18 +00:00
|
|
|
void PointerInputTest::testWarpingBetweenWindows()
|
|
|
|
{
|
|
|
|
// This test verifies that the compositor will send correct events when the pointer
|
|
|
|
// leaves one window and enters another window.
|
|
|
|
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Pointer> pointer(m_seat->createPointer(m_seat));
|
|
|
|
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy leftSpy(pointer.get(), &KWayland::Client::Pointer::left);
|
|
|
|
QSignalSpy motionSpy(pointer.get(), &KWayland::Client::Pointer::motion);
|
2022-02-23 20:48:18 +00:00
|
|
|
|
|
|
|
// create windows
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
|
|
|
auto window1 = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::cyan);
|
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface2(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
|
|
|
auto window2 = Test::renderAndWaitForShown(surface2.get(), QSize(200, 100), Qt::red);
|
2022-02-23 20:48:18 +00:00
|
|
|
|
|
|
|
// place windows side by side
|
2022-04-23 19:51:16 +00:00
|
|
|
window1->move(QPoint(0, 0));
|
|
|
|
window2->move(QPoint(100, 0));
|
2022-02-23 20:48:18 +00:00
|
|
|
|
|
|
|
quint32 timestamp = 0;
|
|
|
|
|
|
|
|
// put the pointer at the center of the first window
|
2022-04-23 19:51:16 +00:00
|
|
|
Test::pointerMotion(window1->frameGeometry().center(), timestamp++);
|
2022-02-23 20:48:18 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
QCOMPARE(enteredSpy.count(), 1);
|
2022-10-21 22:01:51 +00:00
|
|
|
QCOMPARE(enteredSpy.last().at(1).toPointF(), QPointF(50, 25));
|
2022-02-23 20:48:18 +00:00
|
|
|
QCOMPARE(leftSpy.count(), 0);
|
|
|
|
QCOMPARE(motionSpy.count(), 0);
|
2022-08-01 21:29:02 +00:00
|
|
|
QCOMPARE(pointer->enteredSurface(), surface1.get());
|
2022-02-23 20:48:18 +00:00
|
|
|
|
|
|
|
// put the pointer at the center of the second window
|
2022-04-23 19:51:16 +00:00
|
|
|
Test::pointerMotion(window2->frameGeometry().center(), timestamp++);
|
2022-02-23 20:48:18 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
QCOMPARE(enteredSpy.count(), 2);
|
2022-05-16 20:13:39 +00:00
|
|
|
QCOMPARE(enteredSpy.last().at(1).toPointF(), QPointF(100, 50));
|
2022-02-23 20:48:18 +00:00
|
|
|
QCOMPARE(leftSpy.count(), 1);
|
|
|
|
QCOMPARE(motionSpy.count(), 0);
|
2022-08-01 21:29:02 +00:00
|
|
|
QCOMPARE(pointer->enteredSurface(), surface2.get());
|
2022-02-23 20:48:18 +00:00
|
|
|
}
|
|
|
|
|
2016-02-11 13:20:06 +00:00
|
|
|
void PointerInputTest::testUpdateFocusAfterScreenChange()
|
|
|
|
{
|
|
|
|
// this test verifies that a pointer enter event is generated when the cursor changes to another
|
|
|
|
// screen due to removal of screen
|
|
|
|
|
|
|
|
// create pointer and signal spy for enter and motion
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left);
|
2016-02-11 13:20:06 +00:00
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2016-02-11 13:20:06 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2016-02-11 13:20:06 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get(), QSize(1280, 1024));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2016-02-11 13:20:06 +00:00
|
|
|
QVERIFY(window);
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(exclusiveContains(window->frameGeometry(), Cursors::self()->mouse()->pos()));
|
2021-02-22 10:51:26 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
QCOMPARE(enteredSpy.count(), 1);
|
2020-12-03 09:37:28 +00:00
|
|
|
|
|
|
|
// move the cursor to the second screen
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(1500, 300));
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(!exclusiveContains(window->frameGeometry(), Cursors::self()->mouse()->pos()));
|
2020-12-03 09:37:28 +00:00
|
|
|
QVERIFY(leftSpy.wait());
|
2016-02-11 13:20:06 +00:00
|
|
|
|
|
|
|
// now let's remove the screen containing the cursor
|
2022-11-05 10:43:41 +00:00
|
|
|
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs",
|
2016-07-20 12:42:22 +00:00
|
|
|
Qt::DirectConnection,
|
|
|
|
Q_ARG(QVector<QRect>, QVector<QRect>{QRect(0, 0, 1280, 1024)}));
|
2022-07-11 10:41:15 +00:00
|
|
|
QCOMPARE(workspace()->outputs().count(), 1);
|
2016-02-11 13:20:06 +00:00
|
|
|
|
|
|
|
// this should have warped the cursor
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(Cursors::self()->mouse()->pos(), QPoint(639, 511));
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(exclusiveContains(window->frameGeometry(), Cursors::self()->mouse()->pos()));
|
2016-02-11 13:20:06 +00:00
|
|
|
|
|
|
|
// and we should get an enter event
|
2021-02-22 10:51:26 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
QCOMPARE(enteredSpy.count(), 2);
|
2016-02-11 13:20:06 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 13:25:39 +00:00
|
|
|
void PointerInputTest::testUpdateFocusOnDecorationDestroy()
|
|
|
|
{
|
2022-04-23 19:51:16 +00:00
|
|
|
// This test verifies that a maximized window gets it's pointer focus
|
2021-07-16 13:25:39 +00:00
|
|
|
// if decoration was focused and then destroyed on maximize with BorderlessMaximizedWindows option.
|
|
|
|
|
|
|
|
// create pointer for focus tracking
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
|
|
|
QSignalSpy buttonStateChangedSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged);
|
|
|
|
|
|
|
|
// Enable the borderless maximized windows option.
|
|
|
|
auto group = kwinApp()->config()->group("Windows");
|
|
|
|
group.writeEntry("BorderlessMaximizedWindows", true);
|
|
|
|
group.sync();
|
|
|
|
Workspace::self()->slotReconfigure();
|
|
|
|
QCOMPARE(options->borderlessMaximizedWindows(), true);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// Create the test window.
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly));
|
|
|
|
std::unique_ptr<Test::XdgToplevelDecorationV1> decoration(Test::createXdgToplevelDecorationV1(shellSurface.get()));
|
2021-07-16 13:25:39 +00:00
|
|
|
|
2022-08-01 21:29:02 +00:00
|
|
|
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
|
2021-07-16 13:25:39 +00:00
|
|
|
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
2022-08-01 21:29:02 +00:00
|
|
|
QSignalSpy decorationConfigureRequestedSpy(decoration.get(), &Test::XdgToplevelDecorationV1::configureRequested);
|
2021-07-16 13:25:39 +00:00
|
|
|
decoration->set_mode(Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
|
|
|
|
|
|
|
// Wait for the initial configure event.
|
|
|
|
Test::XdgToplevel::States states;
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy.count(), 1);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).toSize(), QSize(0, 0));
|
|
|
|
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// Map the window.
|
2021-07-16 13:25:39 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
2022-08-01 21:29:02 +00:00
|
|
|
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
QVERIFY(window->isActive());
|
|
|
|
QCOMPARE(window->maximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(window->requestedMaximizeMode(), MaximizeMode::MaximizeRestore);
|
|
|
|
QCOMPARE(window->isDecorated(), true);
|
|
|
|
|
|
|
|
// We should receive a configure event when the window becomes active.
|
2021-07-16 13:25:39 +00:00
|
|
|
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy.count(), 2);
|
|
|
|
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
|
|
|
|
|
|
|
// Simulate decoration hover
|
|
|
|
quint32 timestamp = 0;
|
2022-04-23 19:51:16 +00:00
|
|
|
Test::pointerMotion(window->frameGeometry().topLeft(), timestamp++);
|
2021-07-16 13:25:39 +00:00
|
|
|
QVERIFY(input()->pointer()->decoration());
|
|
|
|
|
|
|
|
// Maximize when on decoration
|
|
|
|
workspace()->slotWindowMaximize();
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
|
|
|
QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
|
|
|
|
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).toSize(), QSize(1280, 1024));
|
|
|
|
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
|
|
|
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged);
|
2021-07-16 13:25:39 +00:00
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
2022-08-01 21:29:02 +00:00
|
|
|
Test::render(surface.get(), QSize(1280, 1024), Qt::blue);
|
2021-07-16 13:25:39 +00:00
|
|
|
QVERIFY(frameGeometryChangedSpy.wait());
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->frameGeometry(), QRect(0, 0, 1280, 1024));
|
|
|
|
QCOMPARE(window->maximizeMode(), MaximizeFull);
|
|
|
|
QCOMPARE(window->requestedMaximizeMode(), MaximizeFull);
|
|
|
|
QCOMPARE(window->isDecorated(), false);
|
2021-07-16 13:25:39 +00:00
|
|
|
|
|
|
|
// Window should have focus, BUG 411884
|
|
|
|
QVERIFY(!input()->pointer()->decoration());
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
2021-07-16 13:25:39 +00:00
|
|
|
QVERIFY(buttonStateChangedSpy.wait());
|
2022-08-01 21:29:02 +00:00
|
|
|
QCOMPARE(pointer->enteredSurface(), surface.get());
|
2021-07-16 13:25:39 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// Destroy the window.
|
2021-07-16 13:25:39 +00:00
|
|
|
shellSurface.reset();
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(Test::waitForWindowDestroyed(window));
|
2021-07-16 13:25:39 +00:00
|
|
|
}
|
|
|
|
|
2016-02-17 16:04:11 +00:00
|
|
|
void PointerInputTest::testModifierClickUnrestrictedMove_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<int>("modifierKey");
|
|
|
|
QTest::addColumn<int>("mouseButton");
|
|
|
|
QTest::addColumn<QString>("modKey");
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::addColumn<bool>("capsLock");
|
2016-02-17 16:04:11 +00:00
|
|
|
|
|
|
|
const QString alt = QStringLiteral("Alt");
|
|
|
|
const QString meta = QStringLiteral("Meta");
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Left Alt + Left Click") << KEY_LEFTALT << BTN_LEFT << alt << false;
|
|
|
|
QTest::newRow("Left Alt + Right Click") << KEY_LEFTALT << BTN_RIGHT << alt << false;
|
|
|
|
QTest::newRow("Left Alt + Middle Click") << KEY_LEFTALT << BTN_MIDDLE << alt << false;
|
|
|
|
QTest::newRow("Right Alt + Left Click") << KEY_RIGHTALT << BTN_LEFT << alt << false;
|
|
|
|
QTest::newRow("Right Alt + Right Click") << KEY_RIGHTALT << BTN_RIGHT << alt << false;
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::newRow("Right Alt + Middle Click") << KEY_RIGHTALT << BTN_MIDDLE << alt << false;
|
2016-02-17 16:04:11 +00:00
|
|
|
// now everything with meta
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Left Meta + Left Click") << KEY_LEFTMETA << BTN_LEFT << meta << false;
|
|
|
|
QTest::newRow("Left Meta + Right Click") << KEY_LEFTMETA << BTN_RIGHT << meta << false;
|
|
|
|
QTest::newRow("Left Meta + Middle Click") << KEY_LEFTMETA << BTN_MIDDLE << meta << false;
|
|
|
|
QTest::newRow("Right Meta + Left Click") << KEY_RIGHTMETA << BTN_LEFT << meta << false;
|
|
|
|
QTest::newRow("Right Meta + Right Click") << KEY_RIGHTMETA << BTN_RIGHT << meta << false;
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::newRow("Right Meta + Middle Click") << KEY_RIGHTMETA << BTN_MIDDLE << meta << false;
|
|
|
|
|
|
|
|
// and with capslock
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Left Alt + Left Click/CapsLock") << KEY_LEFTALT << BTN_LEFT << alt << true;
|
|
|
|
QTest::newRow("Left Alt + Right Click/CapsLock") << KEY_LEFTALT << BTN_RIGHT << alt << true;
|
|
|
|
QTest::newRow("Left Alt + Middle Click/CapsLock") << KEY_LEFTALT << BTN_MIDDLE << alt << true;
|
|
|
|
QTest::newRow("Right Alt + Left Click/CapsLock") << KEY_RIGHTALT << BTN_LEFT << alt << true;
|
|
|
|
QTest::newRow("Right Alt + Right Click/CapsLock") << KEY_RIGHTALT << BTN_RIGHT << alt << true;
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::newRow("Right Alt + Middle Click/CapsLock") << KEY_RIGHTALT << BTN_MIDDLE << alt << true;
|
|
|
|
// now everything with meta
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Left Meta + Left Click/CapsLock") << KEY_LEFTMETA << BTN_LEFT << meta << true;
|
|
|
|
QTest::newRow("Left Meta + Right Click/CapsLock") << KEY_LEFTMETA << BTN_RIGHT << meta << true;
|
|
|
|
QTest::newRow("Left Meta + Middle Click/CapsLock") << KEY_LEFTMETA << BTN_MIDDLE << meta << true;
|
|
|
|
QTest::newRow("Right Meta + Left Click/CapsLock") << KEY_RIGHTMETA << BTN_LEFT << meta << true;
|
|
|
|
QTest::newRow("Right Meta + Right Click/CapsLock") << KEY_RIGHTMETA << BTN_RIGHT << meta << true;
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::newRow("Right Meta + Middle Click/CapsLock") << KEY_RIGHTMETA << BTN_MIDDLE << meta << true;
|
2016-02-17 16:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testModifierClickUnrestrictedMove()
|
|
|
|
{
|
|
|
|
// this test ensures that Alt+mouse button press triggers unrestricted move
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2016-02-17 16:04:11 +00:00
|
|
|
// create pointer and signal spy for button events
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy buttonSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged);
|
2016-02-17 16:04:11 +00:00
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
QFETCH(QString, modKey);
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
|
|
|
group.writeEntry("CommandAllKey", modKey);
|
|
|
|
group.writeEntry("CommandAll1", "Move");
|
|
|
|
group.writeEntry("CommandAll2", "Move");
|
|
|
|
group.writeEntry("CommandAll3", "Move");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
2016-04-06 15:25:24 +00:00
|
|
|
QCOMPARE(options->commandAllModifier(), modKey == QStringLiteral("Alt") ? Qt::AltModifier : Qt::MetaModifier);
|
|
|
|
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
|
|
|
|
QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove);
|
|
|
|
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
|
2016-02-17 16:04:11 +00:00
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2016-02-17 16:04:11 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2016-02-17 16:04:11 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2016-02-17 16:04:11 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
|
|
|
// move cursor on window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2016-02-17 16:04:11 +00:00
|
|
|
|
|
|
|
// simulate modifier+click
|
|
|
|
quint32 timestamp = 1;
|
2016-11-23 08:06:08 +00:00
|
|
|
QFETCH(bool, capsLock);
|
|
|
|
if (capsLock) {
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++);
|
2016-11-23 08:06:08 +00:00
|
|
|
}
|
2016-02-17 16:04:11 +00:00
|
|
|
QFETCH(int, modifierKey);
|
|
|
|
QFETCH(int, mouseButton);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(modifierKey, timestamp++);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!window->isInteractiveMove());
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(mouseButton, timestamp++);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(window->isInteractiveMove());
|
2016-02-17 16:04:11 +00:00
|
|
|
// release modifier should not change it
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(modifierKey, timestamp++);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(window->isInteractiveMove());
|
2016-02-17 16:04:11 +00:00
|
|
|
// but releasing the key should end move/resize
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonReleased(mouseButton, timestamp++);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!window->isInteractiveMove());
|
2016-11-23 08:06:08 +00:00
|
|
|
if (capsLock) {
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++);
|
2016-11-23 08:06:08 +00:00
|
|
|
}
|
2016-02-17 16:04:11 +00:00
|
|
|
|
|
|
|
// all of that should not have triggered button events on the surface
|
|
|
|
QCOMPARE(buttonSpy.count(), 0);
|
|
|
|
// also waiting shouldn't give us the event
|
|
|
|
QVERIFY(!buttonSpy.wait(100));
|
|
|
|
}
|
|
|
|
|
2022-08-12 13:22:06 +00:00
|
|
|
void PointerInputTest::testModifierClickUnrestrictedFullscreenMove()
|
|
|
|
{
|
|
|
|
// this test ensures that Meta+mouse button press triggers unrestricted move for fullscreen windows
|
|
|
|
if (workspace()->outputs().size() < 2) {
|
2022-11-16 21:03:50 +00:00
|
|
|
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, QVector<QRect>() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)));
|
2022-08-12 13:22:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
|
|
|
group.writeEntry("CommandAllKey", "Meta");
|
|
|
|
group.writeEntry("CommandAll1", "Move");
|
|
|
|
group.writeEntry("CommandAll2", "Move");
|
|
|
|
group.writeEntry("CommandAll3", "Move");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
|
|
|
|
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
|
|
|
|
QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove);
|
|
|
|
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
|
|
|
|
|
|
|
|
// create a window
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2022-08-12 13:22:06 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2022-08-12 13:22:06 +00:00
|
|
|
QVERIFY(shellSurface);
|
|
|
|
shellSurface->set_fullscreen(nullptr);
|
|
|
|
QSignalSpy toplevelConfigureRequestedSpy(shellSurface, &Test::XdgToplevel::configureRequested);
|
|
|
|
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
2022-08-16 11:43:33 +00:00
|
|
|
Window *window = Test::renderAndWaitForShown(surface.get(), toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), Qt::blue);
|
2022-08-12 13:22:06 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
QVERIFY(window->isFullScreen());
|
|
|
|
|
|
|
|
// move cursor on window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2022-08-12 13:22:06 +00:00
|
|
|
|
|
|
|
// simulate modifier+click
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
|
|
|
|
QVERIFY(!window->isInteractiveMove());
|
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
|
|
|
QVERIFY(window->isInteractiveMove());
|
|
|
|
// release modifier should not change it
|
|
|
|
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
|
|
|
|
QVERIFY(window->isInteractiveMove());
|
|
|
|
// but releasing the key should end move/resize
|
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
|
|
|
QVERIFY(!window->isInteractiveMove());
|
|
|
|
}
|
|
|
|
|
2018-10-07 19:02:09 +00:00
|
|
|
void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled()
|
|
|
|
{
|
|
|
|
// this test ensures that Alt+mouse button press triggers unrestricted move
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2018-10-07 19:02:09 +00:00
|
|
|
// create pointer and signal spy for button events
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy buttonSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged);
|
2018-10-07 19:02:09 +00:00
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
2020-05-06 09:17:44 +00:00
|
|
|
group.writeEntry("CommandAllKey", "Meta");
|
2018-10-07 19:02:09 +00:00
|
|
|
group.writeEntry("CommandAll1", "Move");
|
|
|
|
group.writeEntry("CommandAll2", "Move");
|
|
|
|
group.writeEntry("CommandAll3", "Move");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
2020-05-06 09:17:44 +00:00
|
|
|
QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
|
2018-10-07 19:02:09 +00:00
|
|
|
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
|
|
|
|
QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove);
|
|
|
|
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
|
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2018-10-07 19:02:09 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2018-10-07 19:02:09 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2018-10-07 19:02:09 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
|
|
|
// disable global shortcuts
|
|
|
|
QVERIFY(!workspace()->globalShortcutsDisabled());
|
|
|
|
workspace()->disableGlobalShortcutsForClient(true);
|
|
|
|
QVERIFY(workspace()->globalShortcutsDisabled());
|
|
|
|
|
|
|
|
// move cursor on window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2018-10-07 19:02:09 +00:00
|
|
|
|
|
|
|
// simulate modifier+click
|
|
|
|
quint32 timestamp = 1;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!window->isInteractiveMove());
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!window->isInteractiveMove());
|
2018-10-07 19:02:09 +00:00
|
|
|
// release modifier should not change it
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
|
2021-04-30 18:06:58 +00:00
|
|
|
QVERIFY(!window->isInteractiveMove());
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
2018-10-07 19:02:09 +00:00
|
|
|
|
|
|
|
workspace()->disableGlobalShortcutsForClient(false);
|
|
|
|
}
|
|
|
|
|
2016-02-18 07:27:28 +00:00
|
|
|
void PointerInputTest::testModifierScrollOpacity_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<int>("modifierKey");
|
|
|
|
QTest::addColumn<QString>("modKey");
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::addColumn<bool>("capsLock");
|
2016-02-18 07:27:28 +00:00
|
|
|
|
|
|
|
const QString alt = QStringLiteral("Alt");
|
|
|
|
const QString meta = QStringLiteral("Meta");
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Left Alt") << KEY_LEFTALT << alt << false;
|
|
|
|
QTest::newRow("Right Alt") << KEY_RIGHTALT << alt << false;
|
|
|
|
QTest::newRow("Left Meta") << KEY_LEFTMETA << meta << false;
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::newRow("Right Meta") << KEY_RIGHTMETA << meta << false;
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Left Alt/CapsLock") << KEY_LEFTALT << alt << true;
|
|
|
|
QTest::newRow("Right Alt/CapsLock") << KEY_RIGHTALT << alt << true;
|
|
|
|
QTest::newRow("Left Meta/CapsLock") << KEY_LEFTMETA << meta << true;
|
2016-11-23 08:06:08 +00:00
|
|
|
QTest::newRow("Right Meta/CapsLock") << KEY_RIGHTMETA << meta << true;
|
2016-02-18 07:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testModifierScrollOpacity()
|
|
|
|
{
|
|
|
|
// this test verifies that mod+wheel performs a window operation and does not
|
|
|
|
// pass the wheel to the window
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2016-02-18 07:27:28 +00:00
|
|
|
// create pointer and signal spy for button events
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy axisSpy(pointer, &KWayland::Client::Pointer::axisChanged);
|
2016-02-18 07:27:28 +00:00
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
QFETCH(QString, modKey);
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
|
|
|
group.writeEntry("CommandAllKey", modKey);
|
|
|
|
group.writeEntry("CommandAllWheel", "change opacity");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2016-02-18 07:27:28 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2016-02-18 07:27:28 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2016-02-18 07:27:28 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
// set the opacity to 0.5
|
|
|
|
window->setOpacity(0.5);
|
|
|
|
QCOMPARE(window->opacity(), 0.5);
|
|
|
|
|
|
|
|
// move cursor on window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2016-02-18 07:27:28 +00:00
|
|
|
|
|
|
|
// simulate modifier+wheel
|
|
|
|
quint32 timestamp = 1;
|
2016-11-23 08:06:08 +00:00
|
|
|
QFETCH(bool, capsLock);
|
|
|
|
if (capsLock) {
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++);
|
2016-11-23 08:06:08 +00:00
|
|
|
}
|
2016-02-18 07:27:28 +00:00
|
|
|
QFETCH(int, modifierKey);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(modifierKey, timestamp++);
|
|
|
|
Test::pointerAxisVertical(-5, timestamp++);
|
2016-02-18 09:11:20 +00:00
|
|
|
QCOMPARE(window->opacity(), 0.6);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerAxisVertical(5, timestamp++);
|
2016-02-18 07:27:28 +00:00
|
|
|
QCOMPARE(window->opacity(), 0.5);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(modifierKey, timestamp++);
|
2016-11-23 08:06:08 +00:00
|
|
|
if (capsLock) {
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++);
|
2016-11-23 08:06:08 +00:00
|
|
|
}
|
2016-02-18 07:27:28 +00:00
|
|
|
|
|
|
|
// axis should have been filtered out
|
|
|
|
QCOMPARE(axisSpy.count(), 0);
|
|
|
|
QVERIFY(!axisSpy.wait(100));
|
|
|
|
}
|
|
|
|
|
2018-10-07 19:02:09 +00:00
|
|
|
void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled()
|
|
|
|
{
|
|
|
|
// this test verifies that mod+wheel performs a window operation and does not
|
|
|
|
// pass the wheel to the window
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2018-10-07 19:02:09 +00:00
|
|
|
// create pointer and signal spy for button events
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy axisSpy(pointer, &KWayland::Client::Pointer::axisChanged);
|
2018-10-07 19:02:09 +00:00
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
2020-05-06 09:17:44 +00:00
|
|
|
group.writeEntry("CommandAllKey", "Meta");
|
2018-10-07 19:02:09 +00:00
|
|
|
group.writeEntry("CommandAllWheel", "change opacity");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2018-10-07 19:02:09 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2018-10-07 19:02:09 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2018-10-07 19:02:09 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
// set the opacity to 0.5
|
|
|
|
window->setOpacity(0.5);
|
|
|
|
QCOMPARE(window->opacity(), 0.5);
|
|
|
|
|
|
|
|
// move cursor on window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2018-10-07 19:02:09 +00:00
|
|
|
|
|
|
|
// disable global shortcuts
|
|
|
|
QVERIFY(!workspace()->globalShortcutsDisabled());
|
|
|
|
workspace()->disableGlobalShortcutsForClient(true);
|
|
|
|
QVERIFY(workspace()->globalShortcutsDisabled());
|
|
|
|
|
|
|
|
// simulate modifier+wheel
|
|
|
|
quint32 timestamp = 1;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
|
|
|
|
Test::pointerAxisVertical(-5, timestamp++);
|
2018-10-07 19:02:09 +00:00
|
|
|
QCOMPARE(window->opacity(), 0.5);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerAxisVertical(5, timestamp++);
|
2018-10-07 19:02:09 +00:00
|
|
|
QCOMPARE(window->opacity(), 0.5);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
|
2018-10-07 19:02:09 +00:00
|
|
|
|
|
|
|
workspace()->disableGlobalShortcutsForClient(false);
|
|
|
|
}
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
void PointerInputTest::testScrollAction()
|
2016-02-18 08:18:39 +00:00
|
|
|
{
|
|
|
|
// this test verifies that scroll on inactive window performs a mouse action
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy axisSpy(pointer, &KWayland::Client::Pointer::axisChanged);
|
2016-02-18 08:18:39 +00:00
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
|
|
|
group.writeEntry("CommandWindowWheel", "activate and scroll");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
// create two windows
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
2016-02-18 08:18:39 +00:00
|
|
|
QVERIFY(surface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
2016-02-18 08:18:39 +00:00
|
|
|
QVERIFY(shellSurface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface1.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window1 = workspace()->activeWindow();
|
2016-02-18 08:18:39 +00:00
|
|
|
QVERIFY(window1);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
2016-02-18 08:18:39 +00:00
|
|
|
QVERIFY(surface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
2016-02-18 08:18:39 +00:00
|
|
|
QVERIFY(shellSurface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface2.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window2 = workspace()->activeWindow();
|
2016-02-18 08:18:39 +00:00
|
|
|
QVERIFY(window2);
|
|
|
|
QVERIFY(window1 != window2);
|
|
|
|
|
|
|
|
// move cursor to the inactive window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window1->frameGeometry().center());
|
2016-02-18 08:18:39 +00:00
|
|
|
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
QVERIFY(!window1->isActive());
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerAxisVertical(5, timestamp++);
|
2016-02-18 08:18:39 +00:00
|
|
|
QVERIFY(window1->isActive());
|
|
|
|
|
|
|
|
// but also the wheel event should be passed to the window
|
|
|
|
QVERIFY(axisSpy.wait());
|
|
|
|
}
|
|
|
|
|
2016-02-18 12:02:07 +00:00
|
|
|
void PointerInputTest::testFocusFollowsMouse()
|
|
|
|
{
|
|
|
|
// need to create a pointer, otherwise it doesn't accept focus
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
|
|
|
// move cursor out of the way of first window to be created
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(900, 900));
|
2016-02-18 12:02:07 +00:00
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("Windows");
|
|
|
|
group.writeEntry("AutoRaise", true);
|
|
|
|
group.writeEntry("AutoRaiseInterval", 20);
|
|
|
|
group.writeEntry("DelayFocusInterval", 200);
|
|
|
|
group.writeEntry("FocusPolicy", "FocusFollowsMouse");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
// verify the settings
|
|
|
|
QCOMPARE(options->focusPolicy(), Options::FocusFollowsMouse);
|
|
|
|
QVERIFY(options->isAutoRaise());
|
|
|
|
QCOMPARE(options->autoRaiseInterval(), 20);
|
|
|
|
QCOMPARE(options->delayFocusInterval(), 200);
|
|
|
|
|
|
|
|
// create two windows
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(surface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(shellSurface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface1.get(), QSize(800, 800));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window1 = workspace()->activeWindow();
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(window1);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(surface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(shellSurface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface2.get(), QSize(800, 800));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window2 = workspace()->activeWindow();
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(window2);
|
|
|
|
QVERIFY(window1 != window2);
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window2);
|
2016-02-18 12:02:07 +00:00
|
|
|
// geometry of the two windows should be overlapping
|
2019-09-27 10:01:10 +00:00
|
|
|
QVERIFY(window1->frameGeometry().intersects(window2->frameGeometry()));
|
2016-02-18 12:02:07 +00:00
|
|
|
|
|
|
|
// signal spies for active window changed and stacking order changed
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy activeWindowChangedSpy(workspace(), &Workspace::windowActivated);
|
2016-02-18 12:02:07 +00:00
|
|
|
QSignalSpy stackingOrderChangedSpy(workspace(), &Workspace::stackingOrderChanged);
|
|
|
|
|
|
|
|
QVERIFY(!window1->isActive());
|
|
|
|
QVERIFY(window2->isActive());
|
|
|
|
|
|
|
|
// move on top of first window
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(exclusiveContains(window1->frameGeometry(), QPointF(10, 10)));
|
|
|
|
QVERIFY(!exclusiveContains(window2->frameGeometry(), QPointF(10, 10)));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(10, 10));
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(stackingOrderChangedSpy.wait());
|
|
|
|
QCOMPARE(stackingOrderChangedSpy.count(), 1);
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window1);
|
2016-02-18 12:02:07 +00:00
|
|
|
QTRY_VERIFY(window1->isActive());
|
|
|
|
|
|
|
|
// move on second window, but move away before active window change delay hits
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(810, 810));
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(stackingOrderChangedSpy.wait());
|
|
|
|
QCOMPARE(stackingOrderChangedSpy.count(), 2);
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window2);
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(10, 10));
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(!activeWindowChangedSpy.wait(250));
|
|
|
|
QVERIFY(window1->isActive());
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window1);
|
2016-02-18 12:02:07 +00:00
|
|
|
// as we moved back on window 1 that should been raised in the mean time
|
|
|
|
QCOMPARE(stackingOrderChangedSpy.count(), 3);
|
|
|
|
|
|
|
|
// quickly move on window 2 and back on window 1 should not raise window 2
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(810, 810));
|
|
|
|
input()->pointer()->warp(QPointF(10, 10));
|
2016-02-18 12:02:07 +00:00
|
|
|
QVERIFY(!stackingOrderChangedSpy.wait(250));
|
|
|
|
}
|
|
|
|
|
2016-02-22 09:07:02 +00:00
|
|
|
void PointerInputTest::testMouseActionInactiveWindow_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<quint32>("button");
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Left") << quint32(BTN_LEFT);
|
2016-02-22 09:07:02 +00:00
|
|
|
QTest::newRow("Middle") << quint32(BTN_MIDDLE);
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("Right") << quint32(BTN_RIGHT);
|
2016-02-22 09:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testMouseActionInactiveWindow()
|
|
|
|
{
|
|
|
|
// this test performs the mouse button window action on an inactive window
|
|
|
|
// it should activate the window and raise it
|
|
|
|
|
|
|
|
// first modify the config for this run - disable FocusFollowsMouse
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("Windows");
|
|
|
|
group.writeEntry("FocusPolicy", "ClickToFocus");
|
|
|
|
group.sync();
|
|
|
|
group = kwinApp()->config()->group("MouseBindings");
|
|
|
|
group.writeEntry("CommandWindow1", "Activate, raise and pass click");
|
|
|
|
group.writeEntry("CommandWindow2", "Activate, raise and pass click");
|
|
|
|
group.writeEntry("CommandWindow3", "Activate, raise and pass click");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
|
|
|
|
// create two windows
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(surface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(shellSurface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface1.get(), QSize(800, 800));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window1 = workspace()->activeWindow();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(window1);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(surface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(shellSurface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface2.get(), QSize(800, 800));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window2 = workspace()->activeWindow();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(window2);
|
|
|
|
QVERIFY(window1 != window2);
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window2);
|
2016-02-22 09:07:02 +00:00
|
|
|
// geometry of the two windows should be overlapping
|
2019-09-27 10:01:10 +00:00
|
|
|
QVERIFY(window1->frameGeometry().intersects(window2->frameGeometry()));
|
2016-02-22 09:07:02 +00:00
|
|
|
|
|
|
|
// signal spies for active window changed and stacking order changed
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy activeWindowChangedSpy(workspace(), &Workspace::windowActivated);
|
2016-02-22 09:07:02 +00:00
|
|
|
QSignalSpy stackingOrderChangedSpy(workspace(), &Workspace::stackingOrderChanged);
|
|
|
|
|
|
|
|
QVERIFY(!window1->isActive());
|
|
|
|
QVERIFY(window2->isActive());
|
|
|
|
|
|
|
|
// move on top of first window
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(exclusiveContains(window1->frameGeometry(), QPointF(10, 10)));
|
|
|
|
QVERIFY(!exclusiveContains(window2->frameGeometry(), QPointF(10, 10)));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(10, 10));
|
2016-02-22 09:07:02 +00:00
|
|
|
// no focus follows mouse
|
|
|
|
QVERIFY(!stackingOrderChangedSpy.wait(200));
|
|
|
|
QVERIFY(stackingOrderChangedSpy.isEmpty());
|
|
|
|
QVERIFY(activeWindowChangedSpy.isEmpty());
|
|
|
|
QVERIFY(window2->isActive());
|
|
|
|
// and click
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
QFETCH(quint32, button);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(button, timestamp++);
|
2016-02-22 09:07:02 +00:00
|
|
|
// should raise window1 and activate it
|
|
|
|
QCOMPARE(stackingOrderChangedSpy.count(), 1);
|
|
|
|
QVERIFY(!activeWindowChangedSpy.isEmpty());
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window1);
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(window1->isActive());
|
|
|
|
QVERIFY(!window2->isActive());
|
|
|
|
|
|
|
|
// release again
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonReleased(button, timestamp++);
|
2016-02-22 09:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testMouseActionActiveWindow_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<bool>("clickRaise");
|
|
|
|
QTest::addColumn<quint32>("button");
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
for (quint32 i = BTN_LEFT; i < BTN_JOYSTICK; i++) {
|
2016-02-22 09:07:02 +00:00
|
|
|
QByteArray number = QByteArray::number(i, 16);
|
|
|
|
QTest::newRow(QByteArrayLiteral("click raise/").append(number).constData()) << true << i;
|
|
|
|
QTest::newRow(QByteArrayLiteral("no click raise/").append(number).constData()) << false << i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testMouseActionActiveWindow()
|
|
|
|
{
|
|
|
|
// this test verifies the mouse action performed on an active window
|
|
|
|
// for all buttons it should trigger a window raise depending on the
|
|
|
|
// click raise option
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2016-02-22 09:07:02 +00:00
|
|
|
// create a button spy - all clicks should be passed through
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy buttonSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged);
|
2016-02-22 09:07:02 +00:00
|
|
|
|
|
|
|
// adjust config for this run
|
|
|
|
QFETCH(bool, clickRaise);
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("Windows");
|
|
|
|
group.writeEntry("ClickRaise", clickRaise);
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
|
|
|
QCOMPARE(options->isClickRaise(), clickRaise);
|
|
|
|
|
|
|
|
// create two windows
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface1 = Test::createSurface();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(surface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface1 = Test::createXdgToplevelSurface(surface1.get(), surface1.get());
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(shellSurface1);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface1.get(), QSize(800, 800));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window1 = workspace()->activeWindow();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(window1);
|
2016-05-23 09:19:29 +00:00
|
|
|
QSignalSpy window1DestroyedSpy(window1, &QObject::destroyed);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface2 = Test::createSurface();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(surface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface2 = Test::createXdgToplevelSurface(surface2.get(), surface2.get());
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(shellSurface2);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface2.get(), QSize(800, 800));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window2 = workspace()->activeWindow();
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(window2);
|
|
|
|
QVERIFY(window1 != window2);
|
2016-05-23 09:19:29 +00:00
|
|
|
QSignalSpy window2DestroyedSpy(window2, &QObject::destroyed);
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window2);
|
2016-02-22 09:07:02 +00:00
|
|
|
// geometry of the two windows should be overlapping
|
2019-09-27 10:01:10 +00:00
|
|
|
QVERIFY(window1->frameGeometry().intersects(window2->frameGeometry()));
|
2016-02-22 09:07:02 +00:00
|
|
|
// lower the currently active window
|
2022-04-23 08:33:23 +00:00
|
|
|
workspace()->lowerWindow(window2);
|
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window1);
|
2016-02-22 09:07:02 +00:00
|
|
|
|
|
|
|
// signal spy for stacking order spy
|
|
|
|
QSignalSpy stackingOrderChangedSpy(workspace(), &Workspace::stackingOrderChanged);
|
|
|
|
|
|
|
|
// move on top of second window
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(!exclusiveContains(window1->frameGeometry(), QPointF(900, 900)));
|
|
|
|
QVERIFY(exclusiveContains(window2->frameGeometry(), QPointF(900, 900)));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(900, 900));
|
2016-02-22 09:07:02 +00:00
|
|
|
|
|
|
|
// and click
|
|
|
|
quint32 timestamp = 1;
|
|
|
|
QFETCH(quint32, button);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(button, timestamp++);
|
2016-02-22 09:07:02 +00:00
|
|
|
QVERIFY(buttonSpy.wait());
|
|
|
|
if (clickRaise) {
|
|
|
|
QCOMPARE(stackingOrderChangedSpy.count(), 1);
|
2022-04-23 08:33:23 +00:00
|
|
|
QTRY_COMPARE_WITH_TIMEOUT(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window2, 200);
|
2016-02-22 09:07:02 +00:00
|
|
|
} else {
|
|
|
|
QCOMPARE(stackingOrderChangedSpy.count(), 0);
|
|
|
|
QVERIFY(!stackingOrderChangedSpy.wait(100));
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window1);
|
2016-02-22 09:07:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// release again
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonReleased(button, timestamp++);
|
2016-05-23 09:19:29 +00:00
|
|
|
|
2022-08-16 11:43:33 +00:00
|
|
|
surface1.reset();
|
2016-05-23 09:19:29 +00:00
|
|
|
QVERIFY(window1DestroyedSpy.wait());
|
2022-08-16 11:43:33 +00:00
|
|
|
surface2.reset();
|
2016-05-23 09:19:29 +00:00
|
|
|
QVERIFY(window2DestroyedSpy.wait());
|
2016-02-22 09:07:02 +00:00
|
|
|
}
|
|
|
|
|
2016-02-24 16:18:08 +00:00
|
|
|
void PointerInputTest::testCursorImage()
|
|
|
|
{
|
|
|
|
// this test verifies that the pointer image gets updated correctly from the client provided data
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2016-02-24 16:18:08 +00:00
|
|
|
// we need a pointer to get the enter event
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
2016-02-24 16:18:08 +00:00
|
|
|
|
|
|
|
// move cursor somewhere the new window won't open
|
2020-04-02 16:18:01 +00:00
|
|
|
auto cursor = Cursors::self()->mouse();
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(800, 800));
|
2016-02-24 16:18:08 +00:00
|
|
|
auto p = input()->pointer();
|
|
|
|
// at the moment it should be the fallback cursor
|
2020-04-02 16:18:01 +00:00
|
|
|
const QImage fallbackCursor = cursor->image();
|
2018-05-01 13:33:33 +00:00
|
|
|
QVERIFY(!fallbackCursor.isNull());
|
2016-02-24 16:18:08 +00:00
|
|
|
|
|
|
|
// create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2016-02-24 16:18:08 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2016-02-24 16:18:08 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2016-02-24 16:18:08 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
2018-05-01 13:33:33 +00:00
|
|
|
// move cursor to center of window, this should first set a null pointer, so we still show old cursor
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2020-09-07 08:11:07 +00:00
|
|
|
QCOMPARE(p->focus(), window);
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(cursor->image(), fallbackCursor);
|
2016-02-24 16:18:08 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
|
|
|
|
// create a cursor on the pointer
|
2022-08-16 11:43:33 +00:00
|
|
|
auto cursorSurface = Test::createSurface();
|
2016-02-24 16:18:08 +00:00
|
|
|
QVERIFY(cursorSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
QSignalSpy cursorRenderedSpy(cursorSurface.get(), &KWayland::Client::Surface::frameRendered);
|
2017-08-30 09:01:55 +00:00
|
|
|
QImage red = QImage(QSize(10, 10), QImage::Format_ARGB32_Premultiplied);
|
2016-02-24 16:18:08 +00:00
|
|
|
red.fill(Qt::red);
|
2016-06-30 11:32:54 +00:00
|
|
|
cursorSurface->attachBuffer(Test::waylandShmPool()->createBuffer(red));
|
2016-02-24 16:18:08 +00:00
|
|
|
cursorSurface->damage(QRect(0, 0, 10, 10));
|
|
|
|
cursorSurface->commit();
|
2022-08-16 11:43:33 +00:00
|
|
|
pointer->setCursor(cursorSurface.get(), QPoint(5, 5));
|
2016-02-24 16:18:08 +00:00
|
|
|
QVERIFY(cursorRenderedSpy.wait());
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(cursor->image(), red);
|
|
|
|
QCOMPARE(cursor->hotspot(), QPoint(5, 5));
|
2016-02-24 16:18:08 +00:00
|
|
|
// change hotspot
|
2022-08-16 11:43:33 +00:00
|
|
|
pointer->setCursor(cursorSurface.get(), QPoint(6, 6));
|
2016-06-30 11:32:54 +00:00
|
|
|
Test::flushWaylandConnection();
|
2020-04-02 16:18:01 +00:00
|
|
|
QTRY_COMPARE(cursor->hotspot(), QPoint(6, 6));
|
|
|
|
QCOMPARE(cursor->image(), red);
|
2016-02-24 16:18:08 +00:00
|
|
|
|
|
|
|
// change the buffer
|
2017-08-30 09:01:55 +00:00
|
|
|
QImage blue = QImage(QSize(10, 10), QImage::Format_ARGB32_Premultiplied);
|
2016-02-24 16:18:08 +00:00
|
|
|
blue.fill(Qt::blue);
|
2016-06-30 11:32:54 +00:00
|
|
|
auto b = Test::waylandShmPool()->createBuffer(blue);
|
2016-02-24 16:18:08 +00:00
|
|
|
cursorSurface->attachBuffer(b);
|
|
|
|
cursorSurface->damage(QRect(0, 0, 10, 10));
|
|
|
|
cursorSurface->commit();
|
|
|
|
QVERIFY(cursorRenderedSpy.wait());
|
2020-04-02 16:18:01 +00:00
|
|
|
QTRY_COMPARE(cursor->image(), blue);
|
|
|
|
QCOMPARE(cursor->hotspot(), QPoint(6, 6));
|
2016-02-24 16:18:08 +00:00
|
|
|
|
2018-06-23 17:17:51 +00:00
|
|
|
// scaled cursor
|
|
|
|
QImage blueScaled = QImage(QSize(20, 20), QImage::Format_ARGB32_Premultiplied);
|
2020-02-28 17:06:19 +00:00
|
|
|
blueScaled.setDevicePixelRatio(2);
|
2018-06-23 17:17:51 +00:00
|
|
|
blueScaled.fill(Qt::blue);
|
|
|
|
auto bs = Test::waylandShmPool()->createBuffer(blueScaled);
|
|
|
|
cursorSurface->attachBuffer(bs);
|
|
|
|
cursorSurface->setScale(2);
|
|
|
|
cursorSurface->damage(QRect(0, 0, 20, 20));
|
|
|
|
cursorSurface->commit();
|
|
|
|
QVERIFY(cursorRenderedSpy.wait());
|
2020-04-02 16:18:01 +00:00
|
|
|
QTRY_COMPARE(cursor->image(), blueScaled);
|
2022-03-23 10:13:38 +00:00
|
|
|
QCOMPARE(cursor->hotspot(), QPoint(6, 6)); // surface-local (so not changed)
|
2018-06-23 17:17:51 +00:00
|
|
|
|
2016-02-24 16:18:08 +00:00
|
|
|
// hide the cursor
|
|
|
|
pointer->setCursor(nullptr);
|
2016-06-30 11:32:54 +00:00
|
|
|
Test::flushWaylandConnection();
|
2020-04-02 16:18:01 +00:00
|
|
|
QTRY_VERIFY(cursor->image().isNull());
|
2016-02-24 16:18:08 +00:00
|
|
|
|
|
|
|
// move cursor somewhere else, should reset to fallback cursor
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().bottomLeft() + QPoint(20, 20));
|
2020-09-07 08:11:07 +00:00
|
|
|
QVERIFY(!p->focus());
|
2020-04-02 16:18:01 +00:00
|
|
|
QVERIFY(!cursor->image().isNull());
|
|
|
|
QCOMPARE(cursor->image(), fallbackCursor);
|
2016-02-24 16:18:08 +00:00
|
|
|
}
|
|
|
|
|
2016-02-25 08:04:29 +00:00
|
|
|
class HelperEffect : public Effect
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-03-23 10:13:38 +00:00
|
|
|
HelperEffect()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
~HelperEffect() override
|
|
|
|
{
|
|
|
|
}
|
2016-02-25 08:04:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void PointerInputTest::testEffectOverrideCursorImage()
|
|
|
|
{
|
|
|
|
// this test verifies the effect cursor override handling
|
2022-11-07 21:33:00 +00:00
|
|
|
|
2016-02-25 08:04:29 +00:00
|
|
|
// we need a pointer to get the enter event and set a cursor
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
2020-04-02 16:18:01 +00:00
|
|
|
auto cursor = Cursors::self()->mouse();
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left);
|
2016-02-25 08:04:29 +00:00
|
|
|
// move cursor somewhere the new window won't open
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(800, 800));
|
2016-02-25 08:04:29 +00:00
|
|
|
// here we should have the fallback cursor
|
2020-04-02 16:18:01 +00:00
|
|
|
const QImage fallback = cursor->image();
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(!fallback.isNull());
|
|
|
|
|
|
|
|
// now let's create a window
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
|
|
|
// and move cursor to the window
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(!exclusiveContains(window->frameGeometry(), QPoint(800, 800)));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
2018-05-01 13:33:33 +00:00
|
|
|
// cursor image should still be fallback
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(cursor->image(), fallback);
|
2016-02-25 08:04:29 +00:00
|
|
|
|
|
|
|
// now create an effect and set an override cursor
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<HelperEffect> effect(new HelperEffect);
|
|
|
|
effects->startMouseInterception(effect.get(), Qt::SizeAllCursor);
|
2020-04-02 16:18:01 +00:00
|
|
|
const QImage sizeAll = cursor->image();
|
2016-04-05 06:36:53 +00:00
|
|
|
QVERIFY(!sizeAll.isNull());
|
|
|
|
QVERIFY(sizeAll != fallback);
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(leftSpy.wait());
|
|
|
|
|
|
|
|
// let's change to arrow cursor, this should be our fallback
|
|
|
|
effects->defineCursor(Qt::ArrowCursor);
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(cursor->image(), fallback);
|
2016-02-25 08:04:29 +00:00
|
|
|
|
2016-04-05 06:36:53 +00:00
|
|
|
// back to size all
|
|
|
|
effects->defineCursor(Qt::SizeAllCursor);
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(cursor->image(), sizeAll);
|
2016-02-25 08:04:29 +00:00
|
|
|
|
|
|
|
// move cursor outside the window area
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(800, 800));
|
2016-02-25 08:04:29 +00:00
|
|
|
// and end the override, which should switch to fallback
|
2022-08-01 21:29:02 +00:00
|
|
|
effects->stopMouseInterception(effect.get());
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(cursor->image(), fallback);
|
2016-02-25 08:04:29 +00:00
|
|
|
|
|
|
|
// start mouse interception again
|
2022-08-01 21:29:02 +00:00
|
|
|
effects->startMouseInterception(effect.get(), Qt::SizeAllCursor);
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(cursor->image(), sizeAll);
|
2016-02-25 08:04:29 +00:00
|
|
|
|
|
|
|
// move cursor to area of window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2016-02-25 08:04:29 +00:00
|
|
|
// this should not result in an enter event
|
|
|
|
QVERIFY(!enteredSpy.wait(100));
|
|
|
|
|
|
|
|
// after ending the interception we should get an enter event
|
2022-08-01 21:29:02 +00:00
|
|
|
effects->stopMouseInterception(effect.get());
|
2016-02-25 08:04:29 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
2020-04-02 16:18:01 +00:00
|
|
|
QVERIFY(cursor->image().isNull());
|
2016-02-25 08:04:29 +00:00
|
|
|
}
|
|
|
|
|
2017-03-25 17:41:28 +00:00
|
|
|
void PointerInputTest::testPopup()
|
|
|
|
{
|
|
|
|
// this test validates the basic popup behavior
|
|
|
|
// a button press outside the window should dismiss the popup
|
|
|
|
|
|
|
|
// first create a parent surface
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left);
|
|
|
|
QSignalSpy buttonStateChangedSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged);
|
|
|
|
QSignalSpy motionSpy(pointer, &KWayland::Client::Pointer::motion);
|
2017-03-25 17:41:28 +00:00
|
|
|
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(800, 800));
|
2017-03-25 17:41:28 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
QCOMPARE(window->hasPopupGrab(), false);
|
|
|
|
// move pointer into window
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(!exclusiveContains(window->frameGeometry(), QPoint(800, 800)));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
// click inside window to create serial
|
|
|
|
quint32 timestamp = 0;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(buttonStateChangedSpy.wait());
|
|
|
|
|
|
|
|
// now create the popup surface
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<Test::XdgPositioner> positioner(Test::createXdgPositioner());
|
2021-05-11 05:26:51 +00:00
|
|
|
positioner->set_size(100, 50);
|
|
|
|
positioner->set_anchor_rect(0, 0, 80, 20);
|
|
|
|
positioner->set_anchor(Test::XdgPositioner::anchor_bottom_right);
|
|
|
|
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
2022-11-07 21:33:00 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> popupSurface = Test::createSurface();
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(popupSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgPopup *popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(popupShellSurface);
|
2021-05-11 05:26:51 +00:00
|
|
|
QSignalSpy doneReceivedSpy(popupShellSurface, &Test::XdgPopup::doneReceived);
|
|
|
|
popupShellSurface->grab(*Test::waylandSeat(), 0); // FIXME: Serial.
|
2022-08-16 11:43:33 +00:00
|
|
|
render(popupSurface.get(), QSize(100, 50));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
2022-04-23 19:51:16 +00:00
|
|
|
auto popupWindow = windowAddedSpy.last().first().value<Window *>();
|
|
|
|
QVERIFY(popupWindow);
|
|
|
|
QVERIFY(popupWindow != window);
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(window, workspace()->activeWindow());
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(popupWindow->transientFor(), window);
|
|
|
|
QCOMPARE(popupWindow->pos(), window->pos() + QPoint(80, 20));
|
|
|
|
QCOMPARE(popupWindow->hasPopupGrab(), true);
|
2017-03-25 17:41:28 +00:00
|
|
|
|
|
|
|
// let's move the pointer into the center of the window
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(popupWindow->frameGeometry().center());
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
QCOMPARE(enteredSpy.count(), 2);
|
|
|
|
QCOMPARE(leftSpy.count(), 1);
|
2022-08-16 11:43:33 +00:00
|
|
|
QCOMPARE(pointer->enteredSurface(), popupSurface.get());
|
2017-03-25 17:41:28 +00:00
|
|
|
|
|
|
|
// let's move the pointer outside of the popup window
|
|
|
|
// this should not really change anything, it gets a leave event
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(popupWindow->frameGeometry().bottomRight() + QPoint(2, 2));
|
2017-03-25 17:41:28 +00:00
|
|
|
QVERIFY(leftSpy.wait());
|
|
|
|
QCOMPARE(leftSpy.count(), 2);
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(doneReceivedSpy.isEmpty());
|
2017-03-25 17:41:28 +00:00
|
|
|
// now click, should trigger popupDone
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(doneReceivedSpy.wait());
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
2017-03-25 17:41:28 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 16:19:45 +00:00
|
|
|
void PointerInputTest::testDecoCancelsPopup()
|
|
|
|
{
|
|
|
|
// this test verifies that clicking the window decoration of parent window
|
|
|
|
// cancels the popup
|
|
|
|
|
|
|
|
// first create a parent surface
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left);
|
|
|
|
QSignalSpy buttonStateChangedSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged);
|
|
|
|
QSignalSpy motionSpy(pointer, &KWayland::Client::Pointer::motion);
|
2017-04-10 16:19:45 +00:00
|
|
|
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(800, 800));
|
2017-04-10 16:19:45 +00:00
|
|
|
|
2021-12-15 15:14:25 +00:00
|
|
|
// create a decorated window
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly));
|
|
|
|
std::unique_ptr<Test::XdgToplevelDecorationV1> decoration(Test::createXdgToplevelDecorationV1(shellSurface.get()));
|
2021-12-15 15:14:25 +00:00
|
|
|
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
|
|
|
decoration->set_mode(Test::XdgToplevelDecorationV1::mode_server_side);
|
|
|
|
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
|
|
|
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
|
|
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
2022-08-01 21:29:02 +00:00
|
|
|
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
2017-04-10 16:19:45 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
QCOMPARE(window->hasPopupGrab(), false);
|
|
|
|
QVERIFY(window->isDecorated());
|
|
|
|
|
|
|
|
// move pointer into window
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(!exclusiveContains(window->frameGeometry(), QPoint(800, 800)));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2017-04-10 16:19:45 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
// click inside window to create serial
|
|
|
|
quint32 timestamp = 0;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
2017-04-10 16:19:45 +00:00
|
|
|
QVERIFY(buttonStateChangedSpy.wait());
|
|
|
|
|
|
|
|
// now create the popup surface
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<Test::XdgPositioner> positioner(Test::createXdgPositioner());
|
2021-05-11 05:26:51 +00:00
|
|
|
positioner->set_size(100, 50);
|
|
|
|
positioner->set_anchor_rect(0, 0, 80, 20);
|
|
|
|
positioner->set_anchor(Test::XdgPositioner::anchor_bottom_right);
|
|
|
|
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
2022-11-07 21:33:00 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> popupSurface = Test::createSurface();
|
2017-04-10 16:19:45 +00:00
|
|
|
QVERIFY(popupSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgPopup *popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
2017-04-10 16:19:45 +00:00
|
|
|
QVERIFY(popupShellSurface);
|
2021-05-11 05:26:51 +00:00
|
|
|
QSignalSpy doneReceivedSpy(popupShellSurface, &Test::XdgPopup::doneReceived);
|
|
|
|
popupShellSurface->grab(*Test::waylandSeat(), 0); // FIXME: Serial.
|
2022-08-16 11:43:33 +00:00
|
|
|
auto popupWindow = Test::renderAndWaitForShown(popupSurface.get(), QSize(100, 50), Qt::red);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(popupWindow);
|
|
|
|
QVERIFY(popupWindow != window);
|
2022-04-23 08:33:23 +00:00
|
|
|
QCOMPARE(window, workspace()->activeWindow());
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(popupWindow->transientFor(), window);
|
2022-11-08 17:40:58 +00:00
|
|
|
QCOMPARE(popupWindow->pos(), window->mapFromLocal(QPoint(80, 20)));
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(popupWindow->hasPopupGrab(), true);
|
2017-04-10 16:19:45 +00:00
|
|
|
|
|
|
|
// let's move the pointer into the center of the deco
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(window->frameGeometry().center().x(), window->y() + (window->height() - window->clientSize().height()) / 2));
|
2017-04-10 16:19:45 +00:00
|
|
|
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_RIGHT, timestamp++);
|
2021-05-11 05:26:51 +00:00
|
|
|
QVERIFY(doneReceivedSpy.wait());
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonReleased(BTN_RIGHT, timestamp++);
|
2017-04-10 16:19:45 +00:00
|
|
|
}
|
|
|
|
|
2017-04-15 09:36:21 +00:00
|
|
|
void PointerInputTest::testWindowUnderCursorWhileButtonPressed()
|
|
|
|
{
|
|
|
|
// this test verifies that opening a window underneath the mouse cursor does not
|
|
|
|
// trigger a leave event if a button is pressed
|
|
|
|
// see BUG: 372876
|
|
|
|
|
|
|
|
// first create a parent surface
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
2022-11-07 21:33:00 +00:00
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left);
|
2017-04-15 09:36:21 +00:00
|
|
|
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(QPointF(800, 800));
|
2022-04-23 08:33:23 +00:00
|
|
|
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
2017-04-15 09:36:21 +00:00
|
|
|
QVERIFY(surface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgToplevel *shellSurface = Test::createXdgToplevelSurface(surface.get(), surface.get());
|
2017-04-15 09:36:21 +00:00
|
|
|
QVERIFY(shellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(surface.get());
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
|
|
|
Window *window = workspace()->activeWindow();
|
2017-04-15 09:36:21 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
|
|
|
|
// move cursor over window
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(!exclusiveContains(window->frameGeometry(), QPoint(800, 800)));
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2017-04-15 09:36:21 +00:00
|
|
|
QVERIFY(enteredSpy.wait());
|
|
|
|
// click inside window
|
|
|
|
quint32 timestamp = 0;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
2017-04-15 09:36:21 +00:00
|
|
|
|
|
|
|
// now create a second window as transient
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<Test::XdgPositioner> positioner(Test::createXdgPositioner());
|
2021-05-11 05:26:51 +00:00
|
|
|
positioner->set_size(99, 49);
|
|
|
|
positioner->set_anchor_rect(0, 0, 1, 1);
|
|
|
|
positioner->set_anchor(Test::XdgPositioner::anchor_bottom_right);
|
|
|
|
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
2022-11-07 21:33:00 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> popupSurface = Test::createSurface();
|
2017-04-15 09:36:21 +00:00
|
|
|
QVERIFY(popupSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
Test::XdgPopup *popupShellSurface = Test::createXdgPopupSurface(popupSurface.get(), shellSurface->xdgSurface(), positioner.get());
|
2017-04-15 09:36:21 +00:00
|
|
|
QVERIFY(popupShellSurface);
|
2022-08-16 11:43:33 +00:00
|
|
|
render(popupSurface.get(), QSize(99, 49));
|
2022-04-23 08:33:23 +00:00
|
|
|
QVERIFY(windowAddedSpy.wait());
|
2022-04-23 19:51:16 +00:00
|
|
|
auto popupWindow = windowAddedSpy.last().first().value<Window *>();
|
|
|
|
QVERIFY(popupWindow);
|
|
|
|
QVERIFY(popupWindow != window);
|
2023-02-20 21:36:45 +00:00
|
|
|
QVERIFY(exclusiveContains(window->frameGeometry(), Cursors::self()->mouse()->pos()));
|
|
|
|
QVERIFY(exclusiveContains(popupWindow->frameGeometry(), Cursors::self()->mouse()->pos()));
|
2017-04-15 09:36:21 +00:00
|
|
|
QVERIFY(!leftSpy.wait());
|
|
|
|
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
2017-04-15 09:36:21 +00:00
|
|
|
// now that the button is no longer pressed we should get the leave event
|
|
|
|
QVERIFY(leftSpy.wait());
|
|
|
|
QCOMPARE(leftSpy.count(), 1);
|
|
|
|
QCOMPARE(enteredSpy.count(), 2);
|
|
|
|
}
|
|
|
|
|
2018-07-10 18:09:22 +00:00
|
|
|
void PointerInputTest::testConfineToScreenGeometry_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<QPoint>("startPos");
|
|
|
|
QTest::addColumn<QPoint>("targetPos");
|
|
|
|
QTest::addColumn<QPoint>("expectedPos");
|
|
|
|
|
|
|
|
// screen layout:
|
|
|
|
//
|
|
|
|
// +----------+----------+---------+
|
|
|
|
// | left | top | right |
|
|
|
|
// +----------+----------+---------+
|
|
|
|
// | bottom |
|
|
|
|
// +----------+
|
|
|
|
//
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("move top-left - left screen") << QPoint(640, 512) << QPoint(-100, -100) << QPoint(0, 0);
|
|
|
|
QTest::newRow("move top - left screen") << QPoint(640, 512) << QPoint(640, -100) << QPoint(640, 0);
|
|
|
|
QTest::newRow("move top-right - left screen") << QPoint(640, 512) << QPoint(1380, -100) << QPoint(1380, 0);
|
|
|
|
QTest::newRow("move right - left screen") << QPoint(640, 512) << QPoint(1380, 512) << QPoint(1380, 512);
|
|
|
|
QTest::newRow("move bottom-right - left screen") << QPoint(640, 512) << QPoint(1380, 1124) << QPoint(1380, 1124);
|
|
|
|
QTest::newRow("move bottom - left screen") << QPoint(640, 512) << QPoint(640, 1124) << QPoint(640, 1023);
|
|
|
|
QTest::newRow("move bottom-left - left screen") << QPoint(640, 512) << QPoint(-100, 1124) << QPoint(0, 1023);
|
|
|
|
QTest::newRow("move left - left screen") << QPoint(640, 512) << QPoint(-100, 512) << QPoint(0, 512);
|
|
|
|
|
|
|
|
QTest::newRow("move top-left - top screen") << QPoint(1920, 512) << QPoint(1180, -100) << QPoint(1180, 0);
|
|
|
|
QTest::newRow("move top - top screen") << QPoint(1920, 512) << QPoint(1920, -100) << QPoint(1920, 0);
|
|
|
|
QTest::newRow("move top-right - top screen") << QPoint(1920, 512) << QPoint(2660, -100) << QPoint(2660, 0);
|
|
|
|
QTest::newRow("move right - top screen") << QPoint(1920, 512) << QPoint(2660, 512) << QPoint(2660, 512);
|
2023-02-22 19:01:22 +00:00
|
|
|
QTest::newRow("move bottom-right - top screen") << QPoint(1920, 512) << QPoint(2660, 1124) << QPoint(2660, 1023);
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("move bottom - top screen") << QPoint(1920, 512) << QPoint(1920, 1124) << QPoint(1920, 1124);
|
2023-02-22 19:01:22 +00:00
|
|
|
QTest::newRow("move bottom-left - top screen") << QPoint(1920, 512) << QPoint(1180, 1124) << QPoint(1180, 1023);
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("move left - top screen") << QPoint(1920, 512) << QPoint(1180, 512) << QPoint(1180, 512);
|
|
|
|
|
|
|
|
QTest::newRow("move top-left - right screen") << QPoint(3200, 512) << QPoint(2460, -100) << QPoint(2460, 0);
|
|
|
|
QTest::newRow("move top - right screen") << QPoint(3200, 512) << QPoint(3200, -100) << QPoint(3200, 0);
|
|
|
|
QTest::newRow("move top-right - right screen") << QPoint(3200, 512) << QPoint(3940, -100) << QPoint(3839, 0);
|
|
|
|
QTest::newRow("move right - right screen") << QPoint(3200, 512) << QPoint(3940, 512) << QPoint(3839, 512);
|
|
|
|
QTest::newRow("move bottom-right - right screen") << QPoint(3200, 512) << QPoint(3940, 1124) << QPoint(3839, 1023);
|
|
|
|
QTest::newRow("move bottom - right screen") << QPoint(3200, 512) << QPoint(3200, 1124) << QPoint(3200, 1023);
|
|
|
|
QTest::newRow("move bottom-left - right screen") << QPoint(3200, 512) << QPoint(2460, 1124) << QPoint(2460, 1124);
|
|
|
|
QTest::newRow("move left - right screen") << QPoint(3200, 512) << QPoint(2460, 512) << QPoint(2460, 512);
|
|
|
|
|
|
|
|
QTest::newRow("move top-left - bottom screen") << QPoint(1920, 1536) << QPoint(1180, 924) << QPoint(1180, 924);
|
|
|
|
QTest::newRow("move top - bottom screen") << QPoint(1920, 1536) << QPoint(1920, 924) << QPoint(1920, 924);
|
|
|
|
QTest::newRow("move top-right - bottom screen") << QPoint(1920, 1536) << QPoint(2660, 924) << QPoint(2660, 924);
|
|
|
|
QTest::newRow("move right - bottom screen") << QPoint(1920, 1536) << QPoint(2660, 1536) << QPoint(2559, 1536);
|
2018-07-10 18:09:22 +00:00
|
|
|
QTest::newRow("move bottom-right - bottom screen") << QPoint(1920, 1536) << QPoint(2660, 2148) << QPoint(2559, 2047);
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("move bottom - bottom screen") << QPoint(1920, 1536) << QPoint(1920, 2148) << QPoint(1920, 2047);
|
|
|
|
QTest::newRow("move bottom-left - bottom screen") << QPoint(1920, 1536) << QPoint(1180, 2148) << QPoint(1280, 2047);
|
|
|
|
QTest::newRow("move left - bottom screen") << QPoint(1920, 1536) << QPoint(1180, 1536) << QPoint(1280, 1536);
|
2018-07-10 18:09:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testConfineToScreenGeometry()
|
|
|
|
{
|
|
|
|
// this test verifies that pointer belongs to at least one screen
|
|
|
|
// after moving it to off-screen area
|
|
|
|
|
2022-05-08 12:19:51 +00:00
|
|
|
// unload the Window View effect because it pushes back
|
2018-07-10 18:09:22 +00:00
|
|
|
// pointer if it's at (0, 0)
|
2022-05-08 12:19:51 +00:00
|
|
|
static_cast<EffectsHandlerImpl *>(effects)->unloadEffect(QStringLiteral("windowview"));
|
2018-07-10 18:09:22 +00:00
|
|
|
|
|
|
|
// setup screen layout
|
2022-03-23 10:13:38 +00:00
|
|
|
const QVector<QRect> geometries{
|
2018-07-10 18:09:22 +00:00
|
|
|
QRect(0, 0, 1280, 1024),
|
|
|
|
QRect(1280, 0, 1280, 1024),
|
|
|
|
QRect(2560, 0, 1280, 1024),
|
2022-03-23 10:13:38 +00:00
|
|
|
QRect(1280, 1024, 1280, 1024)};
|
2022-11-16 21:03:50 +00:00
|
|
|
QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector<QRect>, geometries));
|
2022-07-11 12:20:35 +00:00
|
|
|
|
2022-07-11 10:41:15 +00:00
|
|
|
const auto outputs = workspace()->outputs();
|
2022-07-11 12:20:35 +00:00
|
|
|
QCOMPARE(outputs.count(), geometries.count());
|
|
|
|
QCOMPARE(outputs[0]->geometry(), geometries.at(0));
|
|
|
|
QCOMPARE(outputs[1]->geometry(), geometries.at(1));
|
|
|
|
QCOMPARE(outputs[2]->geometry(), geometries.at(2));
|
|
|
|
QCOMPARE(outputs[3]->geometry(), geometries.at(3));
|
2018-07-10 18:09:22 +00:00
|
|
|
|
|
|
|
// move pointer to initial position
|
|
|
|
QFETCH(QPoint, startPos);
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(startPos);
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(Cursors::self()->mouse()->pos(), startPos);
|
2018-07-10 18:09:22 +00:00
|
|
|
|
|
|
|
// perform movement
|
|
|
|
QFETCH(QPoint, targetPos);
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::pointerMotion(targetPos, 1);
|
2018-07-10 18:09:22 +00:00
|
|
|
|
|
|
|
QFETCH(QPoint, expectedPos);
|
2020-04-02 16:18:01 +00:00
|
|
|
QCOMPARE(Cursors::self()->mouse()->pos(), expectedPos);
|
2018-07-10 18:09:22 +00:00
|
|
|
}
|
|
|
|
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
void PointerInputTest::testResizeCursor_data()
|
|
|
|
{
|
|
|
|
QTest::addColumn<Qt::Edges>("edges");
|
|
|
|
QTest::addColumn<KWin::CursorShape>("cursorShape");
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("top-left") << Qt::Edges(Qt::TopEdge | Qt::LeftEdge) << CursorShape(ExtendedCursor::SizeNorthWest);
|
|
|
|
QTest::newRow("top") << Qt::Edges(Qt::TopEdge) << CursorShape(ExtendedCursor::SizeNorth);
|
|
|
|
QTest::newRow("top-right") << Qt::Edges(Qt::TopEdge | Qt::RightEdge) << CursorShape(ExtendedCursor::SizeNorthEast);
|
|
|
|
QTest::newRow("right") << Qt::Edges(Qt::RightEdge) << CursorShape(ExtendedCursor::SizeEast);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
QTest::newRow("bottom-right") << Qt::Edges(Qt::BottomEdge | Qt::RightEdge) << CursorShape(ExtendedCursor::SizeSouthEast);
|
2022-03-23 10:13:38 +00:00
|
|
|
QTest::newRow("bottom") << Qt::Edges(Qt::BottomEdge) << CursorShape(ExtendedCursor::SizeSouth);
|
|
|
|
QTest::newRow("bottom-left") << Qt::Edges(Qt::BottomEdge | Qt::LeftEdge) << CursorShape(ExtendedCursor::SizeSouthWest);
|
|
|
|
QTest::newRow("left") << Qt::Edges(Qt::LeftEdge) << CursorShape(ExtendedCursor::SizeWest);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testResizeCursor()
|
|
|
|
{
|
|
|
|
// this test verifies that the cursor has correct shape during resize operation
|
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
2020-05-06 09:17:44 +00:00
|
|
|
group.writeEntry("CommandAllKey", "Meta");
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
group.writeEntry("CommandAll3", "Resize");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
2020-05-06 09:17:44 +00:00
|
|
|
QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedResize);
|
|
|
|
|
2021-02-22 13:41:31 +00:00
|
|
|
// load the fallback cursor (arrow cursor)
|
|
|
|
const PlatformCursorImage arrowCursor = loadReferenceThemeCursor(Qt::ArrowCursor);
|
|
|
|
QVERIFY(!arrowCursor.isNull());
|
2022-11-05 10:14:59 +00:00
|
|
|
QCOMPARE(kwinApp()->cursorImage().image(), arrowCursor.image());
|
|
|
|
QCOMPARE(kwinApp()->cursorImage().hotSpot(), arrowCursor.hotSpot());
|
2021-02-22 13:41:31 +00:00
|
|
|
|
|
|
|
// we need a pointer to get the enter event
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// create a test window
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
QVERIFY(surface != nullptr);
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
|
|
|
QVERIFY(shellSurface != nullptr);
|
|
|
|
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
|
|
|
// move the cursor to the test position
|
|
|
|
QPoint cursorPos;
|
|
|
|
QFETCH(Qt::Edges, edges);
|
|
|
|
|
|
|
|
if (edges & Qt::LeftEdge) {
|
2022-04-23 19:51:16 +00:00
|
|
|
cursorPos.setX(window->frameGeometry().left());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
} else if (edges & Qt::RightEdge) {
|
2022-05-16 20:13:39 +00:00
|
|
|
cursorPos.setX(window->frameGeometry().right() - 1);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
} else {
|
2022-04-23 19:51:16 +00:00
|
|
|
cursorPos.setX(window->frameGeometry().center().x());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (edges & Qt::TopEdge) {
|
2022-04-23 19:51:16 +00:00
|
|
|
cursorPos.setY(window->frameGeometry().top());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
} else if (edges & Qt::BottomEdge) {
|
2022-05-16 20:13:39 +00:00
|
|
|
cursorPos.setY(window->frameGeometry().bottom() - 1);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
} else {
|
2022-04-23 19:51:16 +00:00
|
|
|
cursorPos.setY(window->frameGeometry().center().y());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
}
|
|
|
|
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(cursorPos);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2021-02-22 13:41:31 +00:00
|
|
|
// wait for the enter event and set the cursor
|
|
|
|
QVERIFY(enteredSpy.wait());
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> cursorSurface(Test::createSurface());
|
2021-02-22 13:41:31 +00:00
|
|
|
QVERIFY(cursorSurface);
|
2022-08-01 21:29:02 +00:00
|
|
|
QSignalSpy cursorRenderedSpy(cursorSurface.get(), &KWayland::Client::Surface::frameRendered);
|
2021-02-22 13:41:31 +00:00
|
|
|
cursorSurface->attachBuffer(Test::waylandShmPool()->createBuffer(arrowCursor.image()));
|
|
|
|
cursorSurface->damage(arrowCursor.image().rect());
|
|
|
|
cursorSurface->commit();
|
2023-02-19 23:35:44 +00:00
|
|
|
pointer->setCursor(cursorSurface.get(), arrowCursor.hotSpot().toPoint());
|
2021-02-22 13:41:31 +00:00
|
|
|
QVERIFY(cursorRenderedSpy.wait());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// start resizing the window
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
int timestamp = 1;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
|
|
|
|
Test::pointerButtonPressed(BTN_RIGHT, timestamp++);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window->isInteractiveResize());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
|
|
|
QFETCH(KWin::CursorShape, cursorShape);
|
|
|
|
const PlatformCursorImage resizeCursor = loadReferenceThemeCursor(cursorShape);
|
2020-05-18 19:37:41 +00:00
|
|
|
QVERIFY(!resizeCursor.isNull());
|
2022-11-05 10:14:59 +00:00
|
|
|
QCOMPARE(kwinApp()->cursorImage().image(), resizeCursor.image());
|
|
|
|
QCOMPARE(kwinApp()->cursorImage().hotSpot(), resizeCursor.hotSpot());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// finish resizing the window
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
|
|
|
|
Test::pointerButtonReleased(BTN_RIGHT, timestamp++);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->isInteractiveResize());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2022-11-05 10:14:59 +00:00
|
|
|
QCOMPARE(kwinApp()->cursorImage().image(), arrowCursor.image());
|
|
|
|
QCOMPARE(kwinApp()->cursorImage().hotSpot(), arrowCursor.hotSpot());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testMoveCursor()
|
|
|
|
{
|
|
|
|
// this test verifies that the cursor has correct shape during move operation
|
|
|
|
|
|
|
|
// first modify the config for this run
|
|
|
|
KConfigGroup group = kwinApp()->config()->group("MouseBindings");
|
2020-05-06 09:17:44 +00:00
|
|
|
group.writeEntry("CommandAllKey", "Meta");
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
group.writeEntry("CommandAll1", "Move");
|
|
|
|
group.sync();
|
|
|
|
workspace()->slotReconfigure();
|
2020-05-06 09:17:44 +00:00
|
|
|
QCOMPARE(options->commandAllModifier(), Qt::MetaModifier);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
|
|
|
|
|
2021-02-22 13:41:31 +00:00
|
|
|
// load the fallback cursor (arrow cursor)
|
|
|
|
const PlatformCursorImage arrowCursor = loadReferenceThemeCursor(Qt::ArrowCursor);
|
|
|
|
QVERIFY(!arrowCursor.isNull());
|
2022-11-05 10:14:59 +00:00
|
|
|
QCOMPARE(kwinApp()->cursorImage().image(), arrowCursor.image());
|
|
|
|
QCOMPARE(kwinApp()->cursorImage().hotSpot(), arrowCursor.hotSpot());
|
2021-02-22 13:41:31 +00:00
|
|
|
|
|
|
|
// we need a pointer to get the enter event
|
|
|
|
auto pointer = m_seat->createPointer(m_seat);
|
|
|
|
QVERIFY(pointer);
|
|
|
|
QVERIFY(pointer->isValid());
|
|
|
|
QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered);
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// create a test window
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
QVERIFY(surface != nullptr);
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
|
|
|
QVERIFY(shellSurface != nullptr);
|
|
|
|
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
|
|
|
// move cursor to the test position
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2021-02-22 13:41:31 +00:00
|
|
|
// wait for the enter event and set the cursor
|
|
|
|
QVERIFY(enteredSpy.wait());
|
2022-08-16 11:43:33 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> cursorSurface = Test::createSurface();
|
2021-02-22 13:41:31 +00:00
|
|
|
QVERIFY(cursorSurface);
|
2022-08-01 21:29:02 +00:00
|
|
|
QSignalSpy cursorRenderedSpy(cursorSurface.get(), &KWayland::Client::Surface::frameRendered);
|
2021-02-22 13:41:31 +00:00
|
|
|
cursorSurface->attachBuffer(Test::waylandShmPool()->createBuffer(arrowCursor.image()));
|
|
|
|
cursorSurface->damage(arrowCursor.image().rect());
|
|
|
|
cursorSurface->commit();
|
2023-02-19 23:35:44 +00:00
|
|
|
pointer->setCursor(cursorSurface.get(), arrowCursor.hotSpot().toPoint());
|
2021-02-22 13:41:31 +00:00
|
|
|
QVERIFY(cursorRenderedSpy.wait());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// start moving the window
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
int timestamp = 1;
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
|
|
|
|
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window->isInteractiveMove());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
|
|
|
const PlatformCursorImage sizeAllCursor = loadReferenceThemeCursor(Qt::SizeAllCursor);
|
2020-05-18 19:37:41 +00:00
|
|
|
QVERIFY(!sizeAllCursor.isNull());
|
2022-11-05 10:14:59 +00:00
|
|
|
QCOMPARE(kwinApp()->cursorImage().image(), sizeAllCursor.image());
|
|
|
|
QCOMPARE(kwinApp()->cursorImage().hotSpot(), sizeAllCursor.hotSpot());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// finish moving the window
|
2022-03-10 10:27:35 +00:00
|
|
|
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
|
|
|
|
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(!window->isInteractiveMove());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
|
2022-11-05 10:14:59 +00:00
|
|
|
QCOMPARE(kwinApp()->cursorImage().image(), arrowCursor.image());
|
|
|
|
QCOMPARE(kwinApp()->cursorImage().hotSpot(), arrowCursor.hotSpot());
|
[wayland] Don't use hardcoded move-resize cursor
Summary:
Currently, when resizing a window the cursor doesn't match the resize
direction. The reason for that is the move-resize cursor is hardcoded.
To fix that, CursorImage::updateMoveResize has to use AbstractClient::cursor.
Also, because the move-resize cursor is updated after calling startMoveResize,
we have to connect to AbstractClient::moveResizeCursorChanged.
BUG: 370339
FIXED-IN: 5.15
Reviewers: #kwin, davidedmundson, broulik, romangg, graesslin
Reviewed By: #kwin, graesslin
Subscribers: davidedmundson, romangg, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T5714
Differential Revision: https://phabricator.kde.org/D3202
2018-12-25 15:30:38 +00:00
|
|
|
}
|
|
|
|
|
2019-08-27 15:01:14 +00:00
|
|
|
void PointerInputTest::testHideShowCursor()
|
|
|
|
{
|
2021-12-25 17:12:12 +00:00
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), false);
|
|
|
|
Cursors::self()->hideCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), true);
|
|
|
|
Cursors::self()->showCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), false);
|
|
|
|
|
|
|
|
Cursors::self()->hideCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), true);
|
|
|
|
Cursors::self()->hideCursor();
|
|
|
|
Cursors::self()->hideCursor();
|
|
|
|
Cursors::self()->hideCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), true);
|
|
|
|
|
|
|
|
Cursors::self()->showCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), true);
|
|
|
|
Cursors::self()->showCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), true);
|
|
|
|
Cursors::self()->showCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), true);
|
|
|
|
Cursors::self()->showCursor();
|
|
|
|
QCOMPARE(Cursors::self()->isCursorHidden(), false);
|
2019-08-27 15:01:14 +00:00
|
|
|
}
|
|
|
|
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
void PointerInputTest::testDefaultInputRegion()
|
|
|
|
{
|
|
|
|
// This test verifies that a surface that hasn't specified the input region can be focused.
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// Create a test window.
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
QVERIFY(surface != nullptr);
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
|
|
|
QVERIFY(shellSurface != nullptr);
|
|
|
|
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
|
|
|
|
// Move the point to the center of the surface.
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface());
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// Destroy the test window.
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
shellSurface.reset();
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(Test::waitForWindowDestroyed(window));
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PointerInputTest::testEmptyInputRegion()
|
|
|
|
{
|
|
|
|
// This test verifies that a surface that has specified an empty input region can't be focused.
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// Create a test window.
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
QVERIFY(surface != nullptr);
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Region> inputRegion(m_compositor->createRegion(QRegion()));
|
|
|
|
surface->setInputRegion(inputRegion.get());
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
|
|
|
QVERIFY(shellSurface != nullptr);
|
|
|
|
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
|
|
|
|
// Move the point to the center of the surface.
|
2023-02-09 13:07:56 +00:00
|
|
|
input()->pointer()->warp(window->frameGeometry().center());
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
QVERIFY(!waylandServer()->seat()->focusedPointerSurface());
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
// Destroy the test window.
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
shellSurface.reset();
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(Test::waitForWindowDestroyed(window));
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
}
|
|
|
|
|
2016-02-11 11:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WAYLANDTEST_MAIN(KWin::PointerInputTest)
|
|
|
|
#include "pointer_input.moc"
|