diff options
author | David Eklov <david.eklov@gmail.com> | 2016-07-05 01:21:56 -0500 |
---|---|---|
committer | David Eklov <david.eklov@gmail.com> | 2016-07-06 01:03:04 -0500 |
commit | c8a64305fd746ab1b33367d3ffcc9fa054221717 (patch) | |
tree | eadad88c75e6cb6e252e1e807e11e9178680ff94 /wayland | |
parent | Check capabilities before using pointer and keyboard (diff) | |
download | sway-c8a64305fd746ab1b33367d3ffcc9fa054221717.tar.gz sway-c8a64305fd746ab1b33367d3ffcc9fa054221717.tar.zst sway-c8a64305fd746ab1b33367d3ffcc9fa054221717.zip |
Enable windows to register to get notified of pointer button events
Diffstat (limited to 'wayland')
-rw-r--r-- | wayland/window.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/wayland/window.c b/wayland/window.c index 7ca9e4ec..e055e244 100644 --- a/wayland/window.c +++ b/wayland/window.c | |||
@@ -30,10 +30,20 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer, | |||
30 | 30 | ||
31 | static void pointer_handle_motion(void *data, struct wl_pointer *pointer, | 31 | static void pointer_handle_motion(void *data, struct wl_pointer *pointer, |
32 | uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) { | 32 | uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) { |
33 | struct window *window = data; | ||
34 | |||
35 | window->pointer_input.last_x = sx_w; | ||
36 | window->pointer_input.last_y = sy_w; | ||
33 | } | 37 | } |
34 | 38 | ||
35 | static void pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, | 39 | static void pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, |
36 | uint32_t time, uint32_t button, uint32_t state_w) { | 40 | uint32_t time, uint32_t button, uint32_t state_w) { |
41 | struct window *window = data; | ||
42 | struct pointer_input *input = &window->pointer_input; | ||
43 | |||
44 | if (window->pointer_input.notify) { | ||
45 | window->pointer_input.notify(window, input->last_x, input->last_y, button); | ||
46 | } | ||
37 | } | 47 | } |
38 | 48 | ||
39 | static void pointer_handle_axis(void *data, struct wl_pointer *pointer, | 49 | static void pointer_handle_axis(void *data, struct wl_pointer *pointer, |