ecore-wl2: Add support for idle_enterer

Summary: This fixes an issue where scrolling mouse wheel would not
actually perform any scroll until another event was received.

NB: Unsure if we need this for "server" connections yet

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-10-06 11:44:09 -04:00
parent c5dba8cd32
commit b89c45dbf9
2 changed files with 36 additions and 0 deletions

View File

@ -207,6 +207,38 @@ _cb_globals_hash_del(void *data)
free(global);
}
static Eina_Bool
_cb_connect_idle(void *data)
{
Ecore_Wl2_Display *ewd;
int ret = 0;
ewd = data;
if (!ewd) return ECORE_CALLBACK_RENEW;
ret = wl_display_get_error(ewd->wl.display);
if (ret < 0) goto err;
ret = wl_display_dispatch_pending(ewd->wl.display);
if (ret < 0) goto err;
ret = wl_display_flush(ewd->wl.display);
if ((ret < 0) && (errno == EAGAIN))
ecore_main_fd_handler_active_set(ewd->fd_hdl,
(ECORE_FD_READ | ECORE_FD_WRITE));
return ECORE_CALLBACK_RENEW;
err:
if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
{
ERR("Wayland Socket Error: %s", strerror(errno));
return ECORE_CALLBACK_CANCEL;
}
return ECORE_CALLBACK_RENEW;
}
static void
_cb_sync_done(void *data, struct wl_callback *cb, uint32_t serial EINA_UNUSED)
{
@ -264,6 +296,7 @@ _ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
if (ewd->xkb_context) xkb_context_unref(ewd->xkb_context);
if (ewd->idle_enterer) ecore_idle_enterer_del(ewd->idle_enterer);
if (ewd->fd_hdl) ecore_main_fd_handler_del(ewd->fd_hdl);
eina_hash_free(ewd->globals);
@ -377,6 +410,8 @@ ecore_wl2_display_connect(const char *name)
ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR,
_cb_connect_data, ewd, NULL, NULL);
ewd->idle_enterer = ecore_idle_enterer_add(_cb_connect_idle, ewd);
wl_registry_add_listener(wl_display_get_registry(ewd->wl.display),
&_registry_listener, ewd);

View File

@ -64,6 +64,7 @@ struct _Ecore_Wl2_Display
struct xkb_context *xkb_context;
Ecore_Idle_Enterer *idle_enterer;
Ecore_Fd_Handler *fd_hdl;
Eina_Hash *globals;