summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vincent.sanders@collabora.co.uk>2013-03-27 21:19:55 (GMT)
committer Vincent Sanders <vincent.sanders@collabora.co.uk>2013-03-27 21:19:55 (GMT)
commit983a5de257daeffa011fda0ef3e811d8f38ed67a (patch)
treeb3b9d2a35dc2e8c142cfb0943d7db6dd7b263693
parentbe2f62201c5500e09f790bf07ad88309aab409d6 (diff)
downloadlibnsfb-983a5de257daeffa011fda0ef3e811d8f38ed67a.tar.gz
libnsfb-983a5de257daeffa011fda0ef3e811d8f38ed67a.tar.bz2
make mouse buttons workvince/wayland
-rw-r--r--src/surface/wld.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/surface/wld.c b/src/surface/wld.c
index 198c15f..7843639 100644
--- a/src/surface/wld.c
+++ b/src/surface/wld.c
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <sys/mman.h>
+#include <linux/input.h>
#include <wayland-client.h>
#include "libnsfb.h"
@@ -968,6 +969,39 @@ static void
pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
uint32_t time, uint32_t button, uint32_t state_w)
{
+ struct wld_input *input = data;
+ struct wld_event *event;
+ enum wl_pointer_button_state state = state_w;
+
+ event = calloc(1, sizeof(struct wld_event));
+
+ if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
+ event->event.type = NSFB_EVENT_KEY_DOWN;
+ } else {
+ event->event.type = NSFB_EVENT_KEY_UP;
+ }
+
+ switch (button) {
+ case BTN_LEFT:
+ event->event.value.keycode = NSFB_KEY_MOUSE_1;
+ break;
+ case BTN_MIDDLE:
+ event->event.value.keycode = NSFB_KEY_MOUSE_2;
+ break;
+ case BTN_RIGHT:
+ event->event.value.keycode = NSFB_KEY_MOUSE_3;
+ break;
+ case BTN_FORWARD:
+ event->event.value.keycode = NSFB_KEY_MOUSE_4;
+ break;
+ case BTN_BACK:
+ event->event.value.keycode = NSFB_KEY_MOUSE_5;
+ break;
+ }
+
+ enqueue_wld_event(input->connection, event);
+
+
#if 0
struct input *input = data;
struct widget *widget;