summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/qwaylanddisplay.cpp3
-rw-r--r--src/client/qwaylanddisplay_p.h2
-rw-r--r--src/client/qwaylandinputdevice.cpp22
-rw-r--r--src/client/qwaylandinputdevice_p.h1
-rw-r--r--src/client/qwaylandscreen.cpp1
-rw-r--r--src/client/qwaylandscreen_p.h3
-rw-r--r--src/client/qwaylandwindow.cpp10
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.cpp8
8 files changed, 23 insertions, 27 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index a3bd27ff2..6c226a350 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -329,8 +329,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
if (interface == QStringLiteral("wl_output")) {
mWaitingScreens << mWaylandIntegration->createPlatformScreen(this, version, id);
} else if (interface == QStringLiteral("wl_compositor")) {
- mCompositorVersion = qMin((int)version, 4);
- mCompositor.init(registry, id, mCompositorVersion);
+ mCompositor.init(registry, id, qMin((int)version, 4));
} else if (interface == QStringLiteral("wl_shm")) {
mShm.reset(new QWaylandShm(this, version, id));
} else if (interface == QStringLiteral("wl_seat")) {
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index e5cdbee9a..38bc35ff1 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -158,7 +158,6 @@ public:
const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
QtWayland::wl_compositor *compositor() { return &mCompositor; }
- int compositorVersion() const { return mCompositorVersion; }
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
QWaylandInputDevice *defaultInputDevice() const;
@@ -287,7 +286,6 @@ private:
int mFd = -1;
int mWritableNotificationFd = -1;
QList<RegistryGlobal> mGlobals;
- int mCompositorVersion = -1;
uint32_t mLastInputSerial = 0;
QWaylandInputDevice *mLastInputDevice = nullptr;
QPointer<QWaylandWindow> mLastInputWindow;
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 5be49993a..fb9c63d8f 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -132,7 +132,7 @@ QWaylandInputDevice::Keyboard::~Keyboard()
{
if (mFocus)
QWindowSystemInterface::handleWindowActivated(nullptr);
- if (mParent->mVersion >= 3)
+ if (version() >= 3)
wl_keyboard_release(object());
else
wl_keyboard_destroy(object());
@@ -156,7 +156,7 @@ QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat)
QWaylandInputDevice::Pointer::~Pointer()
{
- if (mParent->mVersion >= 3)
+ if (version() >= 3)
wl_pointer_release(object());
else
wl_pointer_destroy(object());
@@ -197,8 +197,6 @@ public:
: QWaylandSurface(display)
, m_pointer(pointer)
{
- //TODO: When we upgrade to libwayland 1.10, use wl_surface_get_version instead.
- m_version = display->compositorVersion();
connect(this, &QWaylandSurface::screensChanged,
m_pointer, &QWaylandInputDevice::Pointer::updateCursor);
}
@@ -215,7 +213,7 @@ public:
void update(wl_buffer *buffer, const QPoint &hotspot, const QSize &size, int bufferScale, bool animated = false)
{
// Calling code needs to ensure buffer scale is supported if != 1
- Q_ASSERT(bufferScale == 1 || m_version >= 3);
+ Q_ASSERT(bufferScale == 1 || version() >= 3);
auto enterSerial = m_pointer->mEnterSerial;
if (m_setSerial < enterSerial || m_hotspot != hotspot) {
@@ -224,7 +222,7 @@ public:
m_hotspot = hotspot;
}
- if (m_version >= 3)
+ if (version() >= 3)
set_buffer_scale(bufferScale);
attach(buffer, 0, 0);
@@ -250,7 +248,6 @@ public:
private:
QScopedPointer<WlCallback> m_frameCallback;
QWaylandInputDevice::Pointer *m_pointer = nullptr;
- uint m_version = 0;
uint m_setSerial = 0;
QPoint m_hotspot;
};
@@ -270,9 +267,9 @@ int QWaylandInputDevice::Pointer::cursorSize() const
int QWaylandInputDevice::Pointer::idealCursorScale() const
{
- // set_buffer_scale is not supported on earlier versions
- if (seat()->mQDisplay->compositorVersion() < 3)
+ if (seat()->mQDisplay->compositor()->version() < 3) {
return 1;
+ }
if (auto *s = mCursor.surface.data()) {
if (s->outputScale() > 0)
@@ -394,7 +391,7 @@ QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p)
QWaylandInputDevice::Touch::~Touch()
{
- if (mParent->mVersion >= 3)
+ if (version() >= 3)
wl_touch_release(object());
else
wl_touch_destroy(object());
@@ -404,7 +401,6 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version,
: QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 5))
, mQDisplay(display)
, mDisplay(display->wl_display())
- , mVersion(qMin(version, 5))
{
#if QT_CONFIG(wayland_datadevice)
if (mQDisplay->dndSelectionHandler()) {
@@ -901,7 +897,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in
mParent->mTime = time;
- if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) {
+ if (version() < WL_POINTER_FRAME_SINCE_VERSION) {
qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version";
flushFrameEvent();
}
@@ -1000,7 +996,7 @@ void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event)
mFrameData.event = event;
- if (mParent->mVersion < WL_POINTER_FRAME_SINCE_VERSION) {
+ if (version() < WL_POINTER_FRAME_SINCE_VERSION) {
qCDebug(lcQpaWaylandInput) << "Flushing new event; no frame event in this version";
flushFrameEvent();
}
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index 303c9bb31..b23de1f42 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -164,7 +164,6 @@ protected:
QWaylandDisplay *mQDisplay = nullptr;
struct wl_display *mDisplay = nullptr;
- int mVersion;
uint32_t mCaps = 0;
#if QT_CONFIG(cursor)
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index 854f3b082..40a49d884 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -55,7 +55,6 @@ namespace QtWaylandClient {
QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version)
: QtWayland::zxdg_output_manager_v1(display->wl_registry(), id, qMin(3u, version))
- , m_version(qMin(3u, version))
{
}
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
index 5553208ee..fc30a482a 100644
--- a/src/client/qwaylandscreen_p.h
+++ b/src/client/qwaylandscreen_p.h
@@ -67,9 +67,6 @@ class QWaylandCursor;
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgOutputManagerV1 : public QtWayland::zxdg_output_manager_v1 {
public:
QWaylandXdgOutputManagerV1(QWaylandDisplay *display, uint id, uint version);
- uint version() const { return m_version; }
-private:
- uint m_version = 1; // TODO: remove when we upgrade minimum libwayland requriement to 1.10
};
class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index b19c518d3..243f16a78 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -188,7 +188,7 @@ void QWaylandWindow::initWindow()
// Enable high-dpi rendering. Scale() returns the screen scale factor and will
// typically be integer 1 (normal-dpi) or 2 (high-dpi). Call set_buffer_scale()
// to inform the compositor that high-resolution buffers will be provided.
- if (mDisplay->compositorVersion() >= 3)
+ if (mSurface->version() >= 3)
mSurface->set_buffer_scale(scale());
setWindowFlags(window()->flags());
@@ -567,7 +567,7 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer)
void QWaylandWindow::damage(const QRect &rect)
{
const int s = scale();
- if (mDisplay->compositorVersion() >= 4)
+ if (mSurface->version() >= 4)
mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
else
mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height());
@@ -604,7 +604,7 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
return;
attachOffset(buffer);
- if (mDisplay->compositorVersion() >= 4) {
+ if (mSurface->version() >= 4) {
const int s = scale();
for (const QRect &rect: damage)
mSurface->damage_buffer(s * rect.x(), s * rect.y(), s * rect.width(), s * rect.height());
@@ -734,7 +734,7 @@ QWaylandScreen *QWaylandWindow::waylandScreen() const
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
{
- if (mDisplay->compositorVersion() < 2)
+ if (mSurface->version() < 2)
return;
wl_output_transform transform;
@@ -1014,7 +1014,7 @@ void QWaylandWindow::handleScreensChanged()
int scale = newScreen->isPlaceholder() ? 1 : static_cast<QWaylandScreen *>(newScreen)->scale();
if (scale != mScale) {
mScale = scale;
- if (mSurface && mDisplay->compositorVersion() >= 3)
+ if (mSurface && mSurface->version() >= 3)
mSurface->set_buffer_scale(mScale);
ensureSize();
}
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index 450ef519d..6da02152e 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -1045,6 +1045,8 @@ bool Scanner::process()
printf("\n");
printf(" bool isInitialized() const;\n");
printf("\n");
+ printf(" uint32_t version() const;");
+ printf("\n");
printf(" static const struct ::wl_interface *interface();\n");
printEnums(interface.enums);
@@ -1198,6 +1200,12 @@ bool Scanner::process()
printf(" }\n");
printf("\n");
+ printf(" uint32_t %s::version() const\n", interfaceName);
+ printf(" {\n");
+ printf(" return wl_proxy_get_version(reinterpret_cast<wl_proxy*>(m_%s));\n", interfaceName);
+ printf(" }\n");
+ printf("\n");
+
printf(" const struct wl_interface *%s::interface()\n", interfaceName);
printf(" {\n");
printf(" return &::%s_interface;\n", interfaceName);