Improve cursor settings 37/40237/2
authorMinJeong Kim <minjjj.kim@samsung.com>
Mon, 1 Jun 2015 09:28:55 +0000 (18:28 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Mon, 1 Jun 2015 10:47:41 +0000 (03:47 -0700)
 - Set shell functions for cursor client for blocking intercepting of shell.
 - Recover checking code for cursor size
 - Don't enable wl_pointer and don't show pointer as default.
   It will be enabled by ECORE_DRM_EVENT_INPUT_DEVICE_ADD event indicating
   capability for pointer.

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

index 96dc6e8..0f9a364 100644 (file)
@@ -22,6 +22,28 @@ _e_comp_wl_input_update_seat_caps(E_Comp_Data *cdata)
 }
 
 static void
+_e_comp_wl_input_pointer_map(struct wl_resource *resource)
+{
+   E_Pixmap *ep;
+   E_Client *ec;
+
+   if (!(ep = wl_resource_get_user_data(resource))) return;
+   if (!(ec = e_pixmap_client_get(ep))) return;
+   if (e_object_is_del(E_OBJECT(ec))) return;
+
+   e_pointer_object_set(e_comp->pointer, ec->frame, ec->x, ec->y);
+   ec->comp_data->mapped = EINA_TRUE;
+}
+
+static void
+_e_comp_wl_input_pointer_confiugre(struct wl_resource *resource,
+                                   Evas_Coord x, Evas_Coord y,
+                                   Evas_Coord w, Evas_Coord h)
+{
+   /* do nothing */
+}
+
+static void
 _e_comp_wl_input_cb_resource_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
 {
    wl_resource_destroy(resource);
@@ -35,6 +57,7 @@ _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;
@@ -70,10 +93,19 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
         ec->client.w = ec->client.h = 1;
         l = e_client_focus_stack_get();
         e_client_focus_stack_set(eina_list_remove(l, ec));
+
+        /* Set fuctions to prevent unwanted handling by shell */
+        ec->comp_data->shell.surface = surface_resource;
+        ec->comp_data->shell.configure = _e_comp_wl_input_pointer_confiugre;
+        ec->comp_data->shell.map = _e_comp_wl_input_pointer_map;
      }
    /* 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 6e0949c..376d470 100644 (file)
@@ -213,7 +213,6 @@ e_modapi_init(E_Module *m)
    /* NB: This needs to be called AFTER the comp canvas has been setup */
    if (!e_comp_wl_init()) return NULL;
 
-   e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
    e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
    e_comp_wl_input_touch_enabled_set(EINA_TRUE);
 
@@ -221,6 +220,7 @@ e_modapi_init(E_Module *m)
    /*   e_pointer_window_new(ecore_evas_window_get(comp->ee), 1); */
    comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE);
    comp->pointer->color = EINA_TRUE;
+   e_pointer_hide(comp->pointer);
 
    /* FIXME: We need a way to trap for user changing the keymap inside of E
     *        without the event coming from X11 */