2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2016-05-24 08:57:57 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
2016-05-24 08:57:57 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2016-05-24 08:57:57 +00:00
|
|
|
#include "input_event.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
MouseEvent::MouseEvent(QEvent::Type type, const QPointF &pos, Qt::MouseButton button,
|
|
|
|
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
|
2016-10-07 12:47:25 +00:00
|
|
|
quint32 timestamp, const QSizeF &delta, const QSizeF &deltaNonAccelerated,
|
|
|
|
quint64 timestampMicroseconds, LibInput::Device *device)
|
2016-05-24 08:57:57 +00:00
|
|
|
: QMouseEvent(type, pos, pos, button, buttons, modifiers)
|
2016-10-07 12:47:25 +00:00
|
|
|
, m_delta(delta)
|
|
|
|
, m_deltaUnccelerated(deltaNonAccelerated)
|
|
|
|
, m_timestampMicroseconds(timestampMicroseconds)
|
2016-05-24 08:57:57 +00:00
|
|
|
, m_device(device)
|
|
|
|
{
|
|
|
|
setTimestamp(timestamp);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
WheelEvent::WheelEvent(const QPointF &pos, qreal delta, qint32 discreteDelta, Qt::Orientation orientation,
|
|
|
|
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, InputRedirection::PointerAxisSource source,
|
|
|
|
quint32 timestamp, LibInput::Device *device)
|
2016-05-24 08:57:57 +00:00
|
|
|
: QWheelEvent(pos, pos, QPoint(), (orientation == Qt::Horizontal) ? QPoint(delta, 0) : QPoint(0, delta), delta, orientation, buttons, modifiers)
|
|
|
|
, m_device(device)
|
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
|
|
|
, m_orientation(orientation)
|
|
|
|
, m_delta(delta)
|
|
|
|
, m_discreteDelta(discreteDelta)
|
|
|
|
, m_source(source)
|
2016-05-24 08:57:57 +00:00
|
|
|
{
|
|
|
|
setTimestamp(timestamp);
|
|
|
|
}
|
|
|
|
|
|
|
|
KeyEvent::KeyEvent(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers, quint32 code, quint32 keysym,
|
|
|
|
const QString &text, bool autorepeat, quint32 timestamp, LibInput::Device *device)
|
|
|
|
: QKeyEvent(type, key, modifiers, code, keysym, 0, text, autorepeat)
|
|
|
|
, m_device(device)
|
|
|
|
{
|
|
|
|
setTimestamp(timestamp);
|
|
|
|
}
|
|
|
|
|
2017-12-27 19:25:36 +00:00
|
|
|
SwitchEvent::SwitchEvent(State state, quint32 timestamp, quint64 timestampMicroseconds, LibInput::Device* device)
|
|
|
|
: QInputEvent(QEvent::User)
|
|
|
|
, m_state(state)
|
|
|
|
, m_timestampMicroseconds(timestampMicroseconds)
|
|
|
|
, m_device(device)
|
|
|
|
{
|
|
|
|
setTimestamp(timestamp);
|
|
|
|
}
|
|
|
|
|
2020-03-17 14:21:35 +00:00
|
|
|
TabletEvent::TabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
|
|
|
|
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
|
|
|
|
qreal tangentialPressure, qreal rotation, int z,
|
|
|
|
Qt::KeyboardModifiers keyState, qint64 uniqueID,
|
|
|
|
Qt::MouseButton button, Qt::MouseButtons buttons, InputRedirection::TabletToolType toolType, const QVector<InputRedirection::Capability> &capabilities, quint64 serialId, const QString &tabletSysName)
|
|
|
|
: QTabletEvent(t, pos, globalPos, device, pointerType, pressure, xTilt, yTilt, tangentialPressure, rotation, z, keyState, uniqueID, button, buttons)
|
|
|
|
, m_toolType(toolType)
|
|
|
|
, m_capabilities(capabilities)
|
|
|
|
, m_serialId(serialId)
|
|
|
|
, m_tabletSysName(tabletSysName)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-24 08:57:57 +00:00
|
|
|
}
|