Provide a fake approach to tablet event propagation
Summary: At the moment, the state of wayland of getting such events isn't all that clear. There's a zwp_tablet protocol that isn't stable yet and more importantly isn't supported by Qt just yet. Have it move and click the mouse about for now. Depends on D25663 and D25763 Reviewers: #kwin, romangg Reviewed By: #kwin, romangg Subscribers: romangg, zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D25764
This commit is contained in:
parent
4172ef3b30
commit
f6128ec875
3 changed files with 48 additions and 1 deletions
41
input.cpp
41
input.cpp
|
@ -1520,6 +1520,46 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Useful when there's no proper tablet support on the clients
|
||||
*/
|
||||
class FakeTabletInputFilter : public InputEventFilter
|
||||
{
|
||||
public:
|
||||
FakeTabletInputFilter()
|
||||
{
|
||||
}
|
||||
|
||||
bool tabletToolEvent(QTabletEvent *event) override
|
||||
{
|
||||
if (!workspace()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::TabletMove:
|
||||
case QEvent::TabletEnterProximity:
|
||||
input()->pointer()->processMotion(event->globalPosF(), event->timestamp());
|
||||
break;
|
||||
case QEvent::TabletPress:
|
||||
input()->pointer()->processButton(KWin::qtMouseButtonToButton(Qt::LeftButton),
|
||||
InputRedirection::PointerButtonPressed, event->timestamp());
|
||||
break;
|
||||
case QEvent::TabletRelease:
|
||||
input()->pointer()->processButton(KWin::qtMouseButtonToButton(Qt::LeftButton),
|
||||
InputRedirection::PointerButtonReleased, event->timestamp());
|
||||
break;
|
||||
case QEvent::TabletLeaveProximity:
|
||||
break;
|
||||
default:
|
||||
qCWarning(KWIN_CORE) << "Unexpected tablet event type" << event;
|
||||
break;
|
||||
}
|
||||
waylandServer()->simulateUserActivity();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class DragAndDropInputFilter : public InputEventFilter
|
||||
{
|
||||
public:
|
||||
|
@ -1881,6 +1921,7 @@ void InputRedirection::setupInputFilters()
|
|||
if (waylandServer()) {
|
||||
installInputEventFilter(new WindowActionInputFilter);
|
||||
installInputEventFilter(new ForwardInputFilter);
|
||||
installInputEventFilter(new FakeTabletInputFilter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,11 @@ static const QHash<uint32_t, Qt::MouseButton> s_buttonToQtMouseButton = {
|
|||
{ 0x11f , Qt::ExtraButton13 },
|
||||
};
|
||||
|
||||
uint32_t qtMouseButtonToButton(Qt::MouseButton button)
|
||||
{
|
||||
return s_buttonToQtMouseButton.key(button);
|
||||
}
|
||||
|
||||
static Qt::MouseButton buttonToQtMouseButton(uint32_t button)
|
||||
{
|
||||
// all other values get mapped to ExtraButton24
|
||||
|
@ -91,7 +96,6 @@ static Qt::MouseButton buttonToQtMouseButton(uint32_t button)
|
|||
// buttons are pressed is correct and that's all we care about.
|
||||
return s_buttonToQtMouseButton.value(button, Qt::ExtraButton24);
|
||||
}
|
||||
}
|
||||
|
||||
static bool screenContainsPos(const QPointF &pos)
|
||||
{
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace LibInput
|
|||
class Device;
|
||||
}
|
||||
|
||||
uint32_t qtMouseButtonToButton(Qt::MouseButton button);
|
||||
|
||||
class KWIN_EXPORT PointerInputRedirection : public InputDeviceHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
Loading…
Reference in a new issue