Hello community, here is the log from the commit of package kwayland for openSUSE:Factory checked in at 2019-07-26 12:20:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kwayland (Old) and /work/SRC/openSUSE:Factory/.kwayland.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kwayland" Fri Jul 26 12:20:56 2019 rev:64 rq:715910 version:5.60.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kwayland/kwayland.changes 2019-06-22 11:14:45.808798108 +0200 +++ /work/SRC/openSUSE:Factory/.kwayland.new.4126/kwayland.changes 2019-07-26 12:21:01.314560717 +0200 @@ -1,0 +2,12 @@ +Sun Jul 14 06:41:39 UTC 2019 - [email protected] + +- Update to 5.60.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.60.0.php +- Changes since 5.59.0: + * Include a description + * Proof of concept of a wayland protocol to allow the keystate dataengine to work + * Use new logging category directory + +------------------------------------------------------------------- Old: ---- kwayland-5.59.0.tar.xz New: ---- kwayland-5.60.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kwayland.spec ++++++ --- /var/tmp/diff_new_pack.tEeKC3/_old 2019-07-26 12:21:02.458560485 +0200 +++ /var/tmp/diff_new_pack.tEeKC3/_new 2019-07-26 12:21:02.462560485 +0200 @@ -16,13 +16,13 @@ # -%define _tar_path 5.59 +%define _tar_path 5.60 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} Name: kwayland -Version: 5.59.0 +Version: 5.60.0 Release: 0 Summary: KDE Wayland library License: LGPL-2.1-or-later @@ -40,6 +40,7 @@ BuildRequires: cmake(Qt5Gui) >= 5.6.0 BuildRequires: cmake(Qt5Test) >= 5.6.0 BuildRequires: pkgconfig(egl) +BuildRequires: pkgconfig(wayland-protocols) %requires_eq libQt5Gui5 Provides: libKF5WaylandClient5 = %{version} Obsoletes: libKF5WaylandClient5 <= %{version} ++++++ kwayland-5.59.0.tar.xz -> kwayland-5.60.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/CMakeLists.txt new/kwayland-5.60.0/CMakeLists.txt --- old/kwayland-5.59.0/CMakeLists.txt 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/CMakeLists.txt 2019-07-06 15:18:01.000000000 +0200 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.59.0") # handled by release scripts +set(KF5_VERSION "5.60.0") # handled by release scripts project(KWayland VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.59.0 NO_MODULE) +find_package(ECM 5.60.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) @@ -30,7 +30,7 @@ SOVERSION 5) # Dependencies -set(REQUIRED_QT_VERSION 5.10.0) +set(REQUIRED_QT_VERSION 5.11.0) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Concurrent Gui) find_package(Wayland 1.13 COMPONENTS Client Server) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/CMakeLists.txt new/kwayland-5.60.0/src/CMakeLists.txt --- old/kwayland-5.59.0/src/CMakeLists.txt 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/src/CMakeLists.txt 2019-07-06 15:18:01.000000000 +0200 @@ -2,7 +2,7 @@ add_subdirectory(server) add_subdirectory(tools) -install( FILES org_kde_kwayland.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) +install( FILES org_kde_kwayland.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR} ) if(BUILD_QCH) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/client/CMakeLists.txt new/kwayland-5.60.0/src/client/CMakeLists.txt --- old/kwayland-5.59.0/src/client/CMakeLists.txt 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/src/client/CMakeLists.txt 2019-07-06 15:18:01.000000000 +0200 @@ -24,6 +24,7 @@ idle.cpp idleinhibit.cpp keyboard.cpp + keystate.cpp remote_access.cpp outputconfiguration.cpp outputmanagement.cpp @@ -189,6 +190,10 @@ BASENAME xdg-decoration-unstable-v1 ) +ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS + PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/keystate.xml + BASENAME keystate +) set(CLIENT_GENERATED_FILES ${CMAKE_CURRENT_BINARY_DIR}/wayland-fullscreen-shell-client-protocol.h @@ -268,6 +273,7 @@ idle.h idleinhibit.h keyboard.h + keystate.h remote_access.h outputconfiguration.h outputmanagement.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/client/keystate.cpp new/kwayland-5.60.0/src/client/keystate.cpp --- old/kwayland-5.59.0/src/client/keystate.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kwayland-5.60.0/src/client/keystate.cpp 2019-07-06 15:18:01.000000000 +0200 @@ -0,0 +1,81 @@ +/******************************************************************** +Copyright 2014 Martin Gräßlin <[email protected]> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) version 3, or any +later version accepted by the membership of KDE e.V. (or its +successor approved by the membership of KDE e.V.), which shall +act as a proxy defined in Section 6 of version 3 of the license. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*********************************************************************/ +#include "keystate.h" +#include "wayland_pointer_p.h" +#include <QPointer> +#include <QDebug> +#include <wayland-client-protocol.h> +#include <wayland-keystate-client-protocol.h> + +namespace KWayland +{ +namespace Client +{ + +class Q_DECL_HIDDEN Keystate::Private +{ +public: + Private() {} + + WaylandPointer<org_kde_kwin_keystate, org_kde_kwin_keystate_destroy> keystate; + + static void org_kde_kwin_keystate_stateChanged(void *data, struct org_kde_kwin_keystate */*keystate*/, uint32_t k, uint32_t s) { + auto q = static_cast<Keystate*>(data); + q->stateChanged(Key(k), State(s)); + } + + static const org_kde_kwin_keystate_listener s_listener; +}; + +const org_kde_kwin_keystate_listener Keystate::Private::s_listener = { + org_kde_kwin_keystate_stateChanged +}; + +Keystate::Keystate(QObject *parent) + : QObject(parent) + , d(new Private()) +{ +} + +Keystate::~Keystate() = default; + +void Keystate::fetchStates() +{ + org_kde_kwin_keystate_fetchStates(d->keystate); +} + +void Keystate::setup(org_kde_kwin_keystate* keystate) +{ + d->keystate.setup(keystate); + org_kde_kwin_keystate_add_listener(keystate, &Keystate::Private::s_listener, this); +} + +void Keystate::destroy() +{ + d->keystate.destroy(); +} + +void Keystate::setEventQueue(KWayland::Client::EventQueue* /*queue*/) +{ +} + + +} +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/client/keystate.h new/kwayland-5.60.0/src/client/keystate.h --- old/kwayland-5.59.0/src/client/keystate.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kwayland-5.60.0/src/client/keystate.h 2019-07-06 15:18:01.000000000 +0200 @@ -0,0 +1,81 @@ +/******************************************************************** +Copyright 2019 Aleix Pol Gonzalez <[email protected]> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) version 3, or any +later version accepted by the membership of KDE e.V. (or its +successor approved by the membership of KDE e.V.), which shall +act as a proxy defined in Section 6 of version 3 of the license. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*********************************************************************/ +#ifndef WAYLAND_KEYSTATE_H +#define WAYLAND_KEYSTATE_H + +#include <QObject> + +#include <KWayland/Client/kwaylandclient_export.h> + +struct org_kde_kwin_keystate; + +namespace KWayland +{ +namespace Client +{ +class EventQueue; + +class KWAYLANDCLIENT_EXPORT Keystate : public QObject +{ + Q_OBJECT +public: + enum class Key { + CapsLock = 0, + NumLock = 1, + ScrollLock = 2, + }; + Q_ENUM(Key); + enum State { + Unlocked = 0, + Latched = 1, + Locked = 2, + }; + Q_ENUM(State) + + Keystate(QObject* parent); + ~Keystate() override; + + void setEventQueue(EventQueue *queue); + + void destroy(); + void setup(org_kde_kwin_keystate* keystate); + + void fetchStates(); + +Q_SIGNALS: + /** + * State of the @p key changed to @p state + */ + void stateChanged(Key key, State state); + + /** + * The corresponding global for this interface on the Registry got removed. + **/ + void removed(); + +private: + class Private; + QScopedPointer<Private> d; +}; + +} +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/client/protocols/keystate.xml new/kwayland-5.60.0/src/client/protocols/keystate.xml --- old/kwayland-5.59.0/src/client/protocols/keystate.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/kwayland-5.60.0/src/client/protocols/keystate.xml 2019-07-06 15:18:01.000000000 +0200 @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<protocol name="keystate"> + <copyright><![CDATA[ + Copyright (C) 2019 Aleix Pol Gonzalez <[email protected]> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + ]]></copyright> + + <interface name="org_kde_kwin_keystate" version="3"> + <description summary="Key States"> + Keeps track of the states of the different keys that have a state attached to it. + </description> + <enum name="key"> + <entry name="capslock" value="0" /> + <entry name="numlock" value="1"/> + <entry name="scrolllock" value="2"/> + </enum> + <enum name="state"> + <entry name="unlocked" value="0" /> + <entry name="latched" value="1"/> + <entry name="locked" value="2"/> + </enum> + <request name="fetchStates"> + </request> + + <event name="stateChanged"> + <description summary="Updates the state for a said key" /> + <arg name="key" type="uint"/> + <arg name="state" type="uint"/> + </event> + </interface> +</protocol> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/client/registry.cpp new/kwayland-5.60.0/src/client/registry.cpp --- old/kwayland-5.59.0/src/client/registry.cpp 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/src/client/registry.cpp 2019-07-06 15:18:01.000000000 +0200 @@ -28,6 +28,7 @@ #include "fullscreen_shell.h" #include "idle.h" #include "idleinhibit.h" +#include "keystate.h" #include "remote_access.h" #include "logging.h" #include "outputconfiguration.h" @@ -91,6 +92,7 @@ #include <wayland-server-decoration-palette-client-protocol.h> #include <wayland-xdg-output-unstable-v1-client-protocol.h> #include <wayland-xdg-decoration-unstable-v1-client-protocol.h> +#include <wayland-keystate-client-protocol.h> /***** * How to add another interface: @@ -377,6 +379,13 @@ &zxdg_decoration_manager_v1_interface, &Registry::xdgDecorationAnnounced, &Registry::xdgDecorationRemoved + }}, + {Registry::Interface::Keystate, { + 1, + QByteArrayLiteral("org_kde_kwin_keystate"), + &org_kde_kwin_keystate_interface, + &Registry::keystateAnnounced, + &Registry::keystateRemoved }} }; @@ -684,6 +693,7 @@ BIND(XdgExporterUnstableV2, zxdg_exporter_v2) BIND(XdgImporterUnstableV2, zxdg_importer_v2) BIND(IdleInhibitManagerUnstableV1, zwp_idle_inhibit_manager_v1) +BIND(Keystate, org_kde_kwin_keystate) BIND2(ShadowManager, Shadow, org_kde_kwin_shadow_manager) BIND2(BlurManager, Blur, org_kde_kwin_blur_manager) BIND2(ContrastManager, Contrast, org_kde_kwin_contrast_manager) @@ -745,6 +755,7 @@ CREATE(ServerSideDecorationManager) CREATE2(ShmPool, Shm) CREATE(AppMenuManager) +CREATE(Keystate) CREATE(ServerSideDecorationPaletteManager) #undef CREATE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/client/registry.h new/kwayland-5.60.0/src/client/registry.h --- old/kwayland-5.59.0/src/client/registry.h 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/src/client/registry.h 2019-07-06 15:18:01.000000000 +0200 @@ -43,6 +43,7 @@ struct org_kde_kwin_outputdevice; struct org_kde_kwin_fake_input; struct org_kde_kwin_idle; +struct org_kde_kwin_keystate; struct org_kde_kwin_remote_access_manager; struct org_kde_kwin_dpms_manager; struct org_kde_kwin_shadow_manager; @@ -83,6 +84,7 @@ class OutputDevice; class Idle; class IdleInhibitManager; +class Keystate; class RemoteAccessManager; class Output; class PlasmaShell; @@ -185,6 +187,7 @@ XdgOutputUnstableV1, ///refers to zxdg_output_v1, @since 5.47 XdgShellStable, ///refers to xdg_wm_base @since 5.48 XdgDecorationUnstableV1, ///refers to zxdg_decoration_manager_v1, @since 5.54 + Keystate,///<refers to org_kwin_keystate, @since 5.57 }; explicit Registry(QObject *parent = nullptr); virtual ~Registry(); @@ -430,6 +433,16 @@ **/ org_kde_kwin_idle *bindIdle(uint32_t name, uint32_t version) const; /** + * Binds the org_kde_kwin_keystate with @p name and @p version. + * If the @p name does not exist or is not for the keystate interface, + * @c null will be returned. + * + * Prefer using createIdle instead. + * @see createIdle + * @since 5.4 + **/ + org_kde_kwin_keystate *bindKeystate(uint32_t name, uint32_t version) const; + /** * Binds the org_kde_kwin_remote_access_manager with @p name and @p version. * If the @p name does not exist or is not for the idle interface, * @c null will be returned. @@ -890,6 +903,22 @@ **/ Idle *createIdle(quint32 name, quint32 version, QObject *parent = nullptr); /** + * Creates a KEystate and sets it up to manage the interface identified by + * @p name and @p version. + * + * Note: in case @p name is invalid or isn't for the org_kde_kwin_keystate interface, + * the returned Idle will not be valid. Therefore it's recommended to call + * isValid on the created instance. + * + * @param name The name of the org_kde_kwin_keystate interface to bind + * @param version The version or the org_kde_kwin_keystate interface to use + * @param parent The parent for Idle + * + * @returns The created Idle. + * @since 5.4 + **/ + Keystate *createKeystate(quint32 name, quint32 version, QObject *parent = nullptr); + /** * Creates a RemoteAccessManager and sets it up to manage the interface identified by * @p name and @p version. * @@ -1727,6 +1756,9 @@ **/ void xdgDecorationRemoved(quint32 name); + void keystateAnnounced(quint32 name, quint32 version); + void keystateRemoved(quint32 name); + ///@} /** * Generic announced signal which gets emitted whenever an interface gets diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/server/CMakeLists.txt new/kwayland-5.60.0/src/server/CMakeLists.txt --- old/kwayland-5.59.0/src/server/CMakeLists.txt 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/src/server/CMakeLists.txt 2019-07-06 15:18:01.000000000 +0200 @@ -16,6 +16,7 @@ idleinhibit_interface_v1.cpp fakeinput_interface.cpp keyboard_interface.cpp + keystate_interface.cpp remote_access_interface.cpp outputconfiguration_interface.cpp outputchangeset.cpp @@ -208,6 +209,11 @@ BASENAME eglstream-controller ) +ecm_add_wayland_server_protocol(SERVER_LIB_SRCS + PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/keystate.xml + BASENAME keystate +) + set(SERVER_GENERATED_SRCS ${CMAKE_CURRENT_BINARY_DIR}/wayland-output-management-client-protocol.h ${CMAKE_CURRENT_BINARY_DIR}/wayland-output-management-server-protocol.h @@ -317,6 +323,7 @@ idle_interface.h idleinhibit_interface.h keyboard_interface.h + keystate_interface.h remote_access_interface.h outputdevice_interface.h outputchangeset.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/server/display.cpp new/kwayland-5.60.0/src/server/display.cpp --- old/kwayland-5.59.0/src/server/display.cpp 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/src/server/display.cpp 2019-07-06 15:18:01.000000000 +0200 @@ -56,6 +56,7 @@ #include "xdgoutput_interface.h" #include "xdgdecoration_interface.h" #include "eglstream_controller_interface.h" +#include "keystate_interface.h" #include <QCoreApplication> #include <QDebug> @@ -522,6 +523,13 @@ return e; } +KeyStateInterface *Display::createKeyStateInterface(QObject *parent) +{ + auto d = new KeyStateInterface(this, parent); + connect(this, &Display::aboutToTerminate, d, [d] { delete d; }); + return d; +} + void Display::createShm() { Q_ASSERT(d->display); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/server/display.h new/kwayland-5.60.0/src/server/display.h --- old/kwayland-5.59.0/src/server/display.h 2019-06-01 18:40:52.000000000 +0200 +++ new/kwayland-5.60.0/src/server/display.h 2019-07-06 15:18:01.000000000 +0200 @@ -91,6 +91,7 @@ class XdgOutputManagerInterface; class XdgDecorationManagerInterface; class EglStreamControllerInterface; +class KeyStateInterface; /** * @brief Class holding the Wayland server display loop. @@ -203,6 +204,10 @@ ContrastManagerInterface *createContrastManager(QObject *parent = nullptr); SlideManagerInterface *createSlideManager(QObject *parent = nullptr); DpmsManagerInterface *createDpmsManager(QObject *parent = nullptr); + + /** @since 5.60 */ + KeyStateInterface *createKeyStateInterface(QObject *parent = nullptr); + /** * @since 5.6 **/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/server/keystate_interface.cpp new/kwayland-5.60.0/src/server/keystate_interface.cpp --- old/kwayland-5.59.0/src/server/keystate_interface.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kwayland-5.60.0/src/server/keystate_interface.cpp 2019-07-06 15:18:01.000000000 +0200 @@ -0,0 +1,96 @@ +/******************************************************************** +Copyright 2019 Aleix Pol Gonzalez <[email protected]> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) version 3, or any +later version accepted by the membership of KDE e.V. (or its +successor approved by the membership of KDE e.V.), which shall +act as a proxy defined in Section 6 of version 3 of the license. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*********************************************************************/ + +#include "keystate_interface.h" +#include "global_p.h" +#include "display.h" + +#include <QDebug> +#include <QVector> +#include <wayland-server.h> +#include <wayland-keystate-server-protocol.h> + +namespace KWayland +{ +namespace Server +{ + +class KeyStateInterface::Private : public Global::Private +{ +public: + Private(Display *d) + : Global::Private(d, &org_kde_kwin_keystate_interface, s_version) + {} + + void bind(wl_client * client, uint32_t version, uint32_t id) override { + auto c = display->getConnection(client); + wl_resource *resource = c->createResource(&org_kde_kwin_keystate_interface, qMin(version, s_version), id); + if (!resource) { + wl_client_post_no_memory(client); + return; + } + wl_resource_set_implementation(resource, &s_interface, this, unbind); + m_resources << resource; + } + + static void unbind(wl_resource *resource) { + auto *d = reinterpret_cast<Private*>(wl_resource_get_user_data(resource)); + d->m_resources.removeAll(resource); + } + + + static void fetchStatesCallback(struct wl_client */*client*/, struct wl_resource *resource) { + auto s = reinterpret_cast<KeyStateInterface::Private*>(wl_resource_get_user_data(resource)); + + for (int i=0; i<s->m_keyStates.count(); ++i) + org_kde_kwin_keystate_send_stateChanged(resource, i, s->m_keyStates[i]); + } + + static const quint32 s_version; + QVector<wl_resource*> m_resources; + QVector<State> m_keyStates = QVector<State>(3, Unlocked); + static const struct org_kde_kwin_keystate_interface s_interface; +}; + +const quint32 KeyStateInterface::Private::s_version = 1; + +KeyStateInterface::KeyStateInterface(Display* d, QObject* parent) + : Global(new Private(d), parent) +{} + +KeyStateInterface::~KeyStateInterface() = default; + +const struct org_kde_kwin_keystate_interface KeyStateInterface::Private::s_interface = { + fetchStatesCallback +}; + +void KeyStateInterface::setState(KeyStateInterface::Key key, KeyStateInterface::State state) +{ + auto dptr = static_cast<KeyStateInterface::Private*>(d.data()); + dptr->m_keyStates[int(key)] = state; + + for(auto r : qAsConst(dptr->m_resources)) { + org_kde_kwin_keystate_send_stateChanged(r, int(key), int(state)); + } +} + +} + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kwayland-5.59.0/src/server/keystate_interface.h new/kwayland-5.60.0/src/server/keystate_interface.h --- old/kwayland-5.59.0/src/server/keystate_interface.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kwayland-5.60.0/src/server/keystate_interface.h 2019-07-06 15:18:01.000000000 +0200 @@ -0,0 +1,71 @@ +/******************************************************************** +Copyright 2019 Aleix Pol Gonzalez <[email protected]> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) version 3, or any +later version accepted by the membership of KDE e.V. (or its +successor approved by the membership of KDE e.V.), which shall +act as a proxy defined in Section 6 of version 3 of the license. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*********************************************************************/ + +#ifndef KWAYLAND_KEYSTATE_INTERFACE_H +#define KWAYLAND_KEYSTATE_INTERFACE_H + +#include <KWayland/Server/kwaylandserver_export.h> +#include "global.h" +#include "resource.h" + +namespace KWayland +{ +namespace Server +{ + +class Display; + +/** + * @brief Exposes key states to wayland clients + * + * @since 5.58 + **/ +class KWAYLANDSERVER_EXPORT KeyStateInterface : public Global +{ + Q_OBJECT +public: + virtual ~KeyStateInterface(); + + enum class Key { + CapsLock = 0, + NumLock = 1, + ScrollLock = 2, + }; + Q_ENUM(Key); + enum State { + Unlocked = 0, + Latched = 1, + Locked = 2, + }; + Q_ENUM(State) + + void setState(Key k, State s); + +private: + explicit KeyStateInterface(Display *display, QObject *parent = nullptr); + friend class Display; + + class Private; +}; + +} +} + +#endif
