From 0affc08e2b3c21f1b8fb2f4c4e35315d52dc786d Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 23 May 2018 13:50:18 +0200 Subject: 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 --- src/client/client.pro | 2 +- src/client/qwaylanddisplay.cpp | 2 +- src/client/qwaylandqtkey.cpp | 4 +- src/client/qwaylandqtkey_p.h | 26 ++++++------ src/compositor/extensions/extensions.pri | 2 +- src/compositor/extensions/qwlqtkey.cpp | 20 ++++----- src/compositor/extensions/qwlqtkey_p.h | 4 +- src/extensions/qt-key-unstable-v1.xml | 73 ++++++++++++++++++++++++++++++++ src/extensions/qtkey-extension.xml | 63 --------------------------- 9 files changed, 103 insertions(+), 93 deletions(-) create mode 100644 src/extensions/qt-key-unstable-v1.xml delete mode 100644 src/extensions/qtkey-extension.xml (limited to 'src') 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 #include -#include +#include 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 #include -#include +#include #include @@ -64,7 +64,7 @@ class QKeyEvent; namespace QtWayland { -class QtKeyExtensionGlobal : public QWaylandCompositorExtensionTemplate, public QtWaylandServer::qt_key_extension +class QtKeyExtensionGlobal : public QWaylandCompositorExtensionTemplate, public QtWaylandServer::zqt_key_v1 { Q_OBJECT public: diff --git a/src/extensions/qt-key-unstable-v1.xml b/src/extensions/qt-key-unstable-v1.xml new file mode 100644 index 000000000..0f8d8284c --- /dev/null +++ b/src/extensions/qt-key-unstable-v1.xml @@ -0,0 +1,73 @@ + + + + Copyright (C) 2018 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + This file is part of the plugins of the Qt Toolkit. + + $QT_BEGIN_LICENSE:BSD$ + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of The Qt Company Ltd nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + $QT_END_LICENSE$ + + + + + 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. + + 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. + + + + The key event notifies the client that a QKeyEvent has occurred on + the server side. + + + + + + + + + + + + + + + diff --git a/src/extensions/qtkey-extension.xml b/src/extensions/qtkey-extension.xml deleted file mode 100644 index 34cf24797..000000000 --- a/src/extensions/qtkey-extension.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - Copyright (C) 2015 The Qt Company Ltd. - Contact: http://www.qt.io/licensing/ - - This file is part of the plugins of the Qt Toolkit. - - $QT_BEGIN_LICENSE:BSD$ - You may use this file under the terms of the BSD license as follows: - - "Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of The Qt Company Ltd nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - - $QT_END_LICENSE$ - - - - - - Serialized QKeyEvent - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3