Fix cursor problems 36/39936/1 accepted/tizen/common/20150527.135020 accepted/tizen/mobile/20150528.004006 accepted/tizen/tv/20150528.003939 accepted/tizen/wearable/20150528.003951 submit/tizen/20150527.080704
authorMinJeong Kim <minjjj.kim@samsung.com>
Tue, 26 May 2015 14:32:47 +0000 (23:32 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Tue, 26 May 2015 15:25:36 +0000 (00:25 +0900)
 - Remove size check for a cursor object.
   This size check always failed if it's first request for "set_cursor" with
   the cursor surface because ec->frame is never resized since it was created.
 - Update position values for cursor client.
 - Show/Hide cursor when pointer device is attached/detached by using handlers
   for ECORE_DRM_EVENT_INPUT_ADD/DEL.

Change-Id: I64538317d09105e7a2c3b3257a86705a5e94873c
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/bin/e_comp_object.c
src/bin/e_comp_wl.c
src/bin/e_comp_wl_input.c
src/modules/wl_drm/e_mod_main.c

index 15af875..f160cfc 100644 (file)
@@ -819,6 +819,8 @@ _e_comp_intercept_move(void *data, Evas_Object *obj, int x, int y)
 
    if (!e_util_strcmp("wl_pointer-cursor", cw->ec->icccm.window_role))
      {
+        cw->ec->client.x = x, cw->ec->client.y = y;
+        cw->ec->x = x, cw->ec->y = y;
         evas_object_move(obj, x, y);
         return;
      }
index dd21e2b..6f880b3 100644 (file)
@@ -398,7 +398,7 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
       Evas_Object *o;
 
       ecore_evas_cursor_get(e_comp->ee, &o, NULL, NULL, NULL);
-      if (e_comp->pointer->o_ptr != o)
+      if ((e_comp->pointer->o_ptr != o) && (e_comp->wl_comp_data->ptr.enabled))
         e_pointer_object_set(e_comp->pointer, NULL, 0, 0);
    }
    if (e_object_is_del(E_OBJECT(ec))) return;
index d8c9c06..96dc6e8 100644 (file)
@@ -35,7 +35,6 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
    E_Client *ec;
    uint64_t sid;
    Eina_Bool got_mouse = EINA_FALSE;
-   int cursor_w = 0, cursor_h = 0;
 
    /* get compositor data */
    if (!(cdata = wl_resource_get_user_data(resource))) return;
@@ -75,9 +74,6 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
    /* ignore cursor changes during resize/move I guess */
    if (e_client_action_get()) return;
 
-   evas_object_geometry_get(ec->frame, NULL, NULL, &cursor_w, &cursor_h);
-   if ((cursor_w == 0) || (cursor_h == 0)) return;
-
    e_pointer_object_set(e_comp->pointer, ec->frame, x, y);
 }
 
index 692eb36..6e0949c 100644 (file)
@@ -4,8 +4,7 @@
 
 EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" };
 
-static Ecore_Event_Handler *activate_handler;
-static Ecore_Event_Handler *output_handler;
+static Eina_List *event_handlers = NULL;
 static Eina_Bool session_state = EINA_FALSE;
 
 static Eina_Bool
@@ -73,6 +72,39 @@ end:
    return ECORE_CALLBACK_PASS_ON;
 }
 
+static Eina_Bool
+_e_mod_drm_cb_input_device_add(void *data, int type, void *event)
+{
+   Ecore_Drm_Event_Input_Device_Add *e;
+
+   if (!(e = event)) goto end;
+
+   if (e->caps & EVDEV_SEAT_POINTER)
+     {
+        e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
+     }
+
+end:
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_mod_drm_cb_input_device_del(void *data, int type, void *event)
+{
+   Ecore_Drm_Event_Input_Device_Del *e;
+
+   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);
+     }
+
+end:
+   return ECORE_CALLBACK_PASS_ON;
+}
+
 EAPI void *
 e_modapi_init(E_Module *m)
 {
@@ -202,13 +234,14 @@ e_modapi_init(E_Module *m)
     * happens to jive with what drm does */
    e_comp_wl_input_keymap_set(comp->wl_comp_data, NULL, NULL, NULL);
 
-   activate_handler =
-      ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE,
-                              _e_mod_drm_cb_activate, comp);
-
-   output_handler =
-      ecore_event_handler_add(ECORE_DRM_EVENT_OUTPUT,
-                              _e_mod_drm_cb_output, comp);
+   E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_ACTIVATE,
+                         _e_mod_drm_cb_activate, comp);
+   E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_OUTPUT,
+                         _e_mod_drm_cb_output, comp);
+   E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_ADD,
+                         _e_mod_drm_cb_input_device_add, comp);
+   E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_DEL,
+                         _e_mod_drm_cb_input_device_del, comp);
 
    return m;
 }
@@ -219,8 +252,7 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
    /* shutdown ecore_drm */
    /* ecore_drm_shutdown(); */
 
-   if (activate_handler) ecore_event_handler_del(activate_handler);
-   activate_handler = NULL;
+   E_FREE_LIST(event_handlers, ecore_event_handler_del);
 
    return 1;
 }