2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2016-05-20 13:48:11 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
2016-05-20 13:48:11 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2016-05-20 13:48:11 +00:00
|
|
|
#ifndef MOCK_LIBINPUT_H
|
|
|
|
#define MOCK_LIBINPUT_H
|
2016-05-30 15:46:53 +00:00
|
|
|
#include <libinput.h>
|
2016-05-20 13:48:11 +00:00
|
|
|
|
|
|
|
#include <QByteArray>
|
2023-10-19 06:50:15 +00:00
|
|
|
#include <QList>
|
2016-05-31 07:23:12 +00:00
|
|
|
#include <QPointF>
|
2016-05-20 13:48:11 +00:00
|
|
|
#include <QSizeF>
|
|
|
|
|
2017-11-10 17:07:15 +00:00
|
|
|
#include <array>
|
2022-12-21 00:55:20 +00:00
|
|
|
#include <chrono>
|
2017-11-10 17:07:15 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput_device
|
|
|
|
{
|
2022-04-29 08:23:23 +00:00
|
|
|
void *userData = nullptr;
|
2016-05-20 13:48:11 +00:00
|
|
|
bool keyboard = false;
|
|
|
|
bool pointer = false;
|
|
|
|
bool touch = false;
|
2016-08-03 07:31:47 +00:00
|
|
|
bool tabletTool = false;
|
2016-05-20 13:48:11 +00:00
|
|
|
bool gestureSupported = false;
|
2017-12-27 16:57:00 +00:00
|
|
|
bool switchDevice = false;
|
2016-05-20 13:48:11 +00:00
|
|
|
QByteArray name;
|
2016-08-15 14:55:10 +00:00
|
|
|
QByteArray sysName = QByteArrayLiteral("event0");
|
2016-05-20 13:48:11 +00:00
|
|
|
QByteArray outputName;
|
|
|
|
quint32 product = 0;
|
|
|
|
quint32 vendor = 0;
|
|
|
|
int tapFingerCount = 0;
|
|
|
|
QSizeF deviceSize;
|
|
|
|
int deviceSizeReturnValue = 0;
|
|
|
|
bool tapEnabledByDefault = false;
|
2016-08-11 13:13:36 +00:00
|
|
|
bool tapToClick = false;
|
2016-08-11 14:02:26 +00:00
|
|
|
bool tapAndDragEnabledByDefault = false;
|
|
|
|
bool tapAndDrag = false;
|
2016-08-11 14:32:00 +00:00
|
|
|
bool tapDragLockEnabledByDefault = false;
|
|
|
|
bool tapDragLock = false;
|
2016-05-20 13:48:11 +00:00
|
|
|
bool supportsDisableWhileTyping = false;
|
|
|
|
bool supportsPointerAcceleration = false;
|
|
|
|
bool supportsLeftHanded = false;
|
|
|
|
bool supportsCalibrationMatrix = false;
|
|
|
|
bool supportsDisableEvents = false;
|
|
|
|
bool supportsDisableEventsOnExternalMouse = false;
|
2016-10-27 17:06:34 +00:00
|
|
|
bool supportsMiddleEmulation = false;
|
2016-10-28 16:30:10 +00:00
|
|
|
bool supportsNaturalScroll = false;
|
2016-10-28 18:17:20 +00:00
|
|
|
quint32 supportedScrollMethods = 0;
|
2016-10-27 17:06:34 +00:00
|
|
|
bool middleEmulationEnabledByDefault = false;
|
|
|
|
bool middleEmulation = false;
|
2016-12-02 13:58:56 +00:00
|
|
|
enum libinput_config_tap_button_map defaultTapButtonMap = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
|
|
|
enum libinput_config_tap_button_map tapButtonMap = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
|
|
|
int setTapButtonMapReturnValue = 0;
|
|
|
|
enum libinput_config_dwt_state disableWhileTypingEnabledByDefault = LIBINPUT_CONFIG_DWT_DISABLED;
|
|
|
|
enum libinput_config_dwt_state disableWhileTyping = LIBINPUT_CONFIG_DWT_DISABLED;
|
|
|
|
int setDisableWhileTypingReturnValue = 0;
|
|
|
|
qreal defaultPointerAcceleration = 0.0;
|
2016-05-20 13:48:11 +00:00
|
|
|
qreal pointerAcceleration = 0.0;
|
|
|
|
int setPointerAccelerationReturnValue = 0;
|
2016-11-22 13:49:01 +00:00
|
|
|
bool leftHandedEnabledByDefault = false;
|
2016-05-20 13:48:11 +00:00
|
|
|
bool leftHanded = false;
|
|
|
|
int setLeftHandedReturnValue = 0;
|
2016-10-28 16:30:10 +00:00
|
|
|
bool naturalScrollEnabledByDefault = false;
|
|
|
|
bool naturalScroll = false;
|
|
|
|
int setNaturalScrollReturnValue = 0;
|
2016-10-28 18:17:20 +00:00
|
|
|
enum libinput_config_scroll_method defaultScrollMethod = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
|
|
|
|
enum libinput_config_scroll_method scrollMethod = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
|
|
|
|
int setScrollMethodReturnValue = 0;
|
|
|
|
quint32 defaultScrollButton = 0;
|
|
|
|
quint32 scrollButton = 0;
|
|
|
|
int setScrollButtonReturnValue = 0;
|
2016-05-25 15:25:58 +00:00
|
|
|
Qt::MouseButtons supportedButtons;
|
2023-10-19 06:50:15 +00:00
|
|
|
QList<quint32> keys;
|
2016-05-30 14:04:06 +00:00
|
|
|
bool enabled = true;
|
|
|
|
int setEnableModeReturnValue = 0;
|
2016-08-11 13:13:36 +00:00
|
|
|
int setTapToClickReturnValue = 0;
|
2016-08-11 14:02:26 +00:00
|
|
|
int setTapAndDragReturnValue = 0;
|
2016-08-11 14:32:00 +00:00
|
|
|
int setTapDragLockReturnValue = 0;
|
2016-10-27 17:06:34 +00:00
|
|
|
int setMiddleEmulationReturnValue = 0;
|
2016-12-02 13:58:56 +00:00
|
|
|
quint32 supportedPointerAccelerationProfiles = 0;
|
|
|
|
enum libinput_config_accel_profile defaultPointerAccelerationProfile = LIBINPUT_CONFIG_ACCEL_PROFILE_NONE;
|
|
|
|
enum libinput_config_accel_profile pointerAccelerationProfile = LIBINPUT_CONFIG_ACCEL_PROFILE_NONE;
|
|
|
|
bool setPointerAccelerationProfileReturnValue = 0;
|
2017-11-10 17:07:15 +00:00
|
|
|
std::array<float, 6> defaultCalibrationMatrix{{1.0f, 0.0f, 0.0f,
|
|
|
|
0.0f, 1.0f, 0.0f}};
|
|
|
|
std::array<float, 6> calibrationMatrix{{1.0f, 0.0f, 0.0f,
|
|
|
|
0.0f, 1.0f, 0.0f}};
|
|
|
|
bool defaultCalibrationMatrixIsIdentity = true;
|
2020-07-19 00:51:28 +00:00
|
|
|
bool calibrationMatrixIsIdentity = true;
|
2017-12-27 16:57:00 +00:00
|
|
|
|
|
|
|
bool lidSwitch = false;
|
|
|
|
bool tabletModeSwitch = false;
|
[libinput] Add support for clickfinger and button areas click method
Summary:
Added support for libinput clickfinger , areas method for touchpad KCM
Also added mock methods.
Included commits in branch libinputClickMethod:
Added libinput mock methods
Added : 1. setScrollMethod 2. added key value pair in QMap 3. added methods for Q_Props
Added Q_Props for click method, signal
Added variables and initialize in constructor
Reviewers: #kwin, graesslin, davidedmundson, zzag
Reviewed By: #kwin, graesslin, zzag
Subscribers: zzag, graesslin, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17577
2018-12-22 16:29:41 +00:00
|
|
|
quint32 supportedClickMethods = 0;
|
|
|
|
enum libinput_config_click_method defaultClickMethod = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
|
|
|
enum libinput_config_click_method clickMethod = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
|
|
|
|
bool setClickMethodReturnValue = 0;
|
2020-03-17 14:21:35 +00:00
|
|
|
uint32_t buttonCount = 0;
|
|
|
|
uint32_t stripCount = 0;
|
|
|
|
uint32_t ringCount = 0;
|
2016-05-20 13:48:11 +00:00
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput_event
|
|
|
|
{
|
|
|
|
virtual ~libinput_event()
|
|
|
|
{
|
|
|
|
}
|
2016-05-30 15:46:53 +00:00
|
|
|
libinput_device *device = nullptr;
|
|
|
|
libinput_event_type type = LIBINPUT_EVENT_NONE;
|
2022-12-21 00:55:20 +00:00
|
|
|
std::chrono::microseconds time = std::chrono::microseconds::zero();
|
2016-05-30 15:46:53 +00:00
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput_event_keyboard : libinput_event
|
|
|
|
{
|
|
|
|
libinput_event_keyboard()
|
|
|
|
{
|
2016-05-30 15:46:53 +00:00
|
|
|
type = LIBINPUT_EVENT_KEYBOARD_KEY;
|
|
|
|
}
|
|
|
|
libinput_key_state state = LIBINPUT_KEY_STATE_RELEASED;
|
|
|
|
quint32 key = 0;
|
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput_event_pointer : libinput_event
|
|
|
|
{
|
2016-05-31 07:23:12 +00:00
|
|
|
libinput_button_state buttonState = LIBINPUT_BUTTON_STATE_RELEASED;
|
|
|
|
quint32 button = 0;
|
|
|
|
bool verticalAxis = false;
|
|
|
|
bool horizontalAxis = false;
|
2022-10-11 10:33:04 +00:00
|
|
|
qreal horizontalScrollValue = 0.0;
|
|
|
|
qreal verticalScrollValue = 0.0;
|
|
|
|
qreal horizontalScrollValueV120 = 0.0;
|
|
|
|
qreal verticalScrollValueV120 = 0.0;
|
2022-10-25 08:18:45 +00:00
|
|
|
QPointF delta;
|
2016-05-31 07:23:12 +00:00
|
|
|
QPointF absolutePos;
|
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput_event_touch : libinput_event
|
|
|
|
{
|
2016-05-31 08:14:28 +00:00
|
|
|
qint32 slot = -1;
|
|
|
|
QPointF absolutePos;
|
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput_event_gesture : libinput_event
|
|
|
|
{
|
2016-08-05 12:35:33 +00:00
|
|
|
int fingerCount = 0;
|
|
|
|
bool cancelled = false;
|
2022-10-25 08:18:45 +00:00
|
|
|
QPointF delta = QPointF(0, 0);
|
2016-08-05 12:35:33 +00:00
|
|
|
qreal scale = 0.0;
|
|
|
|
qreal angleDelta = 0.0;
|
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput_event_switch : libinput_event
|
|
|
|
{
|
2017-12-27 16:57:00 +00:00
|
|
|
enum class State {
|
|
|
|
Off,
|
|
|
|
On
|
|
|
|
};
|
|
|
|
State state = State::Off;
|
|
|
|
};
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
struct libinput
|
|
|
|
{
|
2016-06-02 05:46:09 +00:00
|
|
|
int refCount = 1;
|
|
|
|
QByteArray seat;
|
|
|
|
int assignSeatRetVal = 0;
|
|
|
|
};
|
|
|
|
|
2016-05-20 13:48:11 +00:00
|
|
|
#endif
|