diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-05-23 13:50:18 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-05-24 05:34:17 +0000 |
commit | 0affc08e2b3c21f1b8fb2f4c4e35315d52dc786d (patch) | |
tree | f5ff35b09dde2f31403b540e73dd11bb73a93688 | |
parent | d1a8677d72ba3d205263d8578a42ea1695245d04 (diff) |
Replace qtkey-extension with qt-key-unstable-v1
- Remove the "dummy" request, which seems to be just leftover test code.
- Rename the event from "qtkey" to "key". We've already prefixed the
global interface, no need to also prefix the event.
- Prefix the global with `zqt_` and suffix it with "_v1". If we make
backwards incompatible changes, we should bump the suffix, rename the
xml-file and reset the version number.
- Add some documentation to the xml file.
- Add notice about (lack of) compatibility guarantees.
- Four spaces for indentation
Task-number: QTBUG-68423
Change-Id: I78f0eaff4cac22f27318ba32c83c83feb2de857a
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r-- | src/client/client.pro | 2 | ||||
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 2 | ||||
-rw-r--r-- | src/client/qwaylandqtkey.cpp | 4 | ||||
-rw-r--r-- | src/client/qwaylandqtkey_p.h | 26 | ||||
-rw-r--r-- | src/compositor/extensions/extensions.pri | 2 | ||||
-rw-r--r-- | src/compositor/extensions/qwlqtkey.cpp | 20 | ||||
-rw-r--r-- | src/compositor/extensions/qwlqtkey_p.h | 4 | ||||
-rw-r--r-- | src/extensions/qt-key-unstable-v1.xml (renamed from src/extensions/qtkey-extension.xml) | 54 |
8 files changed, 62 insertions, 52 deletions
diff --git a/src/client/client.pro b/src/client/client.pro index b14570046..3b11902de 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -25,7 +25,7 @@ INCLUDEPATH += $$PWD/../shared WAYLANDCLIENTSOURCES += \ ../extensions/surface-extension.xml \ ../extensions/touch-extension.xml \ - ../extensions/qtkey-extension.xml \ + ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 946e99bc8..9cbb3524d 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -256,7 +256,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mSubCompositor.reset(new QtWayland::wl_subcompositor(registry, id, 1)); } else if (interface == QStringLiteral("qt_touch_extension")) { mTouchExtension.reset(new QWaylandTouchExtension(this, id)); - } else if (interface == QStringLiteral("qt_key_extension")) { + } else if (interface == QStringLiteral("zqt_key_v1")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); } else if (interface == QStringLiteral("zwp_text_input_manager_v2")) { mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); diff --git a/src/client/qwaylandqtkey.cpp b/src/client/qwaylandqtkey.cpp index ce0d2124e..a60185bd6 100644 --- a/src/client/qwaylandqtkey.cpp +++ b/src/client/qwaylandqtkey.cpp @@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id) - : QtWayland::qt_key_extension(display->wl_registry(), id, 2) + : QtWayland::zqt_key_v1(display->wl_registry(), id, 1) , m_display(display) { } -void QWaylandQtKeyExtension::key_extension_qtkey(struct wl_surface *surface, +void QWaylandQtKeyExtension::zqt_key_v1_key(struct wl_surface *surface, uint32_t time, uint32_t type, uint32_t key, diff --git a/src/client/qwaylandqtkey_p.h b/src/client/qwaylandqtkey_p.h index 9091cf819..117c44a6d 100644 --- a/src/client/qwaylandqtkey_p.h +++ b/src/client/qwaylandqtkey_p.h @@ -54,7 +54,7 @@ #include <qpa/qwindowsysteminterface.h> #include <QtWaylandClient/qtwaylandclientglobal.h> -#include <QtWaylandClient/private/qwayland-qtkey-extension.h> +#include <QtWaylandClient/private/qwayland-qt-key-unstable-v1.h> QT_BEGIN_NAMESPACE @@ -62,7 +62,7 @@ namespace QtWaylandClient { class QWaylandDisplay; -class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::qt_key_extension +class Q_WAYLAND_CLIENT_EXPORT QWaylandQtKeyExtension : public QtWayland::zqt_key_v1 { public: QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_t id); @@ -70,17 +70,17 @@ public: private: QWaylandDisplay *m_display = nullptr; - void key_extension_qtkey(struct wl_surface *surface, - uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) override; + void zqt_key_v1_key(struct wl_surface *surface, + uint32_t time, + uint32_t type, + uint32_t key, + uint32_t modifiers, + uint32_t nativeScanCode, + uint32_t nativeVirtualKey, + uint32_t nativeModifiers, + const QString &text, + uint32_t autorep, + uint32_t count) override; }; diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri index 233b4bb41..77c09aa23 100644 --- a/src/compositor/extensions/extensions.pri +++ b/src/compositor/extensions/extensions.pri @@ -3,7 +3,7 @@ CONFIG += generated_privates WAYLANDSERVERSOURCES += \ ../extensions/touch-extension.xml \ - ../extensions/qtkey-extension.xml \ + ../extensions/qt-key-unstable-v1.xml \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell-unstable-v5.xml \ diff --git a/src/compositor/extensions/qwlqtkey.cpp b/src/compositor/extensions/qwlqtkey.cpp index 73d06ae6b..94a2b5a77 100644 --- a/src/compositor/extensions/qwlqtkey.cpp +++ b/src/compositor/extensions/qwlqtkey.cpp @@ -48,7 +48,7 @@ namespace QtWayland { QtKeyExtensionGlobal::QtKeyExtensionGlobal(QWaylandCompositor *compositor) : QWaylandCompositorExtensionTemplate(compositor) - , QtWaylandServer::qt_key_extension(compositor->display(), 2) + , QtWaylandServer::zqt_key_v1(compositor->display(), 1) , m_compositor(compositor) { } @@ -60,15 +60,15 @@ bool QtKeyExtensionGlobal::postQtKeyEvent(QKeyEvent *event, QWaylandSurface *sur Resource *target = surface ? resourceMap().value(surface->waylandClient()) : 0; if (target) { - send_qtkey(target->handle, - surface ? surface->resource() : nullptr, - time, event->type(), event->key(), event->modifiers(), - event->nativeScanCode(), - event->nativeVirtualKey(), - event->nativeModifiers(), - event->text(), - event->isAutoRepeat(), - event->count()); + send_key(target->handle, + surface ? surface->resource() : nullptr, + time, event->type(), event->key(), event->modifiers(), + event->nativeScanCode(), + event->nativeVirtualKey(), + event->nativeModifiers(), + event->text(), + event->isAutoRepeat(), + event->count()); return true; } diff --git a/src/compositor/extensions/qwlqtkey_p.h b/src/compositor/extensions/qwlqtkey_p.h index d3f573757..4944829ef 100644 --- a/src/compositor/extensions/qwlqtkey_p.h +++ b/src/compositor/extensions/qwlqtkey_p.h @@ -53,7 +53,7 @@ #include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate> #include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/private/qwayland-server-qtkey-extension.h> +#include <QtWaylandCompositor/private/qwayland-server-qt-key-unstable-v1.h> #include <wayland-util.h> @@ -64,7 +64,7 @@ class QKeyEvent; namespace QtWayland { -class QtKeyExtensionGlobal : public QWaylandCompositorExtensionTemplate<QtKeyExtensionGlobal>, public QtWaylandServer::qt_key_extension +class QtKeyExtensionGlobal : public QWaylandCompositorExtensionTemplate<QtKeyExtensionGlobal>, public QtWaylandServer::zqt_key_v1 { Q_OBJECT public: diff --git a/src/extensions/qtkey-extension.xml b/src/extensions/qt-key-unstable-v1.xml index 34cf24797..0f8d8284c 100644 --- a/src/extensions/qtkey-extension.xml +++ b/src/extensions/qt-key-unstable-v1.xml @@ -1,7 +1,7 @@ -<protocol name="qtkey_extension"> +<protocol name="qt_key_unstable_v1"> <copyright> - Copyright (C) 2015 The Qt Company Ltd. + Copyright (C) 2018 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ This file is part of the plugins of the Qt Toolkit. @@ -38,26 +38,36 @@ $QT_END_LICENSE$ </copyright> - <interface name="qt_key_extension" version="2"> - <event name="qtkey"> - <description summary="qtkey event"> - Serialized QKeyEvent - </description> - - <arg name="surface" type="object" interface="wl_surface"/> - <arg name="time" type="uint"/> - <arg name="type" type="uint"/> - <arg name="key" type="uint"/> - <arg name="modifiers" type="uint"/> - <arg name="nativeScanCode" type="uint"/> - <arg name="nativeVirtualKey" type="uint"/> - <arg name="nativeModifiers" type="uint"/> - <arg name="text" type="string"/> - <arg name="autorepeat" type="uint"/> - <arg name="count" type="uint"/> - </event> + <interface name="zqt_key_v1" version="1"> + <description summary="send serialized QKeyEvents"> + This protocol is independent of the Wayland seat concept. Its + intention is to let a QKeyEvent be transferred from a Qt compositor + to a Qt client without losing or adding false information by going + through wl_seat and wl_keyboard. - <request name="dummy"> - </request> + Note: This protocol is considered private to Qt. We will do our + best to bump version numbers when we make backwards compatible + changes, bump the protocol name and interface suffixes when we make + backwards incompatible changes, but we provide no guarantees. We + may also remove the protocol without warning. Implement this at + your own risk. + </description> + <event name="key"> + <description summary="send key event"> + The key event notifies the client that a QKeyEvent has occurred on + the server side. + </description> + <arg name="surface" type="object" interface="wl_surface"/> + <arg name="time" type="uint"/> + <arg name="type" type="uint"/> + <arg name="key" type="uint"/> + <arg name="modifiers" type="uint"/> + <arg name="nativeScanCode" type="uint"/> + <arg name="nativeVirtualKey" type="uint"/> + <arg name="nativeModifiers" type="uint"/> + <arg name="text" type="string"/> + <arg name="autorepeat" type="uint"/> + <arg name="count" type="uint"/> + </event> </interface> </protocol> |