diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-05-07 03:01:52 +0200 |
---|---|---|
committer | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-05-07 12:39:12 +0200 |
commit | 17b1705ce4c8bc9ca19a6b424a00a045134b3aac (patch) | |
tree | 03e7b7d461064dd007179cd29da9c024e6c8f190 /src/compositor | |
parent | 4ab3cbcc5c4da6384e9081993c5ba24303a382bd (diff) | |
parent | a658a10f6a42e67bd762f87851c23cc1c1e3b141 (diff) | |
download | qtwayland-17b1705ce4c8bc9ca19a6b424a00a045134b3aac.tar.gz |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
src/client/qwaylanddisplay_p.h
src/client/qwaylandwindow.cpp
Change-Id: I50eb5c83a8b81e4bdb032b68d41f429b17d0a74d
Diffstat (limited to 'src/compositor')
22 files changed, 175 insertions, 131 deletions
diff --git a/src/compositor/compositor.pro b/src/compositor/compositor.pro index 47be591d..b887cf28 100644 --- a/src/compositor/compositor.pro +++ b/src/compositor/compositor.pro @@ -3,6 +3,10 @@ MODULE = waylandcompositor QT = core gui-private +qtConfig(xkbcommon) { + QT_FOR_PRIVATE += xkbcommon_support-private +} + qtHaveModule(quick): QT += quick CONFIG -= precompile_header diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri index 233815d8..49d0de41 100644 --- a/src/compositor/compositor_api/compositor_api.pri +++ b/src/compositor/compositor_api/compositor_api.pri @@ -17,6 +17,7 @@ HEADERS += \ compositor_api/qwaylandtouch.h \ compositor_api/qwaylandtouch_p.h \ compositor_api/qwaylandoutput.h \ + compositor_api/qwaylandoutput_p.h \ compositor_api/qwaylandoutputmode.h \ compositor_api/qwaylandoutputmode_p.h \ compositor_api/qwaylandbufferref.h \ diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 34384d57..530cf8ed 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -72,7 +72,6 @@ #include "extensions/qwaylandqtwindowmanager.h" -#include "qwaylandxkb_p.h" #include "qwaylandsharedmemoryformathelper_p.h" #include <QtCore/QCoreApplication> @@ -129,12 +128,12 @@ public: bool isDown = ke->keyType == QEvent::KeyPress; #if QT_CONFIG(xkbcommon) - QString text; - Qt::KeyboardModifiers modifiers = QWaylandXkb::modifiers(keyb->xkbState()); + xkb_state *xkbState = keyb->xkbState(); + Qt::KeyboardModifiers modifiers = QXkbCommon::modifiers(xkbState); - const xkb_keysym_t sym = xkb_state_key_get_one_sym(keyb->xkbState(), code); - int qtkey; - std::tie(qtkey, text) = QWaylandXkb::keysymToQtKey(sym, modifiers); + const xkb_keysym_t sym = xkb_state_key_get_one_sym(xkbState, code); + int qtkey = QXkbCommon::keysymToQtKey(sym, modifiers, xkbState, code); + QString text = QXkbCommon::lookupString(xkbState, code); ke->key = qtkey; ke->modifiers = modifiers; @@ -172,6 +171,14 @@ QWaylandCompositorPrivate::QWaylandCompositorPrivate(QWaylandCompositor *composi timer.start(); QWindowSystemInterfacePrivate::installWindowSystemEventHandler(eventHandler.data()); + +#if QT_CONFIG(xkbcommon) + mXkbContext.reset(xkb_context_new(XKB_CONTEXT_NO_FLAGS)); + if (!mXkbContext) { + qWarning("Failed to create a XKB context: keymap will not be supported"); + return; + } +#endif } void QWaylandCompositorPrivate::init() diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h index d91977de..2c962421 100644 --- a/src/compositor/compositor_api/qwaylandcompositor_p.h +++ b/src/compositor/compositor_api/qwaylandcompositor_p.h @@ -60,6 +60,10 @@ #include <QtWaylandCompositor/private/qwayland-server-wayland.h> +#if QT_CONFIG(xkbcommon) +#include <QtXkbCommonSupport/private/qxkbcommon_p.h> +#endif + QT_BEGIN_NAMESPACE namespace QtWayland { @@ -81,6 +85,10 @@ public: QWaylandCompositorPrivate(QWaylandCompositor *compositor); ~QWaylandCompositorPrivate() override; +#if QT_CONFIG(xkbcommon) + struct xkb_context *xkbContext() const { return mXkbContext.get(); } +#endif + void preInit(); void init(); @@ -169,6 +177,10 @@ protected: bool initialized = false; QList<QPointer<QObject> > polish_objects; +#if QT_CONFIG(xkbcommon) + QXkbCommon::ScopedXKBContext mXkbContext; +#endif + Q_DECLARE_PUBLIC(QWaylandCompositor) Q_DISABLE_COPY(QWaylandCompositorPrivate) }; diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp index 5f3bd3d4..2302c0b6 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard.cpp +++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp @@ -54,7 +54,6 @@ #if QT_CONFIG(xkbcommon) #include <sys/mman.h> #include <sys/types.h> -#include <qwaylandxkb_p.h> #endif QT_BEGIN_NAMESPACE @@ -67,12 +66,11 @@ QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandSeat *seat) QWaylandKeyboardPrivate::~QWaylandKeyboardPrivate() { #if QT_CONFIG(xkbcommon) - if (xkb_context) { + if (xkbContext()) { if (keymap_area) munmap(keymap_area, keymap_size); - close(keymap_fd); - xkb_context_unref(xkb_context); - xkb_state_unref(xkb_state); + if (keymap_fd >= 0) + close(keymap_fd); } #endif } @@ -137,14 +135,14 @@ void QWaylandKeyboardPrivate::keyboard_bind_resource(wl_keyboard::Resource *reso send_repeat_info(resource->handle, repeatRate, repeatDelay); #if QT_CONFIG(xkbcommon) - if (xkb_context) { + if (xkbContext()) { send_keymap(resource->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymap_fd, keymap_size); } else #endif { int null_fd = open("/dev/null", O_RDONLY); - send_keymap(resource->handle, 0 /* WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP */, + send_keymap(resource->handle, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP, null_fd, 0); close(null_fd); } @@ -164,11 +162,8 @@ void QWaylandKeyboardPrivate::keyboard_release(wl_keyboard::Resource *resource) void QWaylandKeyboardPrivate::keyEvent(uint code, uint32_t state) { -#if QT_CONFIG(xkbcommon) - uint key = toWaylandXkbV1Key(code); -#else - uint key = code; -#endif + uint key = toWaylandKey(code); + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { keys << key; } else { @@ -180,30 +175,18 @@ void QWaylandKeyboardPrivate::sendKeyEvent(uint code, uint32_t state) { uint32_t time = compositor()->currentTimeMsecs(); uint32_t serial = compositor()->nextSerial(); -#if QT_CONFIG(xkbcommon) - uint key = toWaylandXkbV1Key(code); -#else - uint key = code; -#endif + uint key = toWaylandKey(code); if (focusResource) send_key(focusResource->handle, serial, time, key, state); } -void QWaylandKeyboardPrivate::modifiers(uint32_t serial, uint32_t mods_depressed, - uint32_t mods_latched, uint32_t mods_locked, uint32_t group) -{ - if (focusResource) { - send_modifiers(focusResource->handle, serial, mods_depressed, mods_latched, mods_locked, group); - } -} - #if QT_CONFIG(xkbcommon) void QWaylandKeyboardPrivate::maybeUpdateXkbScanCodeTable() { if (!scanCodesByQtKey.isEmpty() || !xkbState()) return; - if (xkb_keymap *keymap = xkb_state_get_keymap(xkb_state)) { + if (xkb_keymap *keymap = xkb_state_get_keymap(xkbState())) { xkb_keymap_key_for_each(keymap, [](xkb_keymap *keymap, xkb_keycode_t keycode, void *d){ auto *scanCodesByQtKey = static_cast<QMap<ScanCodeKey, uint>*>(d); uint numLayouts = xkb_keymap_num_layouts_for_key(keymap, keycode); @@ -214,7 +197,7 @@ void QWaylandKeyboardPrivate::maybeUpdateXkbScanCodeTable() continue; Qt::KeyboardModifiers mods = {}; - int qtKey = QWaylandXkb::keysymToQtKey(syms[0], mods).first; + int qtKey = QXkbCommon::keysymToQtKey(syms[0], mods); if (qtKey != 0) scanCodesByQtKey->insert({layout, qtKey}, keycode); } @@ -226,15 +209,15 @@ void QWaylandKeyboardPrivate::maybeUpdateXkbScanCodeTable() void QWaylandKeyboardPrivate::updateModifierState(uint code, uint32_t state) { #if QT_CONFIG(xkbcommon) - if (!xkb_context) + if (!xkbContext()) return; - xkb_state_update_key(xkb_state, code, state == WL_KEYBOARD_KEY_STATE_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP); + xkb_state_update_key(xkbState(), code, state == WL_KEYBOARD_KEY_STATE_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP); - uint32_t modsDepressed = xkb_state_serialize_mods(xkb_state, (xkb_state_component)XKB_STATE_DEPRESSED); - uint32_t modsLatched = xkb_state_serialize_mods(xkb_state, (xkb_state_component)XKB_STATE_LATCHED); - uint32_t modsLocked = xkb_state_serialize_mods(xkb_state, (xkb_state_component)XKB_STATE_LOCKED); - uint32_t group = xkb_state_serialize_group(xkb_state, (xkb_state_component)XKB_STATE_EFFECTIVE); + uint32_t modsDepressed = xkb_state_serialize_mods(xkbState(), XKB_STATE_MODS_DEPRESSED); + uint32_t modsLatched = xkb_state_serialize_mods(xkbState(), XKB_STATE_MODS_LATCHED); + uint32_t modsLocked = xkb_state_serialize_mods(xkbState(), XKB_STATE_MODS_LOCKED); + uint32_t group = xkb_state_serialize_layout(xkbState(), XKB_STATE_LAYOUT_EFFECTIVE); if (this->modsDepressed == modsDepressed && this->modsLatched == modsLatched @@ -247,7 +230,10 @@ void QWaylandKeyboardPrivate::updateModifierState(uint code, uint32_t state) this->modsLocked = modsLocked; this->group = group; - modifiers(compositor()->nextSerial(), modsDepressed, modsLatched, modsLocked, group); + if (focusResource) { + send_modifiers(focusResource->handle, compositor()->nextSerial(), modsDepressed, + modsLatched, modsLocked, group); + } #else Q_UNUSED(code); Q_UNUSED(state); @@ -266,7 +252,7 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap() pendingKeymap = false; #if QT_CONFIG(xkbcommon) - if (!xkb_context) + if (!xkbContext()) return; createXKBKeymap(); @@ -274,7 +260,7 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap() send_keymap(res->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymap_fd, keymap_size); } - xkb_state_update_mask(xkb_state, 0, modsLatched, modsLocked, 0, 0, 0); + xkb_state_update_mask(xkbState(), 0, modsLatched, modsLocked, 0, 0, 0); if (focusResource) send_modifiers(focusResource->handle, compositor()->nextSerial(), @@ -285,6 +271,24 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap() #endif } +uint QWaylandKeyboardPrivate::toWaylandKey(const uint nativeScanCode) +{ +#if QT_CONFIG(xkbcommon) + // In all current XKB keymaps there's a constant offset of 8 (for historical + // reasons) from hardware/evdev scancodes to XKB keycodes. On X11, we pass + // XKB keycodes (as sent by X server) via QKeyEvent::nativeScanCode. eglfs+evdev + // adds 8 for consistency, see qtbase/05c07c7636012ebb4131ca099ca4ea093af76410. + // eglfs+libinput also adds 8, for the same reason. Wayland protocol uses + // hardware/evdev scancodes, thus we need to minus 8 before sending the event + // out. + const uint offset = 8; + Q_ASSERT(nativeScanCode >= offset); + return nativeScanCode - offset; +#else + return nativeScanCode; +#endif +} + #if QT_CONFIG(xkbcommon) static int createAnonymousFile(size_t size) { @@ -316,18 +320,6 @@ static int createAnonymousFile(size_t size) return fd; } -void QWaylandKeyboardPrivate::initXKB() -{ - xkb_context = xkb_context_new(static_cast<xkb_context_flags>(0)); - if (!xkb_context) { - qWarning("Failed to create a XKB context: keymap will not be supported"); - return; - } - - createXKBKeymap(); -} - - void QWaylandKeyboardPrivate::createXKBState(xkb_keymap *keymap) { char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1); @@ -356,46 +348,41 @@ void QWaylandKeyboardPrivate::createXKBState(xkb_keymap *keymap) strcpy(keymap_area, keymap_str); free(keymap_str); - if (xkb_state) - xkb_state_unref(xkb_state); - xkb_state = xkb_state_new(keymap); -} - -uint QWaylandKeyboardPrivate::toWaylandXkbV1Key(const uint nativeScanCode) -{ - const uint offset = 8; - Q_ASSERT(nativeScanCode >= offset); - return nativeScanCode - offset; + mXkbState.reset(xkb_state_new(keymap)); + if (!mXkbState) + qWarning("Failed to create XKB state"); } void QWaylandKeyboardPrivate::createXKBKeymap() { - if (!xkb_context) + if (!xkbContext()) return; - auto keymap = seat->keymap(); - struct xkb_rule_names rule_names = { strdup(qPrintable(keymap->rules())), - strdup(qPrintable(keymap->model())), - strdup(qPrintable(keymap->layout())), - strdup(qPrintable(keymap->variant())), - strdup(qPrintable(keymap->options())) }; - struct xkb_keymap *xkbKeymap = xkb_keymap_new_from_names(xkb_context, &rule_names, static_cast<xkb_keymap_compile_flags>(0)); - + QWaylandKeymap *keymap = seat->keymap(); + QByteArray rules = keymap->rules().toLocal8Bit(); + QByteArray model = keymap->model().toLocal8Bit(); + QByteArray layout = keymap->layout().toLocal8Bit(); + QByteArray variant = keymap->variant().toLocal8Bit(); + QByteArray options = keymap->options().toLocal8Bit(); + + struct xkb_rule_names rule_names = { + rules.constData(), + model.constData(), + layout.constData(), + variant.constData(), + options.constData() + }; + + QXkbCommon::ScopedXKBKeymap xkbKeymap(xkb_keymap_new_from_names(xkbContext(), &rule_names, + XKB_KEYMAP_COMPILE_NO_FLAGS)); if (xkbKeymap) { scanCodesByQtKey.clear(); - createXKBState(xkbKeymap); - xkb_keymap_unref(xkbKeymap); + createXKBState(xkbKeymap.get()); } else { qWarning("Failed to load the '%s' XKB keymap.", qPrintable(keymap->layout())); } - - free((char *)rule_names.rules); - free((char *)rule_names.model); - free((char *)rule_names.layout); - free((char *)rule_names.variant); - free((char *)rule_names.options); } -#endif +#endif // QT_CONFIG(xkbcommon) void QWaylandKeyboardPrivate::sendRepeatInfo() { @@ -430,7 +417,7 @@ QWaylandKeyboard::QWaylandKeyboard(QWaylandSeat *seat, QObject *parent) connect(keymap, &QWaylandKeymap::rulesChanged, this, &QWaylandKeyboard::updateKeymap); connect(keymap, &QWaylandKeymap::modelChanged, this, &QWaylandKeyboard::updateKeymap); #if QT_CONFIG(xkbcommon) - d->initXKB(); + d->createXKBKeymap(); #endif } diff --git a/src/compositor/compositor_api/qwaylandkeyboard_p.h b/src/compositor/compositor_api/qwaylandkeyboard_p.h index 87e89e85..4dfe0035 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard_p.h +++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h @@ -51,6 +51,7 @@ // // We mean it. // +#include <QtWaylandCompositor/private/qwaylandcompositor_p.h> #include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h> #include <QtWaylandCompositor/qwaylandseat.h> @@ -64,6 +65,7 @@ #if QT_CONFIG(xkbcommon) #include <xkbcommon/xkbcommon.h> +#include <QtXkbCommonSupport/private/qxkbcommon_p.h> #endif @@ -83,11 +85,12 @@ public: QWaylandCompositor *compositor() const { return seat->compositor(); } void focused(QWaylandSurface* surface); - void modifiers(uint32_t serial, uint32_t mods_depressed, - uint32_t mods_latched, uint32_t mods_locked, uint32_t group); #if QT_CONFIG(xkbcommon) - struct xkb_state *xkbState() const { return xkb_state; } + struct xkb_state *xkbState() const { return mXkbState.get(); } + struct xkb_context *xkbContext() const { + return QWaylandCompositorPrivate::get(seat->compositor())->xkbContext(); + } uint32_t xkbModsMask() const { return modsDepressed | modsLatched | modsLocked; } void maybeUpdateXkbScanCodeTable(); #endif @@ -107,11 +110,10 @@ protected: private: #if QT_CONFIG(xkbcommon) - void initXKB(); void createXKBKeymap(); void createXKBState(xkb_keymap *keymap); #endif - static uint toWaylandXkbV1Key(const uint nativeScanCode); + static uint toWaylandKey(const uint nativeScanCode); void sendRepeatInfo(); @@ -134,8 +136,7 @@ private: char *keymap_area = nullptr; using ScanCodeKey = std::pair<uint,int>; // group/layout and QtKey QMap<ScanCodeKey, uint> scanCodesByQtKey; - struct xkb_context *xkb_context = nullptr; - struct xkb_state *xkb_state = nullptr; + QXkbCommon::ScopedXKBState mXkbState; #endif quint32 repeatRate = 40; diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp index 98ad7acb..1b3f93e5 100644 --- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp @@ -90,15 +90,15 @@ QWaylandQuickCompositor::QWaylandQuickCompositor(QObject *parent) * For instance, the following code would allow the clients to request \c wl_shell * surfaces in the compositor using the \c wl_shell interface. * - * \code - * import QtWayland.Compositor 1.0 + * \qml \QtMinorVersion + * import QtWayland.Compositor 1.\1 * * WaylandCompositor { * WlShell { * // ... * } * } - * \endcode + * \endqml */ void QWaylandQuickCompositor::create() diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 9e681dc0..996177be 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -840,7 +840,6 @@ void QWaylandQuickItem::setOutput(QWaylandOutput *output) * * The default is false. */ - /*! * \property QWaylandQuickItem::bufferLocked * diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index cd78166d..c79787e6 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -450,9 +450,7 @@ QWaylandClient *QWaylandSurface::client() const } /*! - * \property QWaylandSurface::waylandClient - * - * This property holds the \c wl_client using this QWaylandSurface. + * Holds the \c wl_client using this QWaylandSurface. */ ::wl_client *QWaylandSurface::waylandClient() const { diff --git a/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc b/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc index 1dadb710..a89e07d7 100644 --- a/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc +++ b/src/compositor/doc/src/qtwaylandcompositor-qmltypes.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \qmlmodule QtWayland.Compositor 1.1 + \qmlmodule QtWayland.Compositor 1.\QtMinorVersion \title Qt Wayland Compositor QML Types \ingroup qmlmodules \brief Provides QML types for writing custom Wayland display servers. @@ -37,15 +37,15 @@ The QML types can be imported into your application using the following import statement: - \code - import QtWayland.Compositor 1.1 + \qml \QtMinorVersion + import QtWayland.Compositor 1.\1 \endcode To link against the module, add this line to your \l qmake \c .pro file: \code QT += waylandcompositor - \endcode + \endqml For more information about using these types in your application, see the \l{Qt Wayland Compositor} documentation. diff --git a/src/compositor/extensions/qwaylandiviapplication.cpp b/src/compositor/extensions/qwaylandiviapplication.cpp index 36690341..a2e9842d 100644 --- a/src/compositor/extensions/qwaylandiviapplication.cpp +++ b/src/compositor/extensions/qwaylandiviapplication.cpp @@ -62,8 +62,9 @@ QT_BEGIN_NAMESPACE * To provide the functionality of the shell extension in a compositor, create * an instance of the IviApplication component and add it to the list of extensions * supported by the compositor: - * \code - * import QtWayland.Compositor 1.0 + * + * \qml \QtMinorVersion + * import QtWayland.Compositor 1.\1 * * WaylandCompositor { * IviApplication { @@ -74,7 +75,7 @@ QT_BEGIN_NAMESPACE * } * } * } - * \endcode + * \endqml */ /*! diff --git a/src/compositor/extensions/qwaylandshell.cpp b/src/compositor/extensions/qwaylandshell.cpp index 12479186..bb3b4675 100644 --- a/src/compositor/extensions/qwaylandshell.cpp +++ b/src/compositor/extensions/qwaylandshell.cpp @@ -92,4 +92,24 @@ void QWaylandShell::setFocusPolicy(QWaylandShell::FocusPolicy focusPolicy) emit focusPolicyChanged(); } +QWaylandShell::QWaylandShell(QWaylandShellPrivate &dd) + : QWaylandCompositorExtension(dd) +{ +} + +QWaylandShell::QWaylandShell(QWaylandObject *container, QWaylandShellPrivate &dd) + : QWaylandCompositorExtension(container, dd) +{ +} + +QWaylandShell::QWaylandShell(QWaylandCompositorExtensionPrivate &dd) + : QWaylandShell(static_cast<QWaylandShellPrivate &>(dd)) +{ +} + +QWaylandShell::QWaylandShell(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd) + : QWaylandShell(container, static_cast<QWaylandShellPrivate &>(dd)) +{ +} + QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandshell.h b/src/compositor/extensions/qwaylandshell.h index 9241b866..6f494be5 100644 --- a/src/compositor/extensions/qwaylandshell.h +++ b/src/compositor/extensions/qwaylandshell.h @@ -68,8 +68,12 @@ Q_SIGNALS: void focusPolicyChanged(); protected: - QWaylandShell(QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(dd) {} - QWaylandShell(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(container, dd) {} + explicit QWaylandShell(QWaylandShellPrivate &dd); + explicit QWaylandShell(QWaylandObject *container, QWaylandShellPrivate &dd); + + //Qt 6: remove + Q_DECL_DEPRECATED QWaylandShell(QWaylandCompositorExtensionPrivate &dd); + Q_DECL_DEPRECATED QWaylandShell(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd); }; template <typename T> diff --git a/src/compositor/extensions/qwaylandshellsurface.cpp b/src/compositor/extensions/qwaylandshellsurface.cpp index 3cfe4489..cb6d0364 100644 --- a/src/compositor/extensions/qwaylandshellsurface.cpp +++ b/src/compositor/extensions/qwaylandshellsurface.cpp @@ -87,7 +87,7 @@ */ /*! - * \property QWaylandWlShellSurface::windowType + * \property QWaylandShellSurface::windowType * * This property holds the window type of the QWaylandShellSurface. */ diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp index 6cf33d18..f60a32a1 100644 --- a/src/compositor/extensions/qwaylandtextinput.cpp +++ b/src/compositor/extensions/qwaylandtextinput.cpp @@ -45,12 +45,15 @@ #include "qwaylandsurface.h" #include "qwaylandview.h" -#include "qwaylandxkb_p.h" #include "qwaylandinputmethodeventbuilder_p.h" #include <QGuiApplication> #include <QInputMethodEvent> +#if QT_CONFIG(xkbcommon) +#include <QtXkbCommonSupport/private/qxkbcommon_p.h> +#endif + QT_BEGIN_NAMESPACE QWaylandTextInputClientState::QWaylandTextInputClientState() @@ -203,11 +206,15 @@ void QWaylandTextInputPrivate::sendKeyEvent(QKeyEvent *event) // TODO add support for modifiers - foreach (xkb_keysym_t keysym, QWaylandXkb::toKeysym(event)) { +#if QT_CONFIG(xkbcommon) + for (xkb_keysym_t keysym : QXkbCommon::toKeysym(event)) { send_keysym(focusResource->handle, event->timestamp(), keysym, event->type() == QEvent::KeyPress ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED, 0); } +#else + Q_UNUSED(event); +#endif } void QWaylandTextInputPrivate::sendInputPanelState() diff --git a/src/compositor/extensions/qwaylandwlscaler.cpp b/src/compositor/extensions/qwaylandwlscaler.cpp index e097ea3c..5c8e4b27 100644 --- a/src/compositor/extensions/qwaylandwlscaler.cpp +++ b/src/compositor/extensions/qwaylandwlscaler.cpp @@ -61,14 +61,14 @@ QT_BEGIN_NAMESPACE To provide the functionality of the extension in a compositor, create an instance of the WlScaler component and add it to the list of extensions supported by the compositor: - \code - import QtWayland.Compositor 1.13 + \qml \QtMinorVersion + import QtWayland.Compositor 1.\1 WaylandCompositor { // ... WlScaler {} } - \endcode + \endqml \deprecated */ diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp index 3f673463..9871a8a5 100644 --- a/src/compositor/extensions/qwaylandwlshell.cpp +++ b/src/compositor/extensions/qwaylandwlshell.cpp @@ -267,15 +267,16 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_class(Resource *resource, * To provide the functionality of the shell extension in a compositor, create * an instance of the WlShell component and add it to the list of extensions * supported by the compositor: - * \code - * import QtWayland.Compositor 1.0 + * + * \qml \QtMinorVersion + * import QtWayland.Compositor 1.\1 * * WaylandCompositor { * WlShell { * // ... * } * } - * \endcode + * \endqml */ /*! diff --git a/src/compositor/extensions/qwaylandxdgdecorationv1.cpp b/src/compositor/extensions/qwaylandxdgdecorationv1.cpp index 89c56acd..2d283ddf 100644 --- a/src/compositor/extensions/qwaylandxdgdecorationv1.cpp +++ b/src/compositor/extensions/qwaylandxdgdecorationv1.cpp @@ -59,8 +59,8 @@ QT_BEGIN_NAMESPACE To provide the functionality of the extension in a compositor, create an instance of the XdgDecorationManagerV1 component and add it to the list of extensions supported by the compositor: - \code - import QtWayland.Compositor 1.3 + \qml \QtMinorVersion + import QtWayland.Compositor 1.\1 WaylandCompositor { // Xdg decoration manager assumes xdg-shell is being used @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE preferredMode: XdgToplevel.ServerSideDecoration } } - \endcode + \endqml \sa XdgToplevel::decorationMode */ diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp index 560f95ac..eb7b958b 100644 --- a/src/compositor/extensions/qwaylandxdgshell.cpp +++ b/src/compositor/extensions/qwaylandxdgshell.cpp @@ -154,15 +154,16 @@ void QWaylandXdgShellPrivate::xdg_wm_base_pong(Resource *resource, uint32_t seri * To provide the functionality of the shell extension in a compositor, create * an instance of the XdgShell component and add it to the list of extensions * supported by the compositor: - * \code - * import QtWayland.Compositor 1.3 + * + * \qml \QtMinorVersion + * import QtWayland.Compositor 1.\1 * * WaylandCompositor { * XdgShell { * // ... * } * } - * \endcode + * \endqml */ /*! diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp index 9e157a8a..0628f55e 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp @@ -513,15 +513,17 @@ void QWaylandXdgPopupV5Private::xdg_popup_destroy(Resource *resource) * * To provide the functionality of the shell extension in a compositor, create * an instance of the XdgShellV5 component and add it as a child of the - * compositor: \code - * import QtWayland.Compositor 1.0 + * compositor: + * + * \qml \QtMinorVersion + * import QtWayland.Compositor 1.\1 * * WaylandCompositor { * XdgShellV5 { * // ... * } * } - * \endcode + * \endqml * * \deprecated */ diff --git a/src/compositor/extensions/qwaylandxdgshellv6.cpp b/src/compositor/extensions/qwaylandxdgshellv6.cpp index d69ed6ca..f971fe5b 100644 --- a/src/compositor/extensions/qwaylandxdgshellv6.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv6.cpp @@ -159,15 +159,16 @@ void QWaylandXdgShellV6Private::zxdg_shell_v6_pong(Resource *resource, uint32_t * To provide the functionality of the shell extension in a compositor, create * an instance of the XdgShellV6 component and add it to the list of extensions * supported by the compositor: - * \code - * import QtWayland.Compositor 1.1 + * + * \qml \QtMinorVersion + * import QtWayland.Compositor 1.\1 * * WaylandCompositor { * XdgShellV6 { * // ... * } * } - * \endcode + * \endqml */ /*! diff --git a/src/compositor/wayland_wrapper/wayland_wrapper.pri b/src/compositor/wayland_wrapper/wayland_wrapper.pri index b0c8371f..08dd38e8 100644 --- a/src/compositor/wayland_wrapper/wayland_wrapper.pri +++ b/src/compositor/wayland_wrapper/wayland_wrapper.pri @@ -5,14 +5,12 @@ WAYLANDSERVERSOURCES += \ HEADERS += \ wayland_wrapper/qwlbuffermanager_p.h \ wayland_wrapper/qwlclientbuffer_p.h \ - wayland_wrapper/qwlregion_p.h \ - ../shared/qwaylandxkb_p.h \ + wayland_wrapper/qwlregion_p.h SOURCES += \ wayland_wrapper/qwlbuffermanager.cpp \ wayland_wrapper/qwlclientbuffer.cpp \ - wayland_wrapper/qwlregion.cpp \ - ../shared/qwaylandxkb.cpp \ + wayland_wrapper/qwlregion.cpp qtConfig(wayland-datadevice) { HEADERS += \ |