e_comp_wl: Don't send wl_pointer.leave if the client didn't get wl_pointer.enter 25/73925/4
authorDuna Oh <duna.oh@samsung.com>
Fri, 10 Jun 2016 05:30:50 +0000 (14:30 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 14 Jun 2016 04:59:24 +0000 (21:59 -0700)
Test Plan:
1. When the client gets mouse_in and there is no pointer device, so didn't send wl_pointer.enter to the client.
2. If pointer devices are plugged and the client gets mouse_out, then send wl_pointer.leave to the client -> this causes assertion fail on some client.

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

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_comp_wl.c
src/bin/e_comp_wl_input.c

index 341dda6..45ff687 100644 (file)
@@ -3357,6 +3357,8 @@ e_client_new(E_Pixmap *cp, int first_map, int internal)
    ec->transform.zoom = 1.0;
    ec->transform.angle = 0.0;
 
+   ec->pointer_enter_sent = EINA_FALSE;
+
    EC_CHANGED(ec);
 
    e_comp->clients = eina_list_append(e_comp->clients, ec);
index 8d2a1a3..961db57 100644 (file)
@@ -849,6 +849,7 @@ struct E_Client
    } transform_core;
 
    Ecore_Timer *map_timer;
+   Eina_Bool pointer_enter_sent;
 };
 
 #define e_client_focus_policy_click(ec) \
index cd9f6bd..7d126ea 100644 (file)
@@ -773,6 +773,7 @@ _e_comp_wl_cursor_reload(E_Client *ec)
         if (wl_resource_get_client(res) != wc) continue;
         wl_pointer_send_enter(res, serial, ec->comp_data->surface,
                               wl_fixed_from_int(cx), wl_fixed_from_int(cy));
+        ec->pointer_enter_sent = EINA_TRUE;
      }
 }
 
@@ -803,7 +804,9 @@ _e_comp_wl_cursor_timer(void *data)
      {
         if (!e_comp_wl_input_pointer_check(res)) continue;
         if (wl_resource_get_client(res) != wc) continue;
+        if (ec->pointer_enter_sent == EINA_FALSE) continue;
         wl_pointer_send_leave(res, serial, ec->comp_data->surface);
+        ec->pointer_enter_sent = EINA_FALSE;
      }
 
    return ECORE_CALLBACK_CANCEL;
@@ -857,6 +860,7 @@ _e_comp_wl_evas_cb_mouse_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
         wl_pointer_send_enter(res, serial, ec->comp_data->surface,
                               wl_fixed_from_int(ev->canvas.x - ec->client.x),
                               wl_fixed_from_int(ev->canvas.y - ec->client.y));
+        ec->pointer_enter_sent = EINA_TRUE;
      }
 }
 
@@ -921,7 +925,9 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
      {
         if (!e_comp_wl_input_pointer_check(res)) continue;
         if (wl_resource_get_client(res) != wc) continue;
+        if (ec->pointer_enter_sent == EINA_FALSE) continue;
         wl_pointer_send_leave(res, serial, ec->comp_data->surface);
+        ec->pointer_enter_sent = EINA_FALSE;
      }
 }
 
index d114a28..1fbd289 100644 (file)
@@ -142,9 +142,6 @@ 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,
@@ -162,21 +159,6 @@ _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