kiosk-shell: Add a border fill to non-fullscreen views

According to xdg-shell spec, if the surface doesn't cover the whole
output we should center it and install a border fill covering the rest
of the output.

While we center out the surface we never got around installing the
border fill. This patch re-uses the activation of a surface to control
this bit as well, by making use of an new layer to place the
surface while not being active.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 3 years ago
parent 57d609a47e
commit f676a8f54e
  1. 27
      kiosk-shell/kiosk-shell.c
  2. 1
      kiosk-shell/kiosk-shell.h

@ -384,12 +384,31 @@ kiosk_shell_surface_activate(struct kiosk_shell_surface *shsurf,
dsurface_focus = current_focus->desktop_surface; dsurface_focus = current_focus->desktop_surface;
if (--current_focus->focus_count == 0) if (--current_focus->focus_count == 0)
weston_desktop_surface_set_activated(dsurface_focus, false); weston_desktop_surface_set_activated(dsurface_focus, false);
/* removes it from the normal_layer and move it to inactive
* one, without occluding the top-level window if the new one
* is a child to that */
if (!shsurf->parent) {
weston_layer_entry_remove(&current_focus->view->layer_link);
weston_layer_entry_insert(&shsurf->shell->inactive_layer.view_list,
&current_focus->view->layer_link);
weston_view_geometry_dirty(current_focus->view);
weston_surface_damage(current_focus->view->surface);
}
} }
/* xdg-shell activation for the new one */ /* xdg-shell activation for the new one */
kiosk_seat->focused_surface = surface; kiosk_seat->focused_surface = surface;
if (shsurf->focus_count++ == 0) if (shsurf->focus_count++ == 0)
weston_desktop_surface_set_activated(dsurface, true); weston_desktop_surface_set_activated(dsurface, true);
/* removes it from the inactive_layer, on removal of a surface, and
* move it back to the normal layer */
weston_layer_entry_remove(&shsurf->view->layer_link);
weston_layer_entry_insert(&shsurf->shell->normal_layer.view_list,
&shsurf->view->layer_link);
weston_view_geometry_dirty(shsurf->view);
weston_surface_damage(shsurf->view->surface);
} }
/* /*
@ -676,7 +695,7 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
kiosk_seat = get_kiosk_shell_seat(seat); kiosk_seat = get_kiosk_shell_seat(seat);
if (seat && kiosk_seat) { if (seat && kiosk_seat) {
focus_view = find_focus_successor(&shell->normal_layer, shsurf, focus_view = find_focus_successor(&shell->inactive_layer, shsurf,
kiosk_seat->focused_surface); kiosk_seat->focused_surface);
if (focus_view) { if (focus_view) {
@ -740,8 +759,6 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
get_kiosk_shell_first_seat(shsurf->shell); get_kiosk_shell_first_seat(shsurf->shell);
struct kiosk_shell_seat *kiosk_seat; struct kiosk_shell_seat *kiosk_seat;
weston_layer_entry_insert(&shsurf->shell->normal_layer.view_list,
&shsurf->view->layer_link);
shsurf->view->is_mapped = true; shsurf->view->is_mapped = true;
surface->is_mapped = true; surface->is_mapped = true;
@ -1105,6 +1122,7 @@ kiosk_shell_destroy(struct wl_listener *listener, void *data)
weston_layer_fini(&shell->background_layer); weston_layer_fini(&shell->background_layer);
weston_layer_fini(&shell->normal_layer); weston_layer_fini(&shell->normal_layer);
weston_layer_fini(&shell->inactive_layer);
free(shell); free(shell);
} }
@ -1139,9 +1157,12 @@ wet_shell_init(struct weston_compositor *ec,
weston_layer_init(&shell->background_layer, ec); weston_layer_init(&shell->background_layer, ec);
weston_layer_init(&shell->normal_layer, ec); weston_layer_init(&shell->normal_layer, ec);
weston_layer_init(&shell->inactive_layer, ec);
weston_layer_set_position(&shell->background_layer, weston_layer_set_position(&shell->background_layer,
WESTON_LAYER_POSITION_BACKGROUND); WESTON_LAYER_POSITION_BACKGROUND);
weston_layer_set_position(&shell->inactive_layer,
WESTON_LAYER_POSITION_HIDDEN);
/* We use the NORMAL layer position, so that xwayland surfaces, which /* We use the NORMAL layer position, so that xwayland surfaces, which
* are placed at NORMAL+1, are visible. */ * are placed at NORMAL+1, are visible. */
weston_layer_set_position(&shell->normal_layer, weston_layer_set_position(&shell->normal_layer,

@ -41,6 +41,7 @@ struct kiosk_shell {
struct weston_layer background_layer; struct weston_layer background_layer;
struct weston_layer normal_layer; struct weston_layer normal_layer;
struct weston_layer inactive_layer;
struct wl_list output_list; struct wl_list output_list;
struct wl_list seat_list; struct wl_list seat_list;

Loading…
Cancel
Save