e_comp_wl: check number of devices before enabling/disabling devices 00/53500/5 accepted/tizen/mobile/20151210.025232 accepted/tizen/tv/20151210.024825 accepted/tizen/wearable/20151210.025111 submit/tizen/20151209.150737
authorDuna Oh <duna.oh@samsung.com>
Mon, 7 Dec 2015 10:02:34 +0000 (19:02 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Wed, 9 Dec 2015 11:18:18 +0000 (03:18 -0800)
Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: I475428014b531c29c5388606596e833c28523183

src/bin/e_comp_wl.h
src/modules/wl_drm/e_mod_main.c

index 3a495a9..66f274c 100644 (file)
@@ -184,6 +184,7 @@ struct _E_Comp_Wl_Data
         int mod_changed;
         int repeat_delay;
         int repeat_rate;
+        unsigned int num_devices;
      } kbd;
 
    struct
@@ -193,12 +194,14 @@ struct _E_Comp_Wl_Data
         wl_fixed_t x, y;
         wl_fixed_t grab_x, grab_y;
         uint32_t button;
+        unsigned int num_devices;
      } ptr;
 
    struct
      {
         Eina_List *resources;
         Eina_Bool enabled : 1;
+        unsigned int num_devices;
      } touch;
 
    struct
index 8442689..dd3985f 100644 (file)
@@ -88,15 +88,21 @@ _e_mod_drm_cb_input_device_add(void *data, int type, void *event)
 
    if (e->caps & EVDEV_SEAT_POINTER)
      {
-        e_pointer_object_set(comp->pointer, NULL, 0, 0);
-        e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
+        if (comp->wl_comp_data->ptr.num_devices == 0)
+          {
+             e_pointer_object_set(comp->pointer, NULL, 0, 0);
+             e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
+          }
+        comp->wl_comp_data->ptr.num_devices++;
      }
    else if (e->caps & EVDEV_SEAT_KEYBOARD)
      {
+        comp->wl_comp_data->kbd.num_devices++;
         e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
      }
    else if (e->caps & EVDEV_SEAT_TOUCH)
      {
+        comp->wl_comp_data->touch.num_devices++;
         e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
         e_comp_wl_input_touch_enabled_set(EINA_TRUE);
      }
@@ -109,13 +115,18 @@ static Eina_Bool
 _e_mod_drm_cb_input_device_del(void *data, int type, void *event)
 {
    Ecore_Drm_Event_Input_Device_Del *e;
+   E_Comp *comp = data;
 
    if (!(e = event)) goto end;
 
    if (e->caps & EVDEV_SEAT_POINTER)
      {
-        e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
-        e_pointer_hide(e_comp->pointer);
+        comp->wl_comp_data->ptr.num_devices--;
+        if (comp->wl_comp_data->ptr.num_devices == 0)
+          {
+             e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
+             e_pointer_hide(e_comp->pointer);
+          }
      }
 
 end: