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
|
|
|
|
|
|
|
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;
|
|
|
|
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-05-20 13:48:11 +00:00
|
|
|
qreal pointerAcceleration = 0.0;
|
|
|
|
int setPointerAccelerationReturnValue = 0;
|
|
|
|
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-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;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
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
|