From 352e7ed5276648ec01dc4411008316aa6389874b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 25 Nov 2013 18:01:35 +0000 Subject: [PATCH] =?UTF-8?q?shell:=20Factor=20out=20common=20code=20to=20se?= =?UTF-8?q?t=20a=20shsurf=E2=80=99s=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shell.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/shell.c b/src/shell.c index 2fff62b8..78bd5b94 100644 --- a/src/shell.c +++ b/src/shell.c @@ -2033,6 +2033,22 @@ get_output_panel_height(struct desktop_shell *shell, return panel_height; } +static void +shell_surface_set_output(struct shell_surface *shsurf, + struct weston_output *output) +{ + struct weston_surface *es = shsurf->surface; + + /* get the default output, if the client set it as NULL + check whether the ouput is available */ + if (output) + shsurf->output = output; + else if (es->output) + shsurf->output = es->output; + else + shsurf->output = get_default_output(es->compositor); +} + static void set_toplevel(struct shell_surface *shsurf) { @@ -2079,14 +2095,7 @@ set_fullscreen(struct shell_surface *shsurf, uint32_t framerate, struct weston_output *output) { - struct weston_surface *es = shsurf->surface; - - if (output) - shsurf->output = output; - else if (es->output) - shsurf->output = es->output; - else - shsurf->output = get_default_output(es->compositor); + shell_surface_set_output(shsurf, output); shsurf->fullscreen_output = shsurf->output; shsurf->fullscreen.type = method; @@ -2184,16 +2193,8 @@ set_maximized(struct shell_surface *shsurf, { struct desktop_shell *shell; uint32_t edges = 0, panel_height = 0; - struct weston_surface *es = shsurf->surface; - /* get the default output, if the client set it as NULL - check whether the ouput is available */ - if (output) - shsurf->output = output; - else if (es->output) - shsurf->output = es->output; - else - shsurf->output = get_default_output(es->compositor); + shell_surface_set_output(shsurf, output); shell = shell_surface_get_shell(shsurf); panel_height = get_output_panel_height(shell, shsurf->output);