summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandinputdevice_p.h
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2013-12-29 12:06:58 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-06 13:44:27 +0100
commit2fa224efd44445f3e87cb9471fd4b9269d5ffc0d (patch)
tree22b8c69d9aac39927023d9bbcffbf9a946d787ba /src/client/qwaylandinputdevice_p.h
parentcd1e9d036ff1354c65b016ba8af0d6d6bd7cea92 (diff)
Move the code for seat's keyboard, pointer and touch in different classes
This allows to remove the keyboard, pointer or touch objects when the wl_seat advertizes it is gone. Also fixes multiple keyboard, pointer and touch binding for the same object. Change-Id: I878f494caf7f4ac277b6a4d24037dcecf9ff84e4 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/client/qwaylandinputdevice_p.h')
-rw-r--r--src/client/qwaylandinputdevice_p.h86
1 files changed, 12 insertions, 74 deletions
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index 9e955f5d2..867258ade 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -69,9 +69,6 @@ class QWaylandDataDevice;
class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice
: public QObject
- , public QtWayland::wl_pointer
- , public QtWayland::wl_keyboard
- , public QtWayland::wl_touch
, public QtWayland::wl_seat
{
Q_OBJECT
@@ -93,103 +90,44 @@ public:
void removeMouseButtonFromState(Qt::MouseButton button);
QWaylandWindow *pointerFocus() const;
+ QWaylandWindow *keyboardFocus() const;
+ QWaylandWindow *touchFocus() const;
Qt::KeyboardModifiers modifiers() const;
uint32_t serial() const;
- uint32_t cursorSerial() const { return mCursorSerial; }
+ uint32_t cursorSerial() const;
private slots:
void repeatKey();
private:
+ class Keyboard;
+ class Pointer;
+ class Touch;
+
QWaylandDisplay *mQDisplay;
struct wl_display *mDisplay;
- struct wl_callback *mFocusCallback;
uint32_t mCaps;
struct wl_surface *pointerSurface;
QWaylandDataDevice *mDataDevice;
- QWaylandWindow *mPointerFocus;
- QWaylandWindow *mKeyboardFocus;
- QWaylandWindow *mTouchFocus;
- Qt::MouseButtons mButtons;
- QPointF mSurfacePos;
- QPointF mGlobalPos;
+ Keyboard *mKeyboard;
+ Pointer *mPointer;
+ Touch *mTouch;
+
uint32_t mTime;
uint32_t mSerial;
- uint32_t mEnterSerial;
- uint32_t mCursorSerial;
+ QTimer mRepeatTimer;
void seat_capabilities(uint32_t caps) Q_DECL_OVERRIDE;
-
- void pointer_enter(uint32_t serial, struct wl_surface *surface,
- wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE;
- void pointer_leave(uint32_t time, struct wl_surface *surface);
- void pointer_motion(uint32_t time,
- wl_fixed_t sx, wl_fixed_t sy) Q_DECL_OVERRIDE;
- void pointer_button(uint32_t serial, uint32_t time,
- uint32_t button, uint32_t state) Q_DECL_OVERRIDE;
- void pointer_axis(uint32_t time,
- uint32_t axis,
- wl_fixed_t value) Q_DECL_OVERRIDE;
-
- void keyboard_keymap(uint32_t format,
- int32_t fd,
- uint32_t size) Q_DECL_OVERRIDE;
- void keyboard_enter(uint32_t time,
- struct wl_surface *surface,
- struct wl_array *keys) Q_DECL_OVERRIDE;
- void keyboard_leave(uint32_t time,
- struct wl_surface *surface) Q_DECL_OVERRIDE;
- void keyboard_key(uint32_t serial, uint32_t time,
- uint32_t key, uint32_t state) Q_DECL_OVERRIDE;
- void keyboard_modifiers(uint32_t serial,
- uint32_t mods_depressed,
- uint32_t mods_latched,
- uint32_t mods_locked,
- uint32_t group) Q_DECL_OVERRIDE;
-
- void touch_down(uint32_t serial,
- uint32_t time,
- struct wl_surface *surface,
- int32_t id,
- wl_fixed_t x,
- wl_fixed_t y) Q_DECL_OVERRIDE;
- void touch_up(uint32_t serial,
- uint32_t time,
- int32_t id) Q_DECL_OVERRIDE;
- void touch_motion(uint32_t time,
- int32_t id,
- wl_fixed_t x,
- wl_fixed_t y) Q_DECL_OVERRIDE;
- void touch_frame() Q_DECL_OVERRIDE;
- void touch_cancel() Q_DECL_OVERRIDE;
-
void handleTouchPoint(int id, double x, double y, Qt::TouchPointState state);
- static const wl_callback_listener callback;
- static void focusCallback(void *data, struct wl_callback *callback, uint32_t time);
-
- QList<QWindowSystemInterface::TouchPoint> mTouchPoints;
- QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints;
QTouchDevice *mTouchDevice;
-#ifndef QT_NO_WAYLAND_XKB
- xkb_context *mXkbContext;
- xkb_keymap *mXkbMap;
- xkb_state *mXkbState;
-#endif
-
- int mRepeatKey;
- uint32_t mRepeatCode;
- uint32_t mRepeatTime;
- QString mRepeatText;
- QTimer mRepeatTimer;
-
friend class QWaylandTouchExtension;
friend class QWaylandQtKeyExtension;
};