diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-01-31 10:20:01 -0500 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2022-02-21 17:11:32 +0000 |
commit | d5480efc7a03641600df411dea93308e5edc8b27 (patch) | |
tree | 377e16476b41a7740a3cb88b5e3338da95eac6a3 /backend/x11/input_device.c | |
parent | a1978b1299952586a2fd016aab682c7fdbe735ee (diff) |
types/wlr_pointer: add base wlr_input_device
wlr_pointer owns its wlr_input_device. It will be initialized when the
pointer is initialized, and finished when the pointer is destroyed.
Diffstat (limited to 'backend/x11/input_device.c')
-rw-r--r-- | backend/x11/input_device.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 94b70524..5ca3e956 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -33,7 +33,7 @@ static void send_key_event(struct wlr_x11_backend *x11, uint32_t key, static void send_button_event(struct wlr_x11_output *output, uint32_t key, enum wlr_button_state st, xcb_timestamp_t time) { struct wlr_event_pointer_button ev = { - .device = &output->pointer_dev, + .device = &output->pointer.base, .time_msec = time, .button = key, .state = st, @@ -45,7 +45,7 @@ static void send_button_event(struct wlr_x11_output *output, uint32_t key, static void send_axis_event(struct wlr_x11_output *output, int32_t delta, xcb_timestamp_t time) { struct wlr_event_pointer_axis ev = { - .device = &output->pointer_dev, + .device = &output->pointer.base, .time_msec = time, .source = WLR_AXIS_SOURCE_WHEEL, .orientation = WLR_AXIS_ORIENTATION_VERTICAL, @@ -60,7 +60,7 @@ static void send_axis_event(struct wlr_x11_output *output, int32_t delta, static void send_pointer_position_event(struct wlr_x11_output *output, int16_t x, int16_t y, xcb_timestamp_t time) { struct wlr_event_pointer_motion_absolute ev = { - .device = &output->pointer_dev, + .device = &output->pointer.base, .time_msec = time, .x = (double)x / output->wlr_output.width, .y = (double)y / output->wlr_output.height, @@ -339,6 +339,8 @@ bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) { switch (wlr_dev->type) { case WLR_INPUT_DEVICE_KEYBOARD: return wlr_dev->keyboard->impl == &keyboard_impl; + case WLR_INPUT_DEVICE_POINTER: + return wlr_dev->pointer->impl == &pointer_impl; default: return wlr_dev->impl == &input_device_impl; } |