File indexing completed on 2024-05-19 05:32:35
0001 /* 0002 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 #pragma once 0007 0008 #include "keyboard.h" 0009 #include "utils/ramfile.h" 0010 0011 #include <qwayland-server-wayland.h> 0012 0013 #include <QHash> 0014 #include <QPointer> 0015 0016 namespace KWin 0017 { 0018 class ClientConnection; 0019 0020 class KeyboardInterfacePrivate : public QtWaylandServer::wl_keyboard 0021 { 0022 public: 0023 KeyboardInterfacePrivate(SeatInterface *s); 0024 0025 void sendKeymap(Resource *resource); 0026 void sendModifiers(SurfaceInterface *surface); 0027 void sendModifiers(SurfaceInterface *surface, quint32 depressed, quint32 latched, quint32 locked, quint32 group, quint32 serial); 0028 0029 QList<Resource *> keyboardsForClient(ClientConnection *client) const; 0030 void sendLeave(SurfaceInterface *surface, quint32 serial); 0031 void sendEnter(SurfaceInterface *surface, quint32 serial); 0032 0033 static KeyboardInterfacePrivate *get(KeyboardInterface *keyboard) 0034 { 0035 return keyboard->d.get(); 0036 } 0037 0038 SeatInterface *seat; 0039 SurfaceInterface *focusedSurface = nullptr; 0040 QMetaObject::Connection destroyConnection; 0041 QPointer<SurfaceInterface> modifierFocusSurface; 0042 QByteArray keymap; 0043 RamFile sharedKeymapFile; 0044 0045 struct 0046 { 0047 qint32 charactersPerSecond = 0; 0048 qint32 delay = 0; 0049 } keyRepeat; 0050 0051 struct Modifiers 0052 { 0053 quint32 depressed = 0; 0054 quint32 latched = 0; 0055 quint32 locked = 0; 0056 quint32 group = 0; 0057 quint32 serial = 0; 0058 }; 0059 Modifiers modifiers; 0060 0061 QHash<quint32, KeyboardKeyState> states; 0062 bool updateKey(quint32 key, KeyboardKeyState state); 0063 QList<quint32> pressedKeys() const; 0064 0065 protected: 0066 void keyboard_release(Resource *resource) override; 0067 void keyboard_bind_resource(Resource *resource) override; 0068 }; 0069 0070 }