#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
+#include <errno.h>
+#include <Ecore.h>
#include <wayland-client.h>
#include <xkbcommon/xkbcommon.h>
#include <tizen-extension-client-protocol.h>
struct xkb_context *xkb_context;
struct xkb_keymap *keymap;
+Ecore_Fd_Handler *fd_hdl;
+
typedef struct tizen_keyrouter_notify tizen_keyrouter_notify_t;
struct tizen_keyrouter_notify
{
for(i=0; i<nkeycodes; i++)
{
tizen_keyrouter_set_keygrab(tz_keyrouter, NULL, keycodes[i], mode);
- wl_display_dispatch(display);
}
}
}
}
+static Eina_Bool
+_cb_handle_data(void *data, Ecore_Fd_Handler *hdl)
+{
+ int ret = 0;
+ if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_ERROR))
+ {
+ LOGE("Received error on wayland display fd");
+ goto err;
+ }
+
+ if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_READ))
+ {
+ ret = wl_display_dispatch(display);
+ }
+ else if(ecore_main_fd_handler_active_get(hdl, ECORE_FD_WRITE))
+ {
+ ret = wl_display_flush(display);
+ if(ret == 0){
+ ecore_main_fd_handler_active_set(hdl, ECORE_FD_READ);
+ }
+ }
+
+ if((ret < 0) && (errno != EAGAIN) && (errno != EINVAL))
+ goto err;
+
+ return ECORE_CALLBACK_RENEW;
+
+err:
+ fd_hdl = NULL;
+ LOGE("Wayland Socket Error : %s\n", eina_error_msg_get(errno));
+ return ECORE_CALLBACK_CANCEL;
+}
+
void _wl_init(void)
{
int res = 0;
}
wl_registry_add_listener(registry, ®istry_listener, NULL);
+ fd_hdl = ecore_main_fd_handler_add(wl_display_get_fd(display),
+ (ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR),
+ _cb_handle_data, NULL, NULL, NULL);
+
+ if(!fd_hdl)
+ {
+ LOGE("Failed to add ecore fd(%d, wl.display) handler\n", wl_display_get_fd(display));
+ wl_registry_destroy(registry);
+ wl_display_disconnect(display);
+ registry = NULL;
+ display = NULL;
+ return;
+ }
+
while(!set_keymap)
wl_display_roundtrip(display);
}