wl_drm: fix show_cursor issues in wearable, mobile, and TV 67/61567/3 accepted/tizen/common/20160310.081325 accepted/tizen/ivi/20160309.124521 accepted/tizen/mobile/20160309.124429 accepted/tizen/tv/20160309.124444 accepted/tizen/wearable/20160309.124500 submit/tizen/20160309.072858
authorDuna Oh <duna.oh@samsung.com>
Wed, 9 Mar 2016 02:19:06 +0000 (11:19 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Wed, 9 Mar 2016 04:10:09 +0000 (20:10 -0800)
wearable: e_config->show_cursor is false.
mobile: e_config->show_cursor is true. By default, we only have a touch device,
 then do not show cursor. If pointer device is enabled, cursor should be appeared.
TV: pointer device is enabled, send pointer_enter event to the focused client
 to update client's cursor.

Signed-off-by: Duna Oh <duna.oh@samsung.com>
Change-Id: I0f1c753cd8b7ff9dc85e32b469d58c57eddd46dd

src/bin/e_comp_wl_input.c
src/bin/e_pointer.c
src/modules/wl_drm/e_mod_main.c

index d5588d7f6c047377749a102f6bcd94bb1e4f1ba2..de81e85c50a366f8e946cc234588a819582a8307 100644 (file)
@@ -136,6 +136,9 @@ static void
 _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *resource, uint32_t id)
 {
    struct wl_resource *res;
+   E_Client *ec;
+   uint32_t serial;
+   int cx, cy;
 
    /* try to create pointer resource */
    res = wl_resource_create(client, &wl_pointer_interface,
@@ -153,6 +156,21 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re
    wl_resource_set_implementation(res, &_e_pointer_interface,
                                   e_comp->wl_comp_data,
                                  _e_comp_wl_input_cb_pointer_unbind);
+
+   /* use_cursor_timer is on. Do not send enter to the focused client. */
+   if (e_config->use_cursor_timer) return;
+
+   if (!(ec = e_client_focused_get())) return;
+   if (e_object_is_del(E_OBJECT(ec))) return;
+   if (!ec->comp_data->surface) return;
+   if (client != wl_resource_get_client(ec->comp_data->surface)) return;
+
+   cx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x) - ec->client.x;
+   cy = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y) - ec->client.y;
+
+   serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
+   wl_pointer_send_enter(res, serial, ec->comp_data->surface,
+                         wl_fixed_from_int(cx), wl_fixed_from_int(cy));
 }
 
 static void
index 056b9ad5bd3ee30d76d571e411c2ecc9c1b0871d..7fbfe9f533cacdc62e5e5b53977e48b45c0a9869 100644 (file)
@@ -435,7 +435,7 @@ _e_pointer_type_set(E_Pointer *ptr, const char *type)
    eina_stringshare_replace(&ptr->type, type);
 
    /* don't show cursor if in hidden mode */
-   if (!e_config->show_cursor)
+   if ((!e_config->show_cursor) || (!e_comp_wl->ptr.enabled))
      {
         e_pointer_hide(ptr);
         return;
@@ -748,7 +748,7 @@ e_pointer_idler_before(void)
    Eina_List *l;
    E_Pointer *ptr;
 
-   if (!e_config->show_cursor) return;
+   if ((!e_config->show_cursor) || (!e_comp_wl->ptr.enabled)) return;
 
    EINA_LIST_FOREACH(_ptrs, l, ptr)
      {
@@ -788,7 +788,7 @@ e_pointer_object_set(E_Pointer *ptr, Evas_Object *obj, int x, int y)
    EINA_SAFETY_ON_NULL_RETURN(ptr);
 
    /* don't show cursor if in hidden mode */
-   if (!e_config->show_cursor)
+   if ((!e_config->show_cursor) || (!e_comp_wl->ptr.enabled))
      {
         if (obj) evas_object_hide(obj);
         return;
index f48cff6426c4a802288f7c5b0b91ea3da44b7d08..64e687433e680ad24fae5b95a4a02003c46c1d77 100644 (file)
@@ -111,8 +111,6 @@ _e_mod_drm_cb_input_device_add(void *data, int type, void *event)
              e_pointer_object_set(comp->pointer, NULL, 0, 0);
              e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
           }
-        if (!e_config->show_cursor)
-          e_config->show_cursor = EINA_TRUE;
         comp->wl_comp_data->ptr.num_devices++;
      }
    else if (e->caps & EVDEV_SEAT_KEYBOARD)
@@ -122,8 +120,6 @@ _e_mod_drm_cb_input_device_add(void *data, int type, void *event)
      }
    else if (e->caps & EVDEV_SEAT_TOUCH)
      {
-        if ((e_config->show_cursor) && (comp->wl_comp_data->ptr.num_devices == 0))
-          e_config->show_cursor = EINA_FALSE;
         e_comp_wl_input_touch_enabled_set(EINA_TRUE);
         comp->wl_comp_data->touch.num_devices++;
      }
@@ -148,8 +144,6 @@ _e_mod_drm_cb_input_device_del(void *data, int type, void *event)
              e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
              e_pointer_object_set(comp->pointer, NULL, 0, 0);
              e_pointer_hide(e_comp->pointer);
-             if (e_config->show_cursor)
-               e_config->show_cursor = EINA_FALSE;
           }
      }