pepper: Don't send protocol events for views not having a valid surface
authorTaekyun Kim <tkq.kim@samsung.com>
Mon, 19 Oct 2015 05:22:26 +0000 (14:22 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Mon, 19 Oct 2015 05:22:26 +0000 (14:22 +0900)
Change-Id: I0248bdcfa138cec0f7753f8911197f2c82266d8e

src/lib/pepper/keyboard.c
src/lib/pepper/pointer.c
src/lib/pepper/touch.c

index 00b72f11e3d384a0d1f8695fee9ded774297d46d..dff13d3b55c9cc21560daefb45a55016a370db5a 100644 (file)
@@ -286,7 +286,7 @@ pepper_keyboard_bind_resource(struct wl_client *client, struct wl_resource *reso
         close(fd);
     }
 
-    if (!keyboard->focus)
+    if (!keyboard->focus || !keyboard->focus->surface || !keyboard->focus->surface->resource)
         return;
 
     if (wl_resource_get_client(keyboard->focus->surface->resource) == client)
@@ -355,7 +355,7 @@ pepper_keyboard_send_leave(pepper_keyboard_t *keyboard)
     struct wl_client   *client;
     uint32_t            serial;
 
-    if (!keyboard->focus)
+    if (!keyboard->focus || !keyboard->focus->surface || !keyboard->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(keyboard->focus->surface->resource);
@@ -375,7 +375,7 @@ pepper_keyboard_send_enter(pepper_keyboard_t *keyboard)
     struct wl_client   *client;
     uint32_t            serial;
 
-    if (!keyboard->focus)
+    if (!keyboard->focus || !keyboard->focus->surface || !keyboard->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(keyboard->focus->surface->resource);
@@ -398,7 +398,7 @@ pepper_keyboard_send_key(pepper_keyboard_t *keyboard, uint32_t time, uint32_t ke
     struct wl_client   *client;
     uint32_t            serial;
 
-    if (!keyboard->focus)
+    if (!keyboard->focus || !keyboard->focus->surface || !keyboard->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(keyboard->focus->surface->resource);
@@ -419,7 +419,7 @@ pepper_keyboard_send_modifiers(pepper_keyboard_t *keyboard, uint32_t depressed,
     struct wl_client   *client;
     uint32_t            serial;
 
-    if (!keyboard->focus)
+    if (!keyboard->focus || !keyboard->focus->surface || !keyboard->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(keyboard->focus->surface->resource);
index ddef1ef88b8656772e218215cd99c9fe187701fe..7967005ba133b3d5efb5df38ecc03d82ee935b24 100644 (file)
@@ -187,7 +187,7 @@ pepper_pointer_bind_resource(struct wl_client *client, struct wl_resource *resou
     wl_list_insert(&pointer->resource_list, wl_resource_get_link(res));
     wl_resource_set_implementation(res, &pointer_impl, pointer, unbind_resource);
 
-    if (!pointer->focus)
+    if (!pointer->focus || !pointer->focus->surface || !pointer->focus->surface->resource)
         return;
 
     if (wl_resource_get_client(pointer->focus->surface->resource) == client)
@@ -329,7 +329,7 @@ pepper_pointer_send_leave(pepper_pointer_t *pointer)
     struct wl_client   *client;
     uint32_t            serial;
 
-    if (!pointer->focus)
+    if (!pointer->focus || !pointer->focus->surface || !pointer->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(pointer->focus->surface->resource);
@@ -351,7 +351,7 @@ pepper_pointer_send_enter(pepper_pointer_t *pointer, double x, double y)
     struct wl_client   *client;
     uint32_t            serial;
 
-    if (!pointer->focus)
+    if (!pointer->focus || !pointer->focus->surface || !pointer->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(pointer->focus->surface->resource);
@@ -372,7 +372,7 @@ pepper_pointer_send_motion(pepper_pointer_t *pointer, uint32_t time, double x, d
     wl_fixed_t          fy = wl_fixed_from_double(y);
     struct wl_client   *client;
 
-    if (!pointer->focus)
+    if (!pointer->focus || !pointer->focus->surface || !pointer->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(pointer->focus->surface->resource);
@@ -391,7 +391,7 @@ pepper_pointer_send_button(pepper_pointer_t *pointer, uint32_t time, uint32_t bu
     struct wl_client   *client;
     uint32_t            serial;
 
-    if (!pointer->focus)
+    if (!pointer->focus || !pointer->focus->surface || !pointer->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(pointer->focus->surface->resource);
@@ -411,7 +411,7 @@ pepper_pointer_send_axis(pepper_pointer_t *pointer, uint32_t time, uint32_t axis
     wl_fixed_t          v = wl_fixed_from_double(value);
     struct wl_client   *client;
 
-    if (!pointer->focus)
+    if (!pointer->focus || !pointer->focus->surface || !pointer->focus->surface->resource)
         return;
 
     client = wl_resource_get_client(pointer->focus->surface->resource);
index 9b4ddbec98e0b9a27005c99394b3ce0e26ff7c59..d5e957310106433923d78f6c21373f9537514aeb 100644 (file)
@@ -259,8 +259,8 @@ pepper_touch_send_down(pepper_touch_t *touch, uint32_t time, uint32_t id, double
     wl_fixed_t              fy = wl_fixed_from_double(y);
     pepper_touch_point_t   *point = get_touch_point(touch, id);
 
-    PEPPER_CHECK(!point || !point->focus || !point->focus->surface ||
-                 !point->focus->surface->resource, return, "No targets to send touch down.\n");
+    if (!point || !point->focus || !point->focus->surface || !point->focus->surface->resource)
+        return;
 
     wl_resource_for_each(resource, &touch->resource_list)
     {
@@ -278,8 +278,8 @@ pepper_touch_send_up(pepper_touch_t *touch, uint32_t time, uint32_t id)
     uint32_t                serial;
     pepper_touch_point_t   *point = get_touch_point(touch, id);
 
-    PEPPER_CHECK(!point || !point->focus || !point->focus->surface ||
-                 !point->focus->surface->resource, return, "No targets to send touch down.\n");
+    if (!point || !point->focus || !point->focus->surface || !point->focus->surface->resource)
+        return;
 
     serial = wl_display_next_serial(touch->seat->compositor->display);
 
@@ -301,8 +301,8 @@ pepper_touch_send_motion(pepper_touch_t *touch, uint32_t time, uint32_t id, doub
     wl_fixed_t              fy = wl_fixed_from_double(y);
     pepper_touch_point_t   *point = get_touch_point(touch, id);
 
-    PEPPER_CHECK(!point || !point->focus || !point->focus->surface ||
-                 !point->focus->surface->resource, return, "No targets to send touch down.\n");
+    if (!point || !point->focus || !point->focus->surface || !point->focus->surface->resource)
+        return;
 
     wl_resource_for_each(resource, &touch->resource_list)
     {