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 <QDebug>
9 #include <QPointer>
10 #include <wayland-client-protocol.h>
11 #include <wayland-keystate-client-protocol.h>
12 
13 namespace KWayland
14 {
15 namespace Client
16 {
17 class Q_DECL_HIDDEN Keystate::Private
18 {
19 public:
20  Private()
21  {
22  }
23 
24  WaylandPointer<org_kde_kwin_keystate, org_kde_kwin_keystate_destroy> keystate;
25 
26  static void org_kde_kwin_keystate_stateChanged(void *data, struct org_kde_kwin_keystate * /*keystate*/, uint32_t k, uint32_t s)
27  {
28  auto q = static_cast<Keystate *>(data);
29  q->stateChanged(Key(k), State(s));
30  }
31 
32  static const org_kde_kwin_keystate_listener s_listener;
33 };
34 
35 const org_kde_kwin_keystate_listener Keystate::Private::s_listener = {org_kde_kwin_keystate_stateChanged};
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 }
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Feb 8 2023 03:59:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.