mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-07 05:05:00 +00:00
desktop-shell: Don't open-code animate_focus_change()
It already does what we want, so just use it when we're losing focus. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
f17581fdd2
commit
73050c358d
|
@ -678,6 +678,39 @@ focus_animation_done(struct weston_view_animation *animation, void *data)
|
||||||
ws->focus_animation = NULL;
|
ws->focus_animation = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
|
||||||
|
struct weston_view *from, struct weston_view *to)
|
||||||
|
{
|
||||||
|
struct weston_view *front = ws->fsurf_front->curtain->view;
|
||||||
|
struct weston_view *back = ws->fsurf_back->curtain->view;
|
||||||
|
if ((from && from == to) || shell->focus_animation_type == ANIMATION_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ws->focus_animation) {
|
||||||
|
weston_view_animation_destroy(ws->focus_animation);
|
||||||
|
ws->focus_animation = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to) {
|
||||||
|
weston_view_move_to_layer(front, &to->layer_link);
|
||||||
|
if (from)
|
||||||
|
weston_view_move_to_layer(back, &from->layer_link);
|
||||||
|
else
|
||||||
|
weston_view_move_to_layer(back, &ws->layer.view_list);
|
||||||
|
|
||||||
|
ws->focus_animation =
|
||||||
|
weston_stable_fade_run(front, 0.0, back, 0.4,
|
||||||
|
focus_animation_done, ws);
|
||||||
|
} else {
|
||||||
|
weston_view_move_to_layer(front, &ws->layer.view_list);
|
||||||
|
weston_view_move_to_layer(back, NULL);
|
||||||
|
ws->focus_animation =
|
||||||
|
weston_fade_run(front, front->alpha, 0.0, 300,
|
||||||
|
focus_animation_done, ws);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
focus_state_destroy(struct focus_state *state)
|
focus_state_destroy(struct focus_state *state)
|
||||||
{
|
{
|
||||||
|
@ -736,14 +769,9 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data)
|
||||||
activate(state->shell, next, state->seat,
|
activate(state->shell, next, state->seat,
|
||||||
WESTON_ACTIVATE_FLAG_CONFIGURE);
|
WESTON_ACTIVATE_FLAG_CONFIGURE);
|
||||||
} else {
|
} else {
|
||||||
if (state->shell->focus_animation_type == ANIMATION_DIM_LAYER) {
|
if (state->shell->focus_animation_type != ANIMATION_NONE) {
|
||||||
if (state->ws->focus_animation)
|
animate_focus_change(state->shell, state->ws,
|
||||||
weston_view_animation_destroy(state->ws->focus_animation);
|
get_default_view(main_surface), NULL);
|
||||||
|
|
||||||
state->ws->focus_animation = weston_fade_run(
|
|
||||||
state->ws->fsurf_front->curtain->view,
|
|
||||||
state->ws->fsurf_front->curtain->view->alpha, 0.0, 300,
|
|
||||||
focus_animation_done, state->ws);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_remove(&state->link);
|
wl_list_remove(&state->link);
|
||||||
|
@ -863,40 +891,6 @@ drop_focus_state(struct desktop_shell *shell, struct workspace *ws,
|
||||||
focus_state_set_focus(state, NULL);
|
focus_state_set_focus(state, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
|
|
||||||
struct weston_view *from, struct weston_view *to)
|
|
||||||
{
|
|
||||||
struct weston_view *front = ws->fsurf_front->curtain->view;
|
|
||||||
struct weston_view *back = ws->fsurf_back->curtain->view;
|
|
||||||
|
|
||||||
if ((from && from == to) || shell->focus_animation_type == ANIMATION_NONE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ws->focus_animation) {
|
|
||||||
weston_view_animation_destroy(ws->focus_animation);
|
|
||||||
ws->focus_animation = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (to) {
|
|
||||||
weston_view_move_to_layer(front, &to->layer_link);
|
|
||||||
if (from)
|
|
||||||
weston_view_move_to_layer(back, &from->layer_link);
|
|
||||||
else
|
|
||||||
weston_view_move_to_layer(back, &ws->layer.view_list);
|
|
||||||
|
|
||||||
ws->focus_animation =
|
|
||||||
weston_stable_fade_run(front, 0.0, back, 0.4,
|
|
||||||
focus_animation_done, ws);
|
|
||||||
} else {
|
|
||||||
weston_view_move_to_layer(front, &ws->layer.view_list);
|
|
||||||
weston_view_move_to_layer(back, NULL);
|
|
||||||
ws->focus_animation =
|
|
||||||
weston_fade_run(front, front->alpha, 0.0, 300,
|
|
||||||
focus_animation_done, ws);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
desktop_shell_destroy_layer(struct weston_layer *layer);
|
desktop_shell_destroy_layer(struct weston_layer *layer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue