KWayland

keystate.cpp
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #include "keystate.h"
7 #include "wayland_pointer_p.h"
8 #include <QPointer>
9 #include <QDebug>
10 #include <wayland-client-protocol.h>
11 #include <wayland-keystate-client-protocol.h>
12 
13 namespace KWayland
14 {
15 namespace Client
16 {
17 
18 class Q_DECL_HIDDEN Keystate::Private
19 {
20 public:
21  Private() {}
22 
23  WaylandPointer<org_kde_kwin_keystate, org_kde_kwin_keystate_destroy> keystate;
24 
25  static void org_kde_kwin_keystate_stateChanged(void *data, struct org_kde_kwin_keystate */*keystate*/, uint32_t k, uint32_t s) {
26  auto q = static_cast<Keystate*>(data);
27  q->stateChanged(Key(k), State(s));
28  }
29 
30  static const org_kde_kwin_keystate_listener s_listener;
31 };
32 
33 const org_kde_kwin_keystate_listener Keystate::Private::s_listener = {
34  org_kde_kwin_keystate_stateChanged
35 };
36 
37 Keystate::Keystate(QObject *parent)
38  : QObject(parent)
39  , d(new Private())
40 {
41 }
42 
43 Keystate::~Keystate() = default;
44 
45 void Keystate::fetchStates()
46 {
47  org_kde_kwin_keystate_fetchStates(d->keystate);
48 }
49 
50 void Keystate::setup(org_kde_kwin_keystate* keystate)
51 {
52  d->keystate.setup(keystate);
53  org_kde_kwin_keystate_add_listener(keystate, &Keystate::Private::s_listener, this);
54 }
55 
56 void Keystate::destroy()
57 {
58  d->keystate.destroy();
59 }
60 
61 void Keystate::setEventQueue(KWayland::Client::EventQueue* /*queue*/)
62 {
63 }
64 
65 
66 }
67 }
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:55
State
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Aug 7 2020 22:48:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.