#define DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH 200
#ifdef ENABLE_TIZEN
#define DEFAULT_HOMESCREEN_NAME "org.tizen.menu-screen"
+#define DEFAULT_TASKMANAGER_NAME "taskmgr"
+#define DEFAULT_TASKMANAGER_PATH "/opt/apps/org.tizen.taskmgr/bin/taskmgr"
#endif
enum animation_type {
struct weston_process process;
} screensaver;
+#ifdef ENABLE_TIZEN
+ struct {
+ char *path;
+ struct weston_process process;
+ } taskmanager;
+#endif
+
struct {
struct wl_resource *binding;
struct wl_list surfaces;
shell->screensaver.path = path;
shell->screensaver.duration = duration;
+#ifdef ENABLE_TIZEN
+ shell->taskmanager.path = DEFAULT_TASKMANAGER_PATH;
+#endif
shell->binding_modifier = get_modifier(modifier);
shell->win_animation_type = get_animation_type(win_animation);
shell->workspaces.num = num_workspaces > 0 ? num_workspaces : 1;
kill(shell->screensaver.process.pid, SIGTERM);
}
+#ifdef ENABLE_TIZEN
+static void
+handle_taskmanager_sigchld(struct weston_process *proc, int status)
+{
+ weston_log("taskmanager terminated\n");
+ proc->pid = 0;
+}
+
+static void
+terminate_taskmanager(struct desktop_shell *shell)
+{
+ if (shell->taskmanager.process.pid == 0)
+ return;
+
+ kill(shell->taskmanager.process.pid, SIGTERM);
+}
+
+static void
+launch_taskmanager(struct desktop_shell *shell)
+{
+ if (!shell->taskmanager.path)
+ return;
+
+ if (shell->taskmanager.process.pid != 0) {
+ weston_log("old taskmanager still running\n");
+ return;
+ }
+
+ weston_client_launch(shell->compositor,
+ &shell->taskmanager.process,
+ shell->taskmanager.path,
+ handle_taskmanager_sigchld);
+}
+#endif
+
static void
configure_static_surface(struct weston_surface *es, struct weston_layer *layer)
{
take_surface_to_workspace_by_seat(shell, seat, new_index);
}
+#ifdef ENABLE_TIZEN
+/*
+ * Toggle the task manager if key is pressed
+ * This is a work around to launch the taskmanager since
+ * there's isn't a home button in the menu screen
+ */
+static void
+taskmanager_key_binding(struct wl_seat *seat, uint32_t time,
+ uint32_t key, void *data)
+{
+ struct desktop_shell *shell = data;
+ struct weston_surface *surface = NULL;
+ struct weston_surface *taskmgr = NULL;
+ struct shell_surface *shsurf;
+ struct weston_seat *s;
+
+ struct workspace *ws = get_current_workspace(shell);
+ struct weston_compositor *ec = shell->compositor;
+
+ if (shell->taskmanager.process.pid != 0) {
+ wl_list_for_each(surface, &ws->layer.surface_list, layer_link) {
+ shsurf = get_shell_surface(surface);
+ if (shsurf->title && !strcmp(DEFAULT_TASKMANAGER_NAME, shsurf->title)) {
+ taskmgr = surface;
+ break;
+ }
+ }
+
+ /*
+ * if taskmanger is not in focus, just raise the surface
+ * otherwise kill it
+ */
+ if (taskmgr && taskmgr != (struct weston_surface *) seat->keyboard->focus) {
+ wl_list_for_each(s, &ec->seat_list, link) {
+ activate(shell, surface, s);
+ }
+ }
+ else {
+ terminate_taskmanager(shell);
+ }
+ }
+ else {
+ launch_taskmanager(shell);
+ }
+}
+#endif
+
static void
shell_destroy(struct wl_listener *listener, void *data)
{
workspace_move_surface_down_binding,
shell);
+#ifdef ENABLE_TIZEN
+ /* Register key bindings to toggle task manager */
+ weston_compositor_add_key_binding(ec, KEY_LEFTMETA, 0,
+ taskmanager_key_binding, shell);
+#endif
+
/* Add bindings for mod+F[1-6] for workspace 1 to 6. */
if (shell->workspaces.num > 1) {
num_workspace_bindings = shell->workspaces.num;