From acb1d6721e79ffd6c2a6cd7ccb3973ce5756769b Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Tue, 19 Apr 2016 13:50:35 +0200 Subject: [PATCH] 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 --- fullscreen-shell/fullscreen-shell.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c index 04587672..927454b1 100644 --- a/fullscreen-shell/fullscreen-shell.c +++ b/fullscreen-shell/fullscreen-shell.c @@ -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);