19#ifndef MOUSE_TOUCH_ADAPTOR_H
20#define MOUSE_TOUCH_ADAPTOR_H
22#include <QtCore/QAbstractNativeEventFilter>
31class MouseTouchAdaptor :
public QObject,
public QAbstractNativeEventFilter {
34 virtual ~MouseTouchAdaptor();
36 static MouseTouchAdaptor* instance();
39 bool nativeEventFilter(
const QByteArray & eventType,
void *message,
long *result)
override;
41 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
44 void setEnabled(
bool value);
47 void enabledChanged(
bool value);
51 void fetchXInput2Info();
52 bool xi2HandleEvent(xcb_ge_event_t *event);
54 bool handleButtonPress(WId windowId, uint32_t detail, uint32_t modifiers,
int x,
int y);
55 bool handleButtonRelease(WId windowId, uint32_t detail, uint32_t modifiers,
int x,
int y);
56 bool handleMotionNotify(WId windowId, uint32_t modifiers,
int x,
int y);
57 QWindow *findQWindowWithXWindowID(WId windowId);
59 QTouchDevice *m_touchDevice;
60 bool m_leftButtonIsPressed;
61 bool m_triPressModifier;
62 bool m_quadPressModifier;
67 bool m_xi2Enabled{
false};
69 int m_xiOpCode, m_xiEventBase, m_xiErrorBase;