diff options
author | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2015-06-16 13:56:57 +0300 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2015-06-22 15:19:39 +0300 |
commit | b37ac4006a555d78293eba2146210a461e395ba4 (patch) | |
tree | d3acee670e8db39a7ab64124c21354a9dadc69bf /desktop-shell | |
parent | 0a9d348fd8e9672185dfebefd52e3dfeaa8c68cd (diff) |
desktop-shell: remove screensaver support
This is a follow-up for the patch that removed weston-screensaver. The
aim is to clean up shell.c a little by removing non-essential
components. Vanilla Weston desktop is only a demo, external projects are
encouraged to create user-friendly desktop environments.
The support for launching a screensaver client and the protocol bindings
are removed. With them, all related configuration options are removed,
and the manuals are updated accordingly.
The screensaver protocol definition is left in desktop-shell.xml for
posterity.
This does not affect Weston's or desktop-shells ability to put screens
to sleep after inactivity. The inactivity timer continues to operate as
before. Also screen locking is unaffected.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r-- | desktop-shell/shell.c | 172 | ||||
-rw-r--r-- | desktop-shell/shell.h | 8 |
2 files changed, 0 insertions, 180 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index a60a3aa4..0fe46582 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -607,18 +607,10 @@ static void shell_configuration(struct desktop_shell *shell) { struct weston_config_section *section; - int duration; char *s, *client; int ret; section = weston_config_get_section(shell->compositor->config, - "screensaver", NULL, NULL); - weston_config_section_get_string(section, - "path", &shell->screensaver.path, NULL); - weston_config_section_get_int(section, "duration", &duration, 60); - shell->screensaver.duration = duration * 1000; - - section = weston_config_get_section(shell->compositor->config, "shell", NULL, NULL); ret = asprintf(&client, "%s/%s", weston_config_get_libexec_dir(), WESTON_SHELL_CLIENT); @@ -4296,65 +4288,6 @@ xdg_shell_unversioned_dispatch(const void *implementation, static void shell_fade(struct desktop_shell *shell, enum fade_type type); -static int -screensaver_timeout(void *data) -{ - struct desktop_shell *shell = data; - - shell_fade(shell, FADE_OUT); - - return 1; -} - -static void -handle_screensaver_sigchld(struct weston_process *proc, int status) -{ - struct desktop_shell *shell = - container_of(proc, struct desktop_shell, screensaver.process); - - proc->pid = 0; - - if (shell->locked) - weston_compositor_sleep(shell->compositor); -} - -static void -launch_screensaver(struct desktop_shell *shell) -{ - if (shell->screensaver.binding) - return; - - if (!shell->screensaver.path) { - weston_compositor_sleep(shell->compositor); - return; - } - - if (shell->screensaver.process.pid != 0) { - weston_log("old screensaver still running\n"); - return; - } - - weston_client_launch(shell->compositor, - &shell->screensaver.process, - shell->screensaver.path, - handle_screensaver_sigchld); -} - -static void -terminate_screensaver(struct desktop_shell *shell) -{ - if (shell->screensaver.process.pid == 0) - return; - - /* Disarm the screensaver timer, otherwise it may fire when the - * compositor is not in the idle state. In that case, the screen will - * be locked, but the wake_signal won't fire on user input, making the - * system unresponsive. */ - wl_event_source_timer_update(shell->screensaver.timer, 0); - - kill(shell->screensaver.process.pid, SIGTERM); -} - static void configure_static_view(struct weston_view *ev, struct weston_layer *layer) { @@ -4546,8 +4479,6 @@ resume_desktop(struct desktop_shell *shell) { struct workspace *ws = get_current_workspace(shell); - terminate_screensaver(shell); - wl_list_remove(&shell->lock_layer.link); if (shell->showing_input_panels) { wl_list_insert(&shell->compositor->cursor_layer.link, @@ -5224,8 +5155,6 @@ lock(struct desktop_shell *shell) wl_list_insert(&shell->compositor->cursor_layer.link, &shell->lock_layer.link); - launch_screensaver(shell); - /* Remove the keyboard focus on all seats. This will be * restored to the workspace's saved state via * restore_focus_state when the compositor is unlocked */ @@ -5919,97 +5848,6 @@ bind_desktop_shell(struct wl_client *client, "permission to bind desktop_shell denied"); } -static int -screensaver_get_label(struct weston_surface *surface, char *buf, size_t len) -{ - return snprintf(buf, len, "screensaver for output %s", - surface->output->name); -} - -static void -screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy) -{ - struct desktop_shell *shell = surface->configure_private; - struct weston_view *view; - struct weston_layer_entry *prev; - - if (surface->width == 0) - return; - - /* XXX: starting weston-screensaver beforehand does not work */ - if (!shell->locked) - return; - - view = container_of(surface->views.next, struct weston_view, surface_link); - center_on_output(view, surface->output); - - if (wl_list_empty(&view->layer_link.link)) { - prev = container_of(shell->lock_layer.view_list.link.prev, - struct weston_layer_entry, link); - weston_layer_entry_insert(prev, &view->layer_link); - weston_view_update_transform(view); - wl_event_source_timer_update(shell->screensaver.timer, - shell->screensaver.duration); - shell_fade(shell, FADE_IN); - } -} - -static void -screensaver_set_surface(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *surface_resource, - struct wl_resource *output_resource) -{ - struct desktop_shell *shell = wl_resource_get_user_data(resource); - struct weston_surface *surface = - wl_resource_get_user_data(surface_resource); - struct weston_output *output = wl_resource_get_user_data(output_resource); - struct weston_view *view, *next; - - /* Make sure we only have one view */ - wl_list_for_each_safe(view, next, &surface->views, surface_link) - weston_view_destroy(view); - weston_view_create(surface); - - surface->configure = screensaver_configure; - surface->configure_private = shell; - weston_surface_set_label_func(surface, screensaver_get_label); - surface->output = output; -} - -static const struct screensaver_interface screensaver_implementation = { - screensaver_set_surface -}; - -static void -unbind_screensaver(struct wl_resource *resource) -{ - struct desktop_shell *shell = wl_resource_get_user_data(resource); - - shell->screensaver.binding = NULL; -} - -static void -bind_screensaver(struct wl_client *client, - void *data, uint32_t version, uint32_t id) -{ - struct desktop_shell *shell = data; - struct wl_resource *resource; - - resource = wl_resource_create(client, &screensaver_interface, 1, id); - - if (shell->screensaver.binding == NULL) { - wl_resource_set_implementation(resource, - &screensaver_implementation, - shell, unbind_screensaver); - shell->screensaver.binding = resource; - return; - } - - wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, - "interface object already bound"); -} - struct switcher { struct desktop_shell *shell; struct weston_surface *current; @@ -6506,8 +6344,6 @@ shell_destroy(struct wl_listener *listener, void *data) wl_client_destroy(shell->child.client); } - wl_event_source_remove(shell->screensaver.timer); - wl_list_remove(&shell->idle_listener.link); wl_list_remove(&shell->wake_listener.link); @@ -6526,7 +6362,6 @@ shell_destroy(struct wl_listener *listener, void *data) workspace_destroy(*ws); wl_array_release(&shell->workspaces.array); - free(shell->screensaver.path); free(shell->client); free(shell); } @@ -6716,10 +6551,6 @@ module_init(struct weston_compositor *ec, shell, bind_desktop_shell) == NULL) return -1; - if (wl_global_create(ec->wl_display, &screensaver_interface, 1, - shell, bind_screensaver) == NULL) - return -1; - if (wl_global_create(ec->wl_display, &workspace_manager_interface, 1, shell, bind_workspace_manager) == NULL) return -1; @@ -6733,9 +6564,6 @@ module_init(struct weston_compositor *ec, loop = wl_display_get_event_loop(ec->wl_display); wl_event_loop_add_idle(loop, launch_desktop_shell_process, shell); - shell->screensaver.timer = - wl_event_loop_add_timer(loop, screensaver_timeout, shell); - wl_list_for_each(seat, &ec->seat_list, link) handle_seat_created(NULL, seat); shell->seat_create_listener.notify = handle_seat_created; diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h index b7472ead..f76f1810 100644 --- a/desktop-shell/shell.h +++ b/desktop-shell/shell.h @@ -173,14 +173,6 @@ struct desktop_shell { } workspaces; struct { - char *path; - int duration; - struct wl_resource *binding; - struct weston_process process; - struct wl_event_source *timer; - } screensaver; - - struct { struct wl_resource *binding; struct wl_list surfaces; } input_panel; |