Revert "desktop-shell: Enable per-output fade animations"

This reverts commit fde5adbedb.

(Accidental landing)
dev
Bryce Harrington 8 years ago
parent 08976ac7bf
commit b3197f447e
  1. 138
      desktop-shell/shell.c
  2. 14
      desktop-shell/shell.h

@ -194,9 +194,6 @@ surface_rotate(struct shell_surface *surface, struct weston_pointer *pointer);
static void static void
shell_fade_startup(struct desktop_shell *shell); shell_fade_startup(struct desktop_shell *shell);
static void
shell_fade(struct desktop_shell *shell, enum fade_type type);
static struct shell_seat * static struct shell_seat *
get_shell_seat(struct weston_seat *seat); get_shell_seat(struct weston_seat *seat);
@ -2787,6 +2784,9 @@ static const struct weston_desktop_api shell_desktop_api = {
/* ************************ * /* ************************ *
* end of libweston-desktop * * end of libweston-desktop *
* ************************ */ * ************************ */
static void
shell_fade(struct desktop_shell *shell, enum fade_type type);
static void static void
configure_static_view(struct weston_view *ev, struct weston_layer *layer) configure_static_view(struct weston_view *ev, struct weston_layer *layer)
{ {
@ -3770,16 +3770,16 @@ unlock(struct desktop_shell *shell)
} }
static void static void
shell_fade_done_for_output(struct weston_view_animation *animation, void *data) shell_fade_done(struct weston_view_animation *animation, void *data)
{ {
struct shell_output *shell_output = data; struct desktop_shell *shell = data;
struct desktop_shell *shell = shell_output->shell;
shell_output->fade.animation = NULL; shell->fade.animation = NULL;
switch (shell_output->fade.type) {
switch (shell->fade.type) {
case FADE_IN: case FADE_IN:
weston_surface_destroy(shell_output->fade.view->surface); weston_surface_destroy(shell->fade.view->surface);
shell_output->fade.view = NULL; shell->fade.view = NULL;
break; break;
case FADE_OUT: case FADE_OUT:
lock(shell); lock(shell);
@ -3790,7 +3790,7 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data)
} }
static struct weston_view * static struct weston_view *
shell_fade_create_surface_for_output(struct desktop_shell *shell, struct shell_output *shell_output) shell_fade_create_surface(struct desktop_shell *shell)
{ {
struct weston_compositor *compositor = shell->compositor; struct weston_compositor *compositor = shell->compositor;
struct weston_surface *surface; struct weston_surface *surface;
@ -3806,8 +3806,8 @@ shell_fade_create_surface_for_output(struct desktop_shell *shell, struct shell_o
return NULL; return NULL;
} }
weston_surface_set_size(surface, shell_output->output->width, shell_output->output->height); weston_surface_set_size(surface, 8192, 8192);
weston_view_set_position(view, shell_output->output->x, shell_output->output->y); weston_view_set_position(view, 0, 0);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0); weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
weston_layer_entry_insert(&compositor->fade_layer.view_list, weston_layer_entry_insert(&compositor->fade_layer.view_list,
&view->layer_link); &view->layer_link);
@ -3822,7 +3822,6 @@ static void
shell_fade(struct desktop_shell *shell, enum fade_type type) shell_fade(struct desktop_shell *shell, enum fade_type type)
{ {
float tint; float tint;
struct shell_output *shell_output;
switch (type) { switch (type) {
case FADE_IN: case FADE_IN:
@ -3832,38 +3831,36 @@ shell_fade(struct desktop_shell *shell, enum fade_type type)
tint = 1.0; tint = 1.0;
break; break;
default: default:
weston_log("shell: invalid fade type\n");
return; return;
} }
/* Create a separate fade surface for each output */ shell->fade.type = type;
wl_list_for_each(shell_output, &shell->output_list, link) {
shell_output->fade.type = type;
if (shell_output->fade.view == NULL) { if (shell->fade.view == NULL) {
shell_output->fade.view = shell_fade_create_surface_for_output(shell, shell_output); shell->fade.view = shell_fade_create_surface(shell);
if (!shell_output->fade.view) if (!shell->fade.view)
return; return;
shell_output->fade.view->alpha = 1.0 - tint; shell->fade.view->alpha = 1.0 - tint;
weston_view_update_transform(shell_output->fade.view); weston_view_update_transform(shell->fade.view);
} }
if (shell_output->fade.view->output == NULL) { if (shell->fade.view->output == NULL) {
/* If the black view gets a NULL output, we lost the /* If the black view gets a NULL output, we lost the
* last output and we'll just cancel the fade. This * last output and we'll just cancel the fade. This
* happens when you close the last window under the * happens when you close the last window under the
* X11 or Wayland backends. */ * X11 or Wayland backends. */
shell->locked = false; shell->locked = false;
weston_surface_destroy(shell_output->fade.view->surface); weston_surface_destroy(shell->fade.view->surface);
shell_output->fade.view = NULL; shell->fade.view = NULL;
} else if (shell_output->fade.animation) { } else if (shell->fade.animation) {
weston_fade_update(shell_output->fade.animation, tint); weston_fade_update(shell->fade.animation, tint);
} else { } else {
shell_output->fade.animation = shell->fade.animation =
weston_fade_run(shell_output->fade.view, weston_fade_run(shell->fade.view,
1.0 - tint, tint, 300.0, 1.0 - tint, tint, 300.0,
shell_fade_done_for_output, shell_output); shell_fade_done, shell);
}
} }
} }
@ -3871,7 +3868,6 @@ static void
do_shell_fade_startup(void *data) do_shell_fade_startup(void *data)
{ {
struct desktop_shell *shell = data; struct desktop_shell *shell = data;
struct shell_output *shell_output;
if (shell->startup_animation_type == ANIMATION_FADE) { if (shell->startup_animation_type == ANIMATION_FADE) {
shell_fade(shell, FADE_IN); shell_fade(shell, FADE_IN);
@ -3879,10 +3875,8 @@ do_shell_fade_startup(void *data)
weston_log("desktop shell: " weston_log("desktop shell: "
"unexpected fade-in animation type %d\n", "unexpected fade-in animation type %d\n",
shell->startup_animation_type); shell->startup_animation_type);
wl_list_for_each(shell_output, &shell->output_list, link) { weston_surface_destroy(shell->fade.view->surface);
weston_surface_destroy(shell_output->fade.view->surface); shell->fade.view = NULL;
shell_output->fade.view = NULL;
}
} }
} }
@ -3890,22 +3884,15 @@ static void
shell_fade_startup(struct desktop_shell *shell) shell_fade_startup(struct desktop_shell *shell)
{ {
struct wl_event_loop *loop; struct wl_event_loop *loop;
struct shell_output *shell_output;
bool has_fade = false;
wl_list_for_each(shell_output, &shell->output_list, link) { if (!shell->fade.startup_timer)
if (!shell_output->fade.startup_timer) return;
continue;
wl_event_source_remove(shell_output->fade.startup_timer); wl_event_source_remove(shell->fade.startup_timer);
shell_output->fade.startup_timer = NULL; shell->fade.startup_timer = NULL;
has_fade = true;
}
if (has_fade) { loop = wl_display_get_event_loop(shell->compositor->wl_display);
loop = wl_display_get_event_loop(shell->compositor->wl_display); wl_event_loop_add_idle(loop, do_shell_fade_startup, shell);
wl_event_loop_add_idle(loop, do_shell_fade_startup, shell);
}
} }
static int static int
@ -3926,30 +3913,27 @@ shell_fade_init(struct desktop_shell *shell)
*/ */
struct wl_event_loop *loop; struct wl_event_loop *loop;
struct shell_output *shell_output;
if (shell->startup_animation_type == ANIMATION_NONE) if (shell->fade.view != NULL) {
weston_log("%s: warning: fade surface already exists\n",
__func__);
return; return;
}
wl_list_for_each(shell_output, &shell->output_list, link) { if (shell->startup_animation_type == ANIMATION_NONE)
if (shell_output->fade.view != NULL) { return;
weston_log("%s: warning: fade surface already exists\n",
__func__);
continue;
}
shell_output->fade.view = shell_fade_create_surface_for_output(shell, shell_output); shell->fade.view = shell_fade_create_surface(shell);
if (!shell_output->fade.view) if (!shell->fade.view)
return; return;
weston_view_update_transform(shell_output->fade.view); weston_view_update_transform(shell->fade.view);
weston_surface_damage(shell_output->fade.view->surface); weston_surface_damage(shell->fade.view->surface);
loop = wl_display_get_event_loop(shell->compositor->wl_display); loop = wl_display_get_event_loop(shell->compositor->wl_display);
shell_output->fade.startup_timer = shell->fade.startup_timer =
wl_event_loop_add_timer(loop, fade_startup_timeout, shell); wl_event_loop_add_timer(loop, fade_startup_timeout, shell);
wl_event_source_timer_update(shell_output->fade.startup_timer, 15000); wl_event_source_timer_update(shell->fade.startup_timer, 15000);
}
} }
static void static void
@ -3964,7 +3948,7 @@ idle_handler(struct wl_listener *listener, void *data)
weston_seat_break_desktop_grabs(seat); weston_seat_break_desktop_grabs(seat);
shell_fade(shell, FADE_OUT); shell_fade(shell, FADE_OUT);
/* lock() is called from shell_fade_done_for_output() */ /* lock() is called from shell_fade_done() */
} }
static void static void

@ -122,13 +122,6 @@ struct shell_output {
struct weston_surface *background_surface; struct weston_surface *background_surface;
struct wl_listener background_surface_listener; struct wl_listener background_surface_listener;
struct {
struct weston_view *view;
struct weston_view_animation *animation;
enum fade_type type;
struct wl_event_source *startup_timer;
} fade;
}; };
struct weston_desktop; struct weston_desktop;
@ -199,6 +192,13 @@ struct desktop_shell {
struct wl_list surfaces; struct wl_list surfaces;
} input_panel; } input_panel;
struct {
struct weston_view *view;
struct weston_view_animation *animation;
enum fade_type type;
struct wl_event_source *startup_timer;
} fade;
struct exposay exposay; struct exposay exposay;
bool allow_zap; bool allow_zap;

Loading…
Cancel
Save