summaryrefslogtreecommitdiff
path: root/src/client/qwaylanddisplay.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2019-03-21 11:42:15 +0100
committerPaul Olav Tvete <paul.tvete@qt.io>2019-03-21 11:57:15 +0100
commit77e8ee63dc9ad0a4c139f35f8cf078d1a5bd315c (patch)
tree499f94df98fc25bca2982fba4dd67457f42bd6b9 /src/client/qwaylanddisplay.cpp
parentdf3a1761af2f20d59ae09a7adaa2f5b959047687 (diff)
parentc0905957be0d7db90c9d9f05069a259575753dfe (diff)
downloadqtwayland-77e8ee63dc9ad0a4c139f35f8cf078d1a5bd315c.tar.gz
Merge remote-tracking branch 'qt/5.13' into dev
Change-Id: I3dc204fcaa71c01a80b0c622443012eb07964431
Diffstat (limited to 'src/client/qwaylanddisplay.cpp')
-rw-r--r--src/client/qwaylanddisplay.cpp41
1 files changed, 11 insertions, 30 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 77db05f1..1063fd59 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -50,6 +50,7 @@
#endif
#if QT_CONFIG(wayland_datadevice)
#include "qwaylanddatadevicemanager_p.h"
+#include "qwaylanddatadevice_p.h"
#endif
#if QT_CONFIG(cursor)
#include <wayland-cursor.h>
@@ -160,7 +161,7 @@ QWaylandDisplay::~QWaylandDisplay(void)
delete mDndSelectionHandler.take();
#endif
#if QT_CONFIG(cursor)
- qDeleteAll(mCursorThemesBySize);
+ qDeleteAll(mCursorThemes);
#endif
if (mDisplay)
wl_display_disconnect(mDisplay);
@@ -505,40 +506,20 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const
#if QT_CONFIG(cursor)
-void QWaylandDisplay::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image, qreal dpr)
+QWaylandCursor *QWaylandDisplay::waylandCursor()
{
- /* Qt doesn't tell us which input device we should set the cursor
- * for, so set it for all devices. */
- for (int i = 0; i < mInputDevices.count(); i++) {
- QWaylandInputDevice *inputDevice = mInputDevices.at(i);
- inputDevice->setCursor(buffer, image, dpr);
- }
-}
-
-void QWaylandDisplay::setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot, qreal dpr)
-{
- /* Qt doesn't tell us which input device we should set the cursor
- * for, so set it for all devices. */
- for (int i = 0; i < mInputDevices.count(); i++) {
- QWaylandInputDevice *inputDevice = mInputDevices.at(i);
- inputDevice->setCursor(buffer, hotSpot, dpr);
- }
+ if (!mCursor)
+ mCursor.reset(new QWaylandCursor(this));
+ return mCursor.data();
}
-QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio)
+QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(const QString &name, int pixelSize)
{
- constexpr int defaultCursorSize = 32;
- static const int xCursorSize = qEnvironmentVariableIntValue("XCURSOR_SIZE");
- int cursorSize = xCursorSize > 0 ? xCursorSize : defaultCursorSize;
-
- if (compositorVersion() >= 3) // set_buffer_scale is not supported on earlier versions
- cursorSize *= devicePixelRatio;
-
- if (auto *theme = mCursorThemesBySize.value(cursorSize, nullptr))
+ if (auto *theme = mCursorThemes.value({name, pixelSize}, nullptr))
return theme;
- if (auto *theme = QWaylandCursorTheme::create(shm(), cursorSize)) {
- mCursorThemesBySize[cursorSize] = theme;
+ if (auto *theme = QWaylandCursorTheme::create(shm(), pixelSize, name)) {
+ mCursorThemes[{name, pixelSize}] = theme;
return theme;
}
@@ -547,6 +528,6 @@ QWaylandCursorTheme *QWaylandDisplay::loadCursorTheme(qreal devicePixelRatio)
#endif // QT_CONFIG(cursor)
-}
+} // namespace QtWaylandClient
QT_END_NAMESPACE