shell: Animate input panel mapping

We slide it in from below.
This commit is contained in:
Kristian Høgsberg 2012-06-21 22:34:39 -04:00
parent 414bd420fd
commit 1ce6a2a2b3
3 changed files with 38 additions and 3 deletions

View File

@ -725,7 +725,9 @@ weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
struct weston_surface_animation * struct weston_surface_animation *
weston_fade_run(struct weston_surface *surface, weston_fade_run(struct weston_surface *surface,
weston_surface_animation_done_func_t done, void *data); weston_surface_animation_done_func_t done, void *data);
struct weston_surface_animation *
weston_slide_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
weston_surface_animation_done_func_t done, void *data);
void void
weston_surface_set_color(struct weston_surface *surface, weston_surface_set_color(struct weston_surface *surface,

View File

@ -1919,12 +1919,17 @@ hide_screensaver(struct desktop_shell *shell, struct shell_surface *surface)
static void static void
show_input_panel(struct desktop_shell *shell, struct shell_surface *surface) show_input_panel(struct desktop_shell *shell, struct shell_surface *surface)
{ {
if (weston_surface_is_mapped(surface->surface))
return;
wl_list_remove(&surface->surface->layer_link); wl_list_remove(&surface->surface->layer_link);
wl_list_insert(&shell->panel_layer.surface_list, &surface->surface->layer_link); wl_list_insert(&shell->panel_layer.surface_list, &surface->surface->layer_link);
surface->surface->output = surface->output; surface->surface->output = surface->output;
weston_surface_damage(surface->surface); weston_surface_damage(surface->surface);
weston_zoom_run(surface->surface, 0.8, 1.0, NULL, NULL); weston_slide_run(surface->surface,
surface->surface->geometry.height, 0,
NULL, NULL);
} }
static void static void
@ -2660,7 +2665,9 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
break; break;
case SHELL_SURFACE_INPUT_PANEL: case SHELL_SURFACE_INPUT_PANEL:
bottom_center_on_output(surface, get_default_output(compositor)); bottom_center_on_output(surface, get_default_output(compositor));
break; /* Don't map the input panel here, wait for
* show_input_panels signal. */
return;
case SHELL_SURFACE_POPUP: case SHELL_SURFACE_POPUP:
shell_map_popup(shsurf); shell_map_popup(shsurf);
case SHELL_SURFACE_NONE: case SHELL_SURFACE_NONE:

View File

@ -234,6 +234,32 @@ weston_fade_run(struct weston_surface *surface,
fade_frame, done, data); fade_frame, done, data);
} }
static void
slide_frame(struct weston_surface_animation *animation)
{
GLfloat scale;
scale = animation->start +
(animation->stop - animation->start) *
animation->spring.current;
weston_matrix_init(&animation->transform.matrix);
weston_matrix_translate(&animation->transform.matrix, 0, scale, 0);
}
WL_EXPORT struct weston_surface_animation *
weston_slide_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
weston_surface_animation_done_func_t done, void *data)
{
struct weston_surface_animation *animation;
animation = weston_surface_animation_run(surface, start, stop,
slide_frame, done, data);
animation->spring.friction = 900;
animation->spring.k = 300;
return animation;
}
struct weston_binding { struct weston_binding {
uint32_t key; uint32_t key;
uint32_t button; uint32_t button;