Support a drm backend when update mouse configuration. 03/53903/8
authorJengHyun Kang <jhyuni.kang@samsung.com>
Thu, 10 Dec 2015 06:14:26 +0000 (15:14 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Mon, 21 Dec 2015 02:33:45 +0000 (18:33 -0800)
Change-Id: I51211a49b7abaf98163fe431fa66e8fb3c8bf555

src/bin/e_mouse.c

index 7cae8ecc31967742e16f17268b5ef4a96c9bdde8..c5ef85b7be62ff0b9f55ef7cc221169a14531841 100644 (file)
@@ -1,50 +1,61 @@
 #include "e.h"
+#ifdef HAVE_WL_DRM
+#include <Ecore_Drm.h>
+#endif
 
 EAPI int
 e_mouse_update(void)
 {
-   unsigned char map[256] = { 0 };
-   int n;
-
 #ifndef HAVE_WAYLAND_ONLY
    if (e_comp->comp_type == E_PIXMAP_TYPE_X)
      {
+        unsigned char map[256] = { 0 };
+        int n;
+
         if (!ecore_x_pointer_control_set(e_config->mouse_accel_numerator,
                                          e_config->mouse_accel_denominator,
                                          e_config->mouse_accel_threshold))
           return 0;
 
         if (!ecore_x_pointer_mapping_get(map, 256)) return 0;
-     }
-#endif
 
-   for (n = 0; n < 256; n++)
-     {
-        if (!map[n]) break;
-     }
-   if (n < 3)
-     {
-        map[0] = 1;
-        map[1] = 2;
-        map[2] = 3;
-        n = 3;
-     }
-   if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
-     {
-        map[0] = 1;
-        map[2] = 3;
+        for (n = 0; n < 256; n++)
+          {
+             if (!map[n]) break;
+          }
+        if (n < 3)
+          {
+             map[0] = 1;
+             map[1] = 2;
+             map[2] = 3;
+             n = 3;
+          }
+        if (e_config->mouse_hand == E_MOUSE_HAND_RIGHT)
+          {
+             map[0] = 1;
+             map[2] = 3;
+          }
+        else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
+          {
+             map[0] = 3;
+             map[2] = 1;
+          }
+
+        if (!ecore_x_pointer_mapping_set(map, n)) return 0;
      }
-   else if (e_config->mouse_hand == E_MOUSE_HAND_LEFT)
+#endif
+#ifdef HAVE_WL_DRM
+   if (strstr(ecore_evas_engine_name_get(e_comp->ee), "drm"))
      {
-        map[0] = 3;
-        map[2] = 1;
-     }
+        Eina_List *list, *l;
+        Ecore_Drm_Device *dev;
 
-#ifndef HAVE_WAYLAND_ONLY
-   if (e_comp->comp_type == E_PIXMAP_TYPE_X)
-     if (!ecore_x_pointer_mapping_set(map, n)) return 0;
+        list = ecore_drm_devices_get();
+        EINA_LIST_FOREACH(list, l, dev)
+          {
+             ecore_drm_device_pointer_left_handed_set(dev, (Eina_Bool)!e_config->mouse_hand);
+          }
+     }
 #endif
-
    return 1;
 }
-