2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2021-03-10 16:08:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
2016-04-06 09:35:31 +00:00
|
|
|
#include "keyboard_interface.h"
|
2020-10-02 14:22:59 +00:00
|
|
|
|
|
|
|
#include <qwayland-server-wayland.h>
|
2016-04-06 09:35:31 +00:00
|
|
|
|
2020-10-02 14:22:59 +00:00
|
|
|
#include <QHash>
|
2021-08-29 05:11:06 +00:00
|
|
|
#include <QPointer>
|
2016-04-06 11:50:19 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2016-04-06 09:35:31 +00:00
|
|
|
{
|
2020-10-02 14:22:59 +00:00
|
|
|
class ClientConnection;
|
|
|
|
|
|
|
|
class KeyboardInterfacePrivate : public QtWaylandServer::wl_keyboard
|
2016-04-06 09:35:31 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-10-02 14:22:59 +00:00
|
|
|
KeyboardInterfacePrivate(SeatInterface *s);
|
|
|
|
|
2021-03-26 11:14:04 +00:00
|
|
|
void sendKeymap(Resource *resource);
|
2016-04-06 09:35:31 +00:00
|
|
|
void sendModifiers();
|
|
|
|
void sendModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group, quint32 serial);
|
|
|
|
|
2020-10-02 14:22:59 +00:00
|
|
|
QList<Resource *> keyboardsForClient(ClientConnection *client) const;
|
2016-04-06 11:50:19 +00:00
|
|
|
void sendLeave(SurfaceInterface *surface, quint32 serial);
|
|
|
|
void sendEnter(SurfaceInterface *surface, quint32 serial);
|
|
|
|
|
2021-08-29 05:11:06 +00:00
|
|
|
static KeyboardInterfacePrivate *get(KeyboardInterface *keyboard)
|
|
|
|
{
|
|
|
|
return keyboard->d.data();
|
|
|
|
}
|
2020-10-02 14:22:59 +00:00
|
|
|
|
2016-04-06 09:35:31 +00:00
|
|
|
SeatInterface *seat;
|
|
|
|
SurfaceInterface *focusedSurface = nullptr;
|
|
|
|
QMetaObject::Connection destroyConnection;
|
2021-03-26 11:14:04 +00:00
|
|
|
QByteArray keymap;
|
2016-04-06 09:35:31 +00:00
|
|
|
|
2020-10-02 14:22:59 +00:00
|
|
|
struct {
|
|
|
|
qint32 charactersPerSecond = 0;
|
|
|
|
qint32 delay = 0;
|
|
|
|
} keyRepeat;
|
|
|
|
|
|
|
|
struct Modifiers {
|
|
|
|
quint32 depressed = 0;
|
|
|
|
quint32 latched = 0;
|
|
|
|
quint32 locked = 0;
|
|
|
|
quint32 group = 0;
|
|
|
|
quint32 serial = 0;
|
|
|
|
};
|
|
|
|
Modifiers modifiers;
|
|
|
|
|
2021-03-24 09:50:52 +00:00
|
|
|
QHash<quint32, KeyboardKeyState> states;
|
|
|
|
bool updateKey(quint32 key, KeyboardKeyState state);
|
2020-10-02 14:22:59 +00:00
|
|
|
QVector<quint32> pressedKeys() const;
|
|
|
|
|
|
|
|
protected:
|
2021-03-15 10:34:35 +00:00
|
|
|
void keyboard_release(Resource *resource) override;
|
2020-10-02 14:22:59 +00:00
|
|
|
void keyboard_bind_resource(Resource *resource) override;
|
2016-04-06 09:35:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|