desktop-shell: Map input panel exactly once
When the input panel surface gets something committed to it, we have content and thus the surface has become mapped. Do this from within the input-panel surface committed handler. When we want to show the input panel, this is when we map the view. Do this exactly once as well, and make sure that we don't attempt to map the view with an unmapped surface. This regularises the logic to be the same as almost all the other special surface users. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
93e4f4e01f
commit
bd8a6da2f0
|
@ -92,6 +92,9 @@ show_input_panel_surface(struct input_panel_surface *ipsurf)
|
|||
if (!weston_surface_is_mapped(ipsurf->surface))
|
||||
return;
|
||||
|
||||
if (weston_view_is_mapped(ipsurf->view))
|
||||
return;
|
||||
|
||||
wl_list_for_each(seat, &shell->compositor->seat_list, link) {
|
||||
struct weston_keyboard *keyboard =
|
||||
weston_seat_get_keyboard(seat);
|
||||
|
@ -106,10 +109,10 @@ show_input_panel_surface(struct input_panel_surface *ipsurf)
|
|||
continue;
|
||||
|
||||
weston_view_set_position(ipsurf->view, pos);
|
||||
}
|
||||
|
||||
weston_view_move_to_layer(ipsurf->view,
|
||||
&shell->input_panel_layer.view_list);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ipsurf->anim)
|
||||
weston_view_animation_destroy(ipsurf->anim);
|
||||
|
@ -189,24 +192,19 @@ input_panel_committed(struct weston_surface *surface,
|
|||
{
|
||||
struct input_panel_surface *ip_surface = surface->committed_private;
|
||||
struct desktop_shell *shell = ip_surface->shell;
|
||||
struct weston_coord_global pos;
|
||||
|
||||
if (!weston_surface_has_content(surface))
|
||||
return;
|
||||
|
||||
if (calc_input_panel_position(ip_surface, &pos))
|
||||
if (weston_surface_is_mapped(surface))
|
||||
return;
|
||||
|
||||
if (!weston_surface_is_mapped(surface)) {
|
||||
weston_surface_map(surface);
|
||||
|
||||
if (shell->showing_input_panels)
|
||||
show_input_panel_surface(ip_surface);
|
||||
}
|
||||
|
||||
weston_view_set_position(ip_surface->view, pos);
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_input_panel_surface(struct input_panel_surface *input_panel_surface)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue