diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-12-06 12:00:55 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2019-02-15 09:12:35 +0000 |
commit | 15b3afd621a5c0e8d1dd1cd9d5ae816e15aa4a1a (patch) | |
tree | efe8e2944f983d1b263ce44efeb2a3eeee6ef0bb /src/client/qwaylanddisplay_p.h | |
parent | 8073af6668cbcf308c83359ef2797d85d971946f (diff) | |
download | qtwayland-15b3afd621a5c0e8d1dd1cd9d5ae816e15aa4a1a.tar.gz |
Client: Refactor cursors and fix various bugs
This patch is mostly a cleanup to prepare for implementations of
xcursor-configuration, but also fixes a couple of issues.
Most of the logic has now been moved out of QWaylandDisplay and QWaylandCursor
and into QWaylandInputDevice and QWaylandInputDevice::Pointer. QWaylandDisplay
now only contains mechanisms for avoiding loading the same theme multiple
times.
There is now only one setCursor method on QWaylandInputDevice, accepting a
QCursor and storing its values so changing scale factor doesn't require calling
setCursor again. QWaylandInputDevice::Pointer::updateCursor() is called
instead.
Cursor buffer scale is now set according to enter/leave events of the cursor
surface itself instead of the current window, this fixes incorrect buffer
scales for cursors on windows that span multiple outputs. The window buffer
scale can still be passed into the seat as a fallback until the first enter
event is received.
This also fixes a bug where the QWaylandBuffer of a bitmap cursor could be
deleted while it was being used as a cursor.
[ChangeLog][QPA plugin] Fixed a bug where the DPI of bitmap cursors were not
sent to the compositor, leading to the compositor incorrectly scaling the
cursor up or down.
[ChangeLog][QPA plugin] Fixed a bug where bitmap cursor hotspots were off when
the screen scale factor was different from the bitmap cursor device pixel
ratio.
Task-number: QTBUG-68571
Change-Id: I747a47ffff01b7b5f6a0ede3552ab37884c4fa60
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylanddisplay_p.h')
-rw-r--r-- | src/client/qwaylanddisplay_p.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 41ad7025..4a98b935 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -93,6 +93,7 @@ class QWaylandWindow; class QWaylandIntegration; class QWaylandHardwareIntegration; class QWaylandShellSurface; +class QWaylandCursor; class QWaylandCursorTheme; typedef void (*RegistryListener)(void *data, @@ -121,9 +122,8 @@ public: QWaylandWindowManagerIntegration *windowManagerIntegration() const; #if QT_CONFIG(cursor) - void setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr); - void setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot, qreal dpr); - QWaylandCursorTheme *loadCursorTheme(qreal devicePixelRatio); + QWaylandCursor *waylandCursor(); + QWaylandCursorTheme *loadCursorTheme(const QString &name, int pixelSize); #endif struct wl_display *wl_display() const { return mDisplay; } struct ::wl_registry *wl_registry() { return object(); } @@ -210,7 +210,8 @@ private: QList<Listener> mRegistryListeners; QWaylandIntegration *mWaylandIntegration = nullptr; #if QT_CONFIG(cursor) - QMap<int, QWaylandCursorTheme *> mCursorThemesBySize; + QMap<std::pair<QString, int>, QWaylandCursorTheme *> mCursorThemes; // theme name and size + QScopedPointer<QWaylandCursor> mCursor; #endif #if QT_CONFIG(wayland_datadevice) QScopedPointer<QWaylandDataDeviceManager> mDndSelectionHandler; |