diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-07-06 08:45:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-06 08:45:05 -0400 |
commit | 378149b59c8d2a6d2b0bab7f2bb507dbac990734 (patch) | |
tree | d7a5edd481a0b8961eee20d3008b1fbf6ba51ee1 /wayland/window.c | |
parent | Merge pull request #740 from zandrmartin/json-fixes (diff) | |
parent | Fix formatting guide violations (spaces instead of tabs) (diff) | |
download | sway-378149b59c8d2a6d2b0bab7f2bb507dbac990734.tar.gz sway-378149b59c8d2a6d2b0bab7f2bb507dbac990734.tar.zst sway-378149b59c8d2a6d2b0bab7f2bb507dbac990734.zip |
Merge pull request #739 from deklov/swaybar-pointer-01
Enable windows to register to get notified of pointer button events
Diffstat (limited to 'wayland/window.c')
-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, |