2016-05-20 13:48:11 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2016 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#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>
|
2016-05-31 07:23:12 +00:00
|
|
|
#include <QPointF>
|
2016-05-20 13:48:11 +00:00
|
|
|
#include <QSizeF>
|
2016-05-30 06:22:04 +00:00
|
|
|
#include <QVector>
|
2016-05-20 13:48:11 +00:00
|
|
|
|
2017-11-10 17:07:15 +00:00
|
|
|
#include <array>
|
|
|
|
|
2016-05-20 13:48:11 +00:00
|
|
|
struct libinput_device {
|
|
|
|
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;
|
2016-05-30 06:22:04 +00:00
|
|
|
QVector<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;
|
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;
|
2016-05-20 13:48:11 +00:00
|
|
|
};
|
|
|
|
|
2016-05-30 15:46:53 +00:00
|
|
|
struct libinput_event {
|
|
|
|
libinput_device *device = nullptr;
|
|
|
|
libinput_event_type type = LIBINPUT_EVENT_NONE;
|
|
|
|
quint32 time = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct libinput_event_keyboard : libinput_event {
|
|
|
|
libinput_event_keyboard() {
|
|
|
|
type = LIBINPUT_EVENT_KEYBOARD_KEY;
|
|
|
|
}
|
|
|
|
libinput_key_state state = LIBINPUT_KEY_STATE_RELEASED;
|
|
|
|
quint32 key = 0;
|
|
|
|
};
|
|
|
|
|
2016-05-31 07:23:12 +00:00
|
|
|
struct libinput_event_pointer : libinput_event {
|
|
|
|
libinput_button_state buttonState = LIBINPUT_BUTTON_STATE_RELEASED;
|
|
|
|
quint32 button = 0;
|
|
|
|
bool verticalAxis = false;
|
|
|
|
bool horizontalAxis = false;
|
|
|
|
qreal horizontalAxisValue = 0.0;
|
|
|
|
qreal verticalAxisValue = 0.0;
|
Send axis_source, axis_discrete, and axis_stop
Summary:
So far KWin didn't send axis_source, axis_discrete, and axis_stop. Even
though most of those events are optional, clients need them to work as
expected. For example, one needs axis_source and axis_stop to implement
kinetic scrolling; Xwayland needs axis_discrete to prevent multiple
scroll events when the compositor sends axis deltas greater than 10, etc.
BUG: 404152
FIXED-IN: 5.17.0
Test Plan:
* Content of a webpage in Firefox is moved by one line per each mouse
wheel "click";
* Scrolled gedit using 2 fingers on GNOME Shell, sway, and KDE Plasma;
in all three cases wayland debug looked the same (except diagonal scroll
motions).
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19000
2019-02-12 09:14:51 +00:00
|
|
|
qreal horizontalDiscreteAxisValue = 0.0;
|
|
|
|
qreal verticalDiscreteAxisValue = 0.0;
|
|
|
|
libinput_pointer_axis_source axisSource = {};
|
2016-05-31 07:23:12 +00:00
|
|
|
QSizeF delta;
|
|
|
|
QPointF absolutePos;
|
|
|
|
};
|
|
|
|
|
2016-05-31 08:14:28 +00:00
|
|
|
struct libinput_event_touch : libinput_event {
|
|
|
|
qint32 slot = -1;
|
|
|
|
QPointF absolutePos;
|
|
|
|
};
|
|
|
|
|
2016-08-05 12:35:33 +00:00
|
|
|
struct libinput_event_gesture : libinput_event {
|
|
|
|
int fingerCount = 0;
|
|
|
|
bool cancelled = false;
|
|
|
|
QSizeF delta = QSizeF(0, 0);
|
|
|
|
qreal scale = 0.0;
|
|
|
|
qreal angleDelta = 0.0;
|
|
|
|
};
|
|
|
|
|
2017-12-27 16:57:00 +00:00
|
|
|
struct libinput_event_switch : libinput_event {
|
|
|
|
enum class State {
|
|
|
|
Off,
|
|
|
|
On
|
|
|
|
};
|
|
|
|
State state = State::Off;
|
|
|
|
quint64 timeMicroseconds = 0;
|
|
|
|
};
|
|
|
|
|
2016-06-02 05:46:09 +00:00
|
|
|
struct libinput {
|
|
|
|
int refCount = 1;
|
|
|
|
QByteArray seat;
|
|
|
|
int assignSeatRetVal = 0;
|
|
|
|
};
|
|
|
|
|
2016-05-20 13:48:11 +00:00
|
|
|
#endif
|