shell: Factor out common code to set a shsurf’s output
This commit is contained in:
parent
17c2fb4f29
commit
352e7ed527
35
src/shell.c
35
src/shell.c
@ -2033,6 +2033,22 @@ get_output_panel_height(struct desktop_shell *shell,
|
|||||||
return panel_height;
|
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
|
static void
|
||||||
set_toplevel(struct shell_surface *shsurf)
|
set_toplevel(struct shell_surface *shsurf)
|
||||||
{
|
{
|
||||||
@ -2079,14 +2095,7 @@ set_fullscreen(struct shell_surface *shsurf,
|
|||||||
uint32_t framerate,
|
uint32_t framerate,
|
||||||
struct weston_output *output)
|
struct weston_output *output)
|
||||||
{
|
{
|
||||||
struct weston_surface *es = shsurf->surface;
|
shell_surface_set_output(shsurf, output);
|
||||||
|
|
||||||
if (output)
|
|
||||||
shsurf->output = output;
|
|
||||||
else if (es->output)
|
|
||||||
shsurf->output = es->output;
|
|
||||||
else
|
|
||||||
shsurf->output = get_default_output(es->compositor);
|
|
||||||
|
|
||||||
shsurf->fullscreen_output = shsurf->output;
|
shsurf->fullscreen_output = shsurf->output;
|
||||||
shsurf->fullscreen.type = method;
|
shsurf->fullscreen.type = method;
|
||||||
@ -2184,16 +2193,8 @@ set_maximized(struct shell_surface *shsurf,
|
|||||||
{
|
{
|
||||||
struct desktop_shell *shell;
|
struct desktop_shell *shell;
|
||||||
uint32_t edges = 0, panel_height = 0;
|
uint32_t edges = 0, panel_height = 0;
|
||||||
struct weston_surface *es = shsurf->surface;
|
|
||||||
|
|
||||||
/* get the default output, if the client set it as NULL
|
shell_surface_set_output(shsurf, output);
|
||||||
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 = shell_surface_get_shell(shsurf);
|
shell = shell_surface_get_shell(shsurf);
|
||||||
panel_height = get_output_panel_height(shell, shsurf->output);
|
panel_height = get_output_panel_height(shell, shsurf->output);
|
||||||
|
Loading…
Reference in New Issue
Block a user