From: Jimmy Huang Date: Thu, 28 Feb 2013 00:06:39 +0000 (-0800) Subject: Allow clicking on top panel to return to home screen X-Git-Tag: accepted/2.0alpha-wayland/20130424.214608~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56b5ece2cf6c15d6bb4d408e3167af6c3e418e40;p=profile%2Fivi%2Fweston.git Allow clicking on top panel to return to home screen This is a work-around solution to allow us to return to the home screen in wayland since there's no home button. 1. Defined new 'show_homescreen' request in desktop shell protocol. 2. Added handling in weston-shell to handle when show_homesreen is called, it raises the surface belongs to the home screen (which is the org.tizen.menu-screen). 3. Registered click event when you click on the top launcher panel in the desktop shell, it will return to the home screen, since the top launcher panel is always present in the desktop shell client. Signed-off-by: Jimmy Huang --- diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 1cae789..51808a9 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -44,6 +44,8 @@ #include "desktop-shell-client-protocol.h" +#define ENABLE_TIZEN + extern char **environ; /* defined by libc */ struct desktop { @@ -72,6 +74,9 @@ struct panel { struct widget *widget; struct wl_list launcher_list; struct panel_clock *clock; +#ifdef ENABLE_TIZEN + struct desktop *desktop; +#endif }; struct background { @@ -418,6 +423,16 @@ panel_button_handler(struct widget *widget, if (button == BTN_RIGHT && state == WL_POINTER_BUTTON_STATE_PRESSED) show_menu(panel, input, time); +#ifdef ENABLE_TIZEN + if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED) { + /* + * Work-around to return to home menu screen + * if the user click on the top taskbar panel + * since the taskbar don't have a home button icon + */ + desktop_shell_show_homescreen(panel->desktop->shell); + } +#endif } static void @@ -512,6 +527,10 @@ panel_create(struct display *display) panel_add_clock(panel); +#ifdef ENABLE_TIZEN + panel->desktop = display_get_user_data(display); +#endif + return panel; } diff --git a/protocol/desktop-shell.xml b/protocol/desktop-shell.xml index 2b6afbd..6ecd405 100644 --- a/protocol/desktop-shell.xml +++ b/protocol/desktop-shell.xml @@ -33,6 +33,12 @@ + + + Show the home screen + + + diff --git a/src/shell.c b/src/shell.c index 2183ab4..9d0ae5e 100644 --- a/src/shell.c +++ b/src/shell.c @@ -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