diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-04-11 17:55:58 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-02-28 08:31:49 +0100 |
commit | d249d8b5232a285f3669573fc8eed29551cb019b (patch) | |
tree | bea5ab465b454268f928aff5df672df20ffc9d6c | |
parent | 917602dfd00624247172aa9e7689ebd2045eb4d9 (diff) |
wayland: Fix mouse button numeration
-rw-r--r-- | src/video/wayland/SDL_waylandevents.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 29fb9440..1a3dce7c 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -30,7 +30,9 @@ #include "SDL_waylandvideo.h" #include "SDL_waylandevents_c.h" #include "SDL_waylandwindow.h" + #include <X11/extensions/XKBcommon.h> +#include <linux/input.h> #include "../../events/scancodes_xfree86.h" @@ -120,11 +122,29 @@ window_handle_button(void *data, { struct SDL_WaylandInput *input = data; SDL_WaylandWindow *window = input->pointer_focus; + uint32_t sdl_button; + + switch (button) { + case BTN_LEFT: + default: + sdl_button = SDL_BUTTON_LEFT; + break; + case BTN_MIDDLE: + sdl_button = SDL_BUTTON_MIDDLE; + break; + case BTN_RIGHT: + sdl_button = SDL_BUTTON_RIGHT; + break; + case BTN_SIDE: + sdl_button = SDL_BUTTON_X1; + break; + case BTN_EXTRA: + sdl_button = SDL_BUTTON_X2; + break; + } SDL_SendMouseButton(window->sdlwindow, - state ? SDL_PRESSED : SDL_RELEASED, - button); - + state ? SDL_PRESSED : SDL_RELEASED, sdl_button); } static char * |