devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=20166f16be9cdde72a6ec646ab06f84c1ed2f3d4

commit 20166f16be9cdde72a6ec646ab06f84c1ed2f3d4
Author: Chris Michael <[email protected]>
Date:   Fri Dec 9 08:33:56 2016 -0500

    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 <[email protected]>
---
 configure.ac                    |  2 +-
 src/modules/wl_drm/e_mod_main.c | 51 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 71a1ea4..533633c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c
index 1052c62..56d11cc 100644
--- a/src/modules/wl_drm/e_mod_main.c
+++ b/src/modules/wl_drm/e_mod_main.c
@@ -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,

-- 


Reply via email to