Allow clicking on top panel to return to home screen
[profile/ivi/weston.git] / src / shell.c
index 2183ab4..9d0ae5e 100644 (file)
@@ -42,6 +42,9 @@
 
 #define DEFAULT_NUM_WORKSPACES 1
 #define DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH 200
+#ifdef ENABLE_TIZEN
+#define DEFAULT_HOMESCREEN_NAME "org.tizen.menu-screen"
+#endif
 
 enum animation_type {
        ANIMATION_NONE,
@@ -2361,12 +2364,58 @@ desktop_shell_set_grab_surface(struct wl_client *client,
        shell->grab_surface = surface_resource->data;
 }
 
+#ifdef ENABLE_TIZEN
+static void
+go_home(struct desktop_shell *shell, struct weston_seat *seat)
+{
+       struct weston_surface *surface;
+       struct shell_surface *shsurf;
+       struct weston_seat *s;
+       struct weston_compositor *ec = shell->compositor;
+
+       struct workspace *ws = get_current_workspace(shell);
+
+       /*
+        * Hack to show the home menu screen, since the shell doesn't really
+        * know which is the home surface, we check the title of surface to
+        * see if it is set to org.tizen.menu-screen and raise to the top
+        * of the stack
+        */
+       wl_list_for_each(surface, &ws->layer.surface_list, layer_link) {
+               shsurf = get_shell_surface(surface);
+               if (shsurf->title && !strcmp(DEFAULT_HOMESCREEN_NAME, shsurf->title)) {
+                       if (seat)
+                               activate(shell, surface, seat);
+                       else {
+                               wl_list_for_each(s, &ec->seat_list, link) {
+                                       activate(shell, surface, s);
+                               }
+                       }
+               }
+       }
+}
+
+/* Extended to show home screen */
+static void
+desktop_shell_show_homescreen(struct wl_client *client,
+                             struct wl_resource *resource)
+{
+       struct desktop_shell *shell = resource->data;
+       go_home(shell, NULL);
+}
+#endif
+
 static const struct desktop_shell_interface desktop_shell_implementation = {
        desktop_shell_set_background,
        desktop_shell_set_panel,
        desktop_shell_set_lock_surface,
        desktop_shell_unlock,
+#ifdef ENABLE_TIZEN
+       desktop_shell_set_grab_surface,
+       desktop_shell_show_homescreen,          // extended to show home screen
+#else
        desktop_shell_set_grab_surface
+#endif
 };
 
 static enum shell_surface_type