summaryrefslogtreecommitdiff
path: root/desktop-shell/input-panel.c
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2014-04-14 15:48:07 +0300
committerKristian Høgsberg <krh@bitplanet.net>2014-04-16 22:33:48 -0700
commit75c373c76c630cca73d02f839dcc3961fc6c1a7f (patch)
tree75ffa366732ce8fe717220fcae744e234af5d6ee /desktop-shell/input-panel.c
parenta4a6f161290d88895cb7a7172fcee21b1546e0da (diff)
downloadweston-75c373c76c630cca73d02f839dcc3961fc6c1a7f.tar.gz
shell: Destroy a previous input panel animation when showing it again
It is possible that an input panel will be shown quickly, hidden and shown again, before the animation for the first appeareance finished. In that case, another animation would be created and the effect of the two combined could cause the panel to not appear in the screen. This patch fixes this by keeping a reference to the previous animation and deleting it when a new one is created.
Diffstat (limited to 'desktop-shell/input-panel.c')
-rw-r--r--desktop-shell/input-panel.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
index 12fe686f..601b289a 100644
--- a/desktop-shell/input-panel.c
+++ b/desktop-shell/input-panel.c
@@ -43,11 +43,41 @@ struct input_panel_surface {
struct weston_view *view;
struct wl_listener surface_destroy_listener;
+ struct weston_view_animation *anim;
+
struct weston_output *output;
uint32_t panel;
};
static void
+input_panel_slide_done(struct weston_view_animation *animation, void *data)
+{
+ struct input_panel_surface *ipsurf = data;
+
+ ipsurf->anim = NULL;
+}
+
+static void
+show_input_panel_surface(struct input_panel_surface *ipsurf)
+{
+ struct desktop_shell *shell = ipsurf->shell;
+
+ wl_list_insert(&shell->input_panel_layer.view_list,
+ &ipsurf->view->layer_link);
+ weston_view_geometry_dirty(ipsurf->view);
+ weston_view_update_transform(ipsurf->view);
+ weston_surface_damage(ipsurf->surface);
+
+ if (ipsurf->anim)
+ weston_view_animation_destroy(ipsurf->anim);
+
+ ipsurf->anim =
+ weston_slide_run(ipsurf->view,
+ ipsurf->surface->height * 0.9, 0,
+ input_panel_slide_done, ipsurf);
+}
+
+static void
show_input_panels(struct wl_listener *listener, void *data)
{
struct desktop_shell *shell =
@@ -70,13 +100,8 @@ show_input_panels(struct wl_listener *listener, void *data)
&shell->input_panel.surfaces, link) {
if (ipsurf->surface->width == 0)
continue;
- wl_list_insert(&shell->input_panel_layer.view_list,
- &ipsurf->view->layer_link);
- weston_view_geometry_dirty(ipsurf->view);
- weston_view_update_transform(ipsurf->view);
- weston_surface_damage(ipsurf->surface);
- weston_slide_run(ipsurf->view, ipsurf->surface->height * 0.9,
- 0, NULL, NULL);
+
+ show_input_panel_surface(ipsurf);
}
}
@@ -135,13 +160,8 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
weston_view_set_position(ip_surface->view, x, y);
- if (!weston_surface_is_mapped(surface) && shell->showing_input_panels) {
- wl_list_insert(&shell->input_panel_layer.view_list,
- &ip_surface->view->layer_link);
- weston_view_update_transform(ip_surface->view);
- weston_surface_damage(surface);
- weston_slide_run(ip_surface->view, ip_surface->view->surface->height * 0.9, 0, NULL, NULL);
- }
+ if (!weston_surface_is_mapped(surface) && shell->showing_input_panels)
+ show_input_panel_surface(ip_surface);
}
static void