2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2014-11-25 12:39:24 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
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
|
2014-11-25 12:39:24 +00:00
|
|
|
|
2022-04-22 09:27:33 +00:00
|
|
|
#include "kwin_export.h"
|
2014-11-25 12:39:24 +00:00
|
|
|
|
2022-04-22 09:27:33 +00:00
|
|
|
#include <QObject>
|
2014-11-25 12:39:24 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2014-11-25 12:39:24 +00:00
|
|
|
{
|
2022-01-27 19:14:53 +00:00
|
|
|
class ClientConnection;
|
2014-11-25 12:39:24 +00:00
|
|
|
class SeatInterface;
|
|
|
|
class SurfaceInterface;
|
2020-10-02 14:22:59 +00:00
|
|
|
class KeyboardInterfacePrivate;
|
2014-11-25 12:39:24 +00:00
|
|
|
|
2021-03-24 09:50:52 +00:00
|
|
|
enum class KeyboardKeyState : quint32;
|
|
|
|
|
2015-09-09 11:49:58 +00:00
|
|
|
/**
|
|
|
|
* @brief Resource for the wl_keyboard interface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2022-04-22 09:27:33 +00:00
|
|
|
class KWIN_EXPORT KeyboardInterface : public QObject
|
2014-11-25 12:39:24 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-10-02 14:22:59 +00:00
|
|
|
~KeyboardInterface() override;
|
2014-11-25 12:39:24 +00:00
|
|
|
|
2015-09-09 11:49:58 +00:00
|
|
|
/**
|
|
|
|
* @returns the focused SurfaceInterface on this keyboard resource, if any.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-25 12:39:24 +00:00
|
|
|
SurfaceInterface *focusedSurface() const;
|
|
|
|
|
2020-10-02 14:22:59 +00:00
|
|
|
/**
|
|
|
|
* @returns The key repeat in character per second
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-10-02 14:22:59 +00:00
|
|
|
qint32 keyRepeatRate() const;
|
|
|
|
/**
|
|
|
|
* @returns The delay on key press before starting repeating keys
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-10-02 14:22:59 +00:00
|
|
|
qint32 keyRepeatDelay() const;
|
2020-03-19 13:58:52 +00:00
|
|
|
void setKeymap(const QByteArray &content);
|
2020-11-06 04:33:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the key repeat information to be forwarded to all bound keyboards.
|
|
|
|
*
|
|
|
|
* To disable key repeat set a @p charactersPerSecond of @c 0.
|
|
|
|
*
|
|
|
|
* Requires wl_seat version 4.
|
|
|
|
*
|
|
|
|
* @param charactersPerSecond The characters per second rate, value of @c 0 disables key repeating
|
|
|
|
* @param delay The delay on key press before starting repeating keys
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-11-06 04:33:47 +00:00
|
|
|
void setRepeatInfo(qint32 charactersPerSecond, qint32 delay);
|
|
|
|
|
2021-03-24 09:50:52 +00:00
|
|
|
void sendKey(quint32 key, KeyboardKeyState state);
|
2022-01-27 19:14:53 +00:00
|
|
|
void sendKey(quint32 key, KeyboardKeyState state, ClientConnection *client);
|
2021-03-24 09:50:52 +00:00
|
|
|
void sendModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group);
|
2020-10-02 14:22:59 +00:00
|
|
|
|
2020-11-06 04:33:47 +00:00
|
|
|
private:
|
|
|
|
void setFocusedSurface(SurfaceInterface *surface, quint32 serial);
|
2022-08-09 02:10:45 +00:00
|
|
|
void setModifierFocusSurface(SurfaceInterface *surface);
|
2014-11-25 12:39:24 +00:00
|
|
|
friend class SeatInterface;
|
2023-02-09 11:54:56 +00:00
|
|
|
friend class SeatInterfacePrivate;
|
2020-10-02 14:22:59 +00:00
|
|
|
friend class KeyboardInterfacePrivate;
|
|
|
|
explicit KeyboardInterface(SeatInterface *seat);
|
2014-11-25 12:39:24 +00:00
|
|
|
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KeyboardInterfacePrivate> d;
|
2014-11-25 12:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-08-29 05:11:06 +00:00
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::KeyboardInterface *)
|