fullscreen-shell: handle output resize and move signals

Outputs are rendered incorrectly after they are resized or moved, so monitor
those events to reconfigure the output and schedule a repaint in this case.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
This commit is contained in:
Arnaud Vrac 2016-04-19 13:50:35 +02:00 committed by Marius Vlad
parent ccb6413aa1
commit acb1d6721e

View File

@ -48,6 +48,8 @@ struct fullscreen_shell {
struct weston_layer layer;
struct wl_list output_list;
struct wl_listener output_created_listener;
struct wl_listener output_resized_listener;
struct wl_listener output_moved_listener;
struct wl_listener seat_created_listener;
@ -814,6 +816,16 @@ struct zwp_fullscreen_shell_v1_interface fullscreen_shell_implementation = {
fullscreen_shell_present_surface_for_mode,
};
static void
output_geometry_changed(struct wl_listener *listener, void *data)
{
struct fs_output *fsout;
fsout = fs_output_for_output(data);
if (fsout && fsout->surface)
fs_output_configure(fsout, fsout->surface);
}
static void
output_created(struct wl_listener *listener, void *data)
{
@ -877,6 +889,8 @@ fullscreen_shell_destroy(struct wl_listener *listener, void *data)
fs_output_destroy(fs_output);
wl_list_remove(&shell->output_created_listener.link);
wl_list_remove(&shell->output_moved_listener.link);
wl_list_remove(&shell->output_resized_listener.link);
if (!wl_list_empty(&shell->default_surface_list)) {
surf = container_of(shell->default_surface_list.prev,
@ -925,6 +939,14 @@ wet_shell_init(struct weston_compositor *compositor,
wl_list_for_each(output, &compositor->output_list, link)
fs_output_create(shell, output);
shell->output_resized_listener.notify = output_geometry_changed;
wl_signal_add(&compositor->output_resized_signal,
&shell->output_resized_listener);
shell->output_moved_listener.notify = output_geometry_changed;
wl_signal_add(&compositor->output_moved_signal,
&shell->output_moved_listener);
shell->seat_created_listener.notify = seat_created;
wl_signal_add(&compositor->seat_created_signal,
&shell->seat_created_listener);