make mouse pointer visibility syn with hotplug/un-plug

This patch makes the mouse pointer disappear when the physical mouse
device is unplugged. It also makes the mouse pointer reappear when a
physical mouse is hotplugged.

NB: There is one small hiccup with this patch and that is: when you
re-plug the mouse in the pointer itself doesn't show until you
physically move the mouse. Tried several things locally to sort it
out, but no success :/

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2016-12-09 08:33:56 -05:00
parent f1c70e626f
commit 20166f16be
2 changed files with 50 additions and 3 deletions

View File

@ -778,7 +778,7 @@ define([CHECK_MODULE_WL_DRM],
if test "x${have_wayland}" = "xyes" ; then
PKG_CHECK_EXISTS([ecore-drm2 >= $efl_ecore_drm2_version], [have_ecore_drm2="yes"], [have_ecore_drm2="no"])
if test "x${have_ecore_drm2}" = "xyes"; then
AC_E_CHECK_PKG(WL_DRM, [ ecore-drm2 >= $efl_ecore_drm2_version ecore >= $efl_version eina >= $efl_version ],
AC_E_CHECK_PKG(WL_DRM, [ ecore-drm2 >= $efl_ecore_drm2_version elput >= $efl_version ecore >= $efl_version eina >= $efl_version ],
[
WL_DRM=true
AC_DEFINE_UNQUOTED([HAVE_DRM2],[1],[enable ecore-drm2 support])

View File

@ -3,6 +3,8 @@
#ifdef HAVE_DRM2
# include <Ecore_Drm2.h>
# include <Elput.h>
static Ecore_Event_Handler *seat_handler;
#else
# include <Ecore_Drm.h>
#endif
@ -1161,22 +1163,67 @@ _drm_randr_available(void)
return EINA_TRUE;
}
#ifndef HAVE_DRM2
static void
_drm_randr_stub(void)
{}
#endif
#ifdef HAVE_DRM2
static Eina_Bool
_drm2_cb_seat_caps(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Elput_Event_Seat_Caps *ev;
ev = event;
if (ev->pointer_count <= 0)
{
e_pointer_hide(e_comp->pointer);
e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
}
else if (ev->pointer_count > 0)
{
e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
e_pointers_size_set(e_config->cursor_size);
}
if (ev->keyboard_count <= 0)
e_comp_wl_input_keyboard_enabled_set(EINA_FALSE);
else if (ev->keyboard_count > 0)
e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
return ECORE_CALLBACK_RENEW;
}
static void
_drm2_init(void)
{
seat_handler =
ecore_event_handler_add(ELPUT_EVENT_SEAT_CAPS, _drm2_cb_seat_caps, NULL);
}
static void
_drm2_shutdown(void)
{
ecore_event_handler_del(seat_handler);
}
#endif
static E_Comp_Screen_Iface drmiface =
{
.available = _drm_randr_available,
.init = _drm_randr_stub,
.shutdown = _drm_randr_stub,
#ifdef HAVE_DRM2
.init = _drm2_init,
.shutdown = _drm2_shutdown,
.create = _drm2_randr_create,
.apply = _drm2_randr_apply,
.dpms = _drm2_dpms,
.key_down = _drm2_key_down,
.key_up = _drm2_key_up,
#else
.init = _drm_randr_stub,
.shutdown = _drm_randr_stub,
.create = _drm_randr_create,
.apply = _drm_randr_apply,
.dpms = _drm_dpms,