From 9a386f5de5b647005e396dc37b2cae903898ffb8 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 21 Nov 2022 08:51:58 -0600 Subject: [PATCH] fullscreen-shell: Use center_on_output helper Simplify code a tiny bit by using the existing shell-helper function. Signed-off-by: Derek Foreman --- fullscreen-shell/fullscreen-shell.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c index c7b2d7490..261ba5a5e 100644 --- a/fullscreen-shell/fullscreen-shell.c +++ b/fullscreen-shell/fullscreen-shell.c @@ -362,22 +362,6 @@ restore_output_mode(struct weston_output *output) weston_output_mode_switch_to_native(output); } -static void -fs_output_center_view(struct fs_output *fsout) -{ - int32_t surf_x, surf_y, surf_width, surf_height; - float x, y; - struct weston_output *output = fsout->output; - - surface_subsurfaces_boundingbox(fsout->view->surface, &surf_x, &surf_y, - &surf_width, &surf_height); - - x = output->x + (output->width - surf_width) / 2 - surf_x / 2; - y = output->y + (output->height - surf_height) / 2 - surf_y / 2; - - weston_view_set_position(fsout->view, x, y); -} - static void fs_output_scale_view(struct fs_output *fsout, float width, float height) { @@ -442,7 +426,7 @@ fs_output_configure_simple(struct fs_output *fsout, switch (fsout->method) { case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT: case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER: - fs_output_center_view(fsout); + center_on_output(fsout->view, fsout->output); break; case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM: @@ -493,7 +477,7 @@ fs_output_configure_for_mode(struct fs_output *fsout, if (fsout->pending.surface != configured_surface) { /* Nothing to really reconfigure. We'll just recenter the * view in case they played with subsurfaces */ - fs_output_center_view(fsout); + center_on_output(fsout->view, fsout->output); return; }