/* local function prototypes */
static Eina_Bool _ecore_wl_shutdown(Eina_Bool close);
-static int _ecore_wl_cb_event_mask_update(unsigned int mask, void *data);
static Eina_Bool _ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__);
-static void _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data);
+static Eina_Bool _ecore_wl_cb_flush_events(void *data, Ecore_Fd_Handler *hdl __UNUSED__);
+static void _ecore_wl_cb_handle_global(void *data, struct wl_registry *reg, unsigned int id, const char *interface, unsigned int version __UNUSED__);
static Eina_Bool _ecore_wl_xkb_init(Ecore_Wl_Display *ewd);
static Eina_Bool _ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd);
/* local variables */
static int _ecore_wl_init_count = 0;
+static const struct wl_registry_listener _ecore_wl_registry_listener;
/* external variables */
int _ecore_wl_log_dom = -1;
return --_ecore_wl_init_count;
}
- _ecore_wl_disp->fd =
- wl_display_get_fd(_ecore_wl_disp->wl.display,
- _ecore_wl_cb_event_mask_update, _ecore_wl_disp);
+ _ecore_wl_disp->fd = wl_display_get_fd(_ecore_wl_disp->wl.display);
_ecore_wl_disp->fd_hdl =
ecore_main_fd_handler_add(_ecore_wl_disp->fd, ECORE_FD_READ,
_ecore_wl_cb_handle_data, _ecore_wl_disp,
- NULL, NULL);
+ _ecore_wl_cb_flush_events, _ecore_wl_disp);
wl_list_init(&_ecore_wl_disp->inputs);
wl_list_init(&_ecore_wl_disp->outputs);
- wl_display_add_global_listener(_ecore_wl_disp->wl.display,
- _ecore_wl_cb_handle_global, _ecore_wl_disp);
+ _ecore_wl_disp->wl.registry = wl_display_get_registry(_ecore_wl_disp->wl.display);
+ wl_registry_add_listener(_ecore_wl_disp->wl.registry,
+ &_ecore_wl_registry_listener, _ecore_wl_disp);
+ wl_display_roundtrip(_ecore_wl_disp->wl.display);
/* Init egl */
/* FIXME: Process connection events ?? */
- /* wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE); */
+ /* wl_display_dispatch(_ecore_wl_disp->wl.display); */
/* TODO: create pointer surfaces */
{
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
- while (_ecore_wl_disp->mask & WL_DISPLAY_WRITABLE)
- wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_WRITABLE);
+ wl_display_dispatch(_ecore_wl_disp->wl.display);
}
/**
EAPI void
ecore_wl_display_iterate(void)
{
- wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE);
+ wl_display_dispatch(_ecore_wl_disp->wl.display);
}
/**
return _ecore_wl_init_count;
}
-static int
-_ecore_wl_cb_event_mask_update(unsigned int mask, void *data)
+static Eina_Bool
+_ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__)
{
Ecore_Wl_Display *ewd;
-// LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
- ewd = data;
- ewd->mask = mask;
- return 0;
+ if (!(ewd = data)) return ECORE_CALLBACK_RENEW;
+ wl_display_dispatch(ewd->wl.display);
+ return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
-_ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__)
+_ecore_wl_cb_flush_events(void *data, Ecore_Fd_Handler *hdl __UNUSED__)
{
Ecore_Wl_Display *ewd;
/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
if (!(ewd = data)) return ECORE_CALLBACK_RENEW;
- wl_display_iterate(ewd->wl.display, ewd->mask);
+ wl_display_dispatch_pending(ewd->wl.display);
+ wl_display_flush(ewd->wl.display);
return ECORE_CALLBACK_RENEW;
}
static void
-_ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data)
+_ecore_wl_cb_handle_global(void *data, struct wl_registry *reg, unsigned int id, const char *interface, unsigned int version __UNUSED__)
{
Ecore_Wl_Display *ewd;
/* TODO: Add listener for wl_display so we can catch fatal errors !! */
if (!strcmp(interface, "wl_compositor"))
- ewd->wl.compositor = wl_display_bind(disp, id, &wl_compositor_interface);
+ ewd->wl.compositor = wl_registry_bind(reg, id, &wl_compositor_interface, 1);
else if (!strcmp(interface, "wl_output"))
_ecore_wl_output_add(ewd, id);
else if (!strcmp(interface, "wl_seat"))
_ecore_wl_input_add(ewd, id);
else if (!strcmp(interface, "wl_shell"))
- ewd->wl.shell = wl_display_bind(disp, id, &wl_shell_interface);
+ ewd->wl.shell = wl_registry_bind(reg, id, &wl_shell_interface, 1);
/* else if (!strcmp(interface, "desktop_shell")) */
- /* ewd->wl.desktop_shell = wl_display_bind(disp, id, &wl_shell_interface); */
+ /* ewd->wl.desktop_shell = wl_registry_bind(reg, id, &wl_shell_interface, 1); */
else if (!strcmp(interface, "wl_shm"))
{
- ewd->wl.shm = wl_display_bind(disp, id, &wl_shm_interface);
+ ewd->wl.shm = wl_registry_bind(reg, id, &wl_shm_interface, 1);
ewd->cursor_theme = wl_cursor_theme_load(NULL, 32, ewd->wl.shm);
}
else if (!strcmp(interface, "wl_data_device_manager"))
{
ewd->wl.data_device_manager =
- wl_display_bind(disp, id, &wl_data_device_manager_interface);
+ wl_registry_bind(reg, id, &wl_data_device_manager_interface, 1);
}
if ((ewd->wl.compositor) && (ewd->wl.shm) && (ewd->wl.shell))
}
}
+static void
+_ecore_wl_cb_handle_global_remove(void *data, struct wl_registry *reg, unsigned int id)
+{
+}
+
+static const struct wl_registry_listener _ecore_wl_registry_listener = {
+ _ecore_wl_cb_handle_global,
+ _ecore_wl_cb_handle_global_remove
+};
+
static Eina_Bool
_ecore_wl_xkb_init(Ecore_Wl_Display *ewd)
{