mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-04 21:52:36 +00:00
desktop-shell: Clean up animate_focus_change()
Now that we're not allocating surfaces on demand, animate_focus_change() becomes a lot more straightforward and common, and using some local variables sure does cut out a lot of typing. Knowing that both from and to cannot both be NULL (because we check if from == to), we can change the juggling to be extremely simple: calculate where we need the curtains to be in the view list, put them there, and set up the fade. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
42334db41e
commit
f04e1ec9ab
|
@ -854,12 +854,11 @@ static void
|
||||||
animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
|
animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
|
||||||
struct weston_view *from, struct weston_view *to)
|
struct weston_view *from, struct weston_view *to)
|
||||||
{
|
{
|
||||||
/* FIXME: Only support dim animation using two layers */
|
struct weston_view *front = ws->fsurf_front->curtain->view;
|
||||||
if (from == to || shell->focus_animation_type != ANIMATION_DIM_LAYER)
|
struct weston_view *back = ws->fsurf_back->curtain->view;
|
||||||
return;
|
|
||||||
|
|
||||||
weston_view_move_to_layer(ws->fsurf_front->curtain->view, NULL);
|
if ((from && from == to) || shell->focus_animation_type == ANIMATION_NONE)
|
||||||
weston_view_move_to_layer(ws->fsurf_back->curtain->view, NULL);
|
return;
|
||||||
|
|
||||||
if (ws->focus_animation) {
|
if (ws->focus_animation) {
|
||||||
weston_view_animation_destroy(ws->focus_animation);
|
weston_view_animation_destroy(ws->focus_animation);
|
||||||
|
@ -867,31 +866,20 @@ animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to) {
|
if (to) {
|
||||||
weston_view_move_to_layer(ws->fsurf_front->curtain->view,
|
weston_view_move_to_layer(front, &to->layer_link);
|
||||||
&to->layer_link);
|
if (from)
|
||||||
} else {
|
weston_view_move_to_layer(back, &from->layer_link);
|
||||||
weston_view_move_to_layer(ws->fsurf_front->curtain->view,
|
else
|
||||||
&ws->layer.view_list);
|
weston_view_move_to_layer(back, &ws->layer.view_list);
|
||||||
}
|
|
||||||
|
|
||||||
if (from) {
|
ws->focus_animation =
|
||||||
weston_view_move_to_layer(ws->fsurf_back->curtain->view,
|
weston_stable_fade_run(front, 0.0, back, 0.4,
|
||||||
&from->layer_link);
|
|
||||||
ws->focus_animation = weston_stable_fade_run(
|
|
||||||
ws->fsurf_front->curtain->view, 0.0,
|
|
||||||
ws->fsurf_back->curtain->view, 0.4,
|
|
||||||
focus_animation_done, ws);
|
|
||||||
} else if (to) {
|
|
||||||
weston_view_move_to_layer(ws->fsurf_back->curtain->view,
|
|
||||||
&ws->layer.view_list);
|
|
||||||
ws->focus_animation = weston_stable_fade_run(
|
|
||||||
ws->fsurf_front->curtain->view, 0.0,
|
|
||||||
ws->fsurf_back->curtain->view, 0.4,
|
|
||||||
focus_animation_done, ws);
|
focus_animation_done, ws);
|
||||||
} else {
|
} else {
|
||||||
ws->focus_animation = weston_fade_run(
|
weston_view_move_to_layer(front, &ws->layer.view_list);
|
||||||
ws->fsurf_front->curtain->view,
|
weston_view_move_to_layer(back, NULL);
|
||||||
ws->fsurf_front->curtain->view->alpha, 0.0, 300,
|
ws->focus_animation =
|
||||||
|
weston_fade_run(front, front->alpha, 0.0, 300,
|
||||||
focus_animation_done, ws);
|
focus_animation_done, ws);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue