#include <stdlib.h>
#include <tbm_bufmgr.h>
#include <pepper-devicemgr.h>
+#include <pepper-xkb.h>
/* basic pepper objects */
+pepper_xkb_t *xkb = NULL;
pepper_seat_t *seat = NULL;
pepper_evdev_t *evdev = NULL;
pepper_keyrouter_t *keyrouter = NULL;
}
}
+static void
+_handle_keyboard_key(pepper_event_listener_t *listener, pepper_object_t *object, uint32_t id, void *info, void *data)
+{
+ pepper_input_event_t *event;
+
+ PEPPER_CHECK(id == PEPPER_EVENT_KEYBOARD_KEY, return, "%d event will not be handled.\n", id);
+ PEPPER_CHECK(data, return, "Invalid data.\n");
+
+ event = (pepper_input_event_t *)info;
+ PEPPER_TRACE("[%s] keycode:%d, state=%d\n", __FUNCTION__, event->key, event->state);
+
+ pepper_keyrouter_event_handler(listener, object, id, info, keyrouter);
+}
+
/* seat keyboard add event handler */
static void
_handle_seat_keyboard_add(pepper_event_listener_t *listener, pepper_object_t *object, uint32_t id, void *info, void *data)
PEPPER_TRACE("[%s] keyboard added\n", __FUNCTION__);
- pepper_keyboard_set_keymap_info(keyboard, WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP, -1, 0);
+ pepper_xkb_keyboard_set_keymap(xkb, keyboard, NULL);
listener_keyboard_event = pepper_object_add_event_listener((pepper_object_t *)keyboard,
PEPPER_EVENT_KEYBOARD_KEY,
0,
- pepper_keyrouter_event_handler,
- (void *)keyrouter);
+ _handle_keyboard_key,
+ keyboard);
}
/* seat pointer add event handler */
res = tbm_bufmgr_bind_native_display(bufmgr, (void *)pepper_compositor_get_display(compositor));
PEPPER_CHECK(res, goto shutdown_on_failure, "Failed to bind native display with tbm buffer manager !\n");
+ /* create pepper xkb */
+ xkb = pepper_xkb_create();
+ PEPPER_CHECK(xkb, goto shutdown_on_failure, "Failed to create pepper_xkb !\n");
+
/* register event listeners */
listener_seat_add = pepper_object_add_event_listener((pepper_object_t *)compositor,
PEPPER_EVENT_COMPOSITOR_SEAT_ADD,
}
/* TODO : clean up any other objects if needed */
+ if(xkb)
+ {
+ pepper_xkb_destroy(xkb);
+ xkb = NULL;
+ }
/* destroy keyrouter */
if (keyrouter)