shell: Send ping when pointer focus view is changed
authorJaehoon Jeong <jh01.j@samsung.com>
Wed, 7 Oct 2015 04:46:19 +0000 (13:46 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Wed, 7 Oct 2015 05:29:42 +0000 (14:29 +0900)
Change-Id: I6e49b9a8b2f9c668d4cb974d8c1b75672746a713

src/lib/desktop-shell/shell-surface.c

index c3f878bfd0b331599e9790ed8e1c5208f35d0f7e..c21f2562457e56cedfcf70a3ab621102d8fbabe6 100644 (file)
@@ -205,27 +205,44 @@ shell_surface_focus_leave(shell_surface_t *shsurf)
     shsurf->has_keyboard_focus = PEPPER_FALSE;
 }
 
+static void
+shell_surface_handle_pointer_focus(shell_surface_t *shsurf, uint32_t id)
+{
+    if (id == PEPPER_EVENT_FOCUS_ENTER)
+        shell_surface_ping(shsurf);
+}
+
+static void
+shell_surface_handle_keyboard_focus(shell_surface_t *shsurf, uint32_t id)
+{
+    if (id == PEPPER_EVENT_FOCUS_ENTER)
+        shell_surface_focus_enter(shsurf);
+    else
+        shell_surface_focus_leave(shsurf);
+
+    /* Send state changed configure */
+    shsurf->send_configure(shsurf, 0, 0);
+}
+
 static void
 handle_focus(pepper_event_listener_t *listener,
              pepper_object_t *view, uint32_t id, void *info, void *data)
 {
-    shell_surface_t     *shsurf = data;
-    pepper_object_t     *obj    = info;
-    pepper_object_type_t obj_type = pepper_object_get_type(obj);
+    pepper_object_type_t  type   = pepper_object_get_type((pepper_object_t *)info);
 
-    if (obj_type == PEPPER_OBJECT_KEYBOARD)
+    switch (type)
     {
-        if (id == PEPPER_EVENT_FOCUS_ENTER)
-        {
-            shell_surface_focus_enter(shsurf);
-        }
-        else
-        {
-            shell_surface_focus_leave(shsurf);
-        }
-
-        /* Send state changed configure */
-        shsurf->send_configure(shsurf, 0, 0);
+    case PEPPER_OBJECT_POINTER:
+        shell_surface_handle_pointer_focus(data, id);
+        break;
+    case PEPPER_OBJECT_KEYBOARD:
+        shell_surface_handle_keyboard_focus(data, id);
+        break;
+    case PEPPER_OBJECT_TOUCH:
+        /* TODO */
+        break;
+    default:
+        break;
     }
 }