summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-10-06 14:37:44 -0500
committerDaniel Stone <daniels@collabora.com>2017-12-04 21:58:08 +0000
commit927d9e23fadb8babaf8ee93b215a25c448c5f6f2 (patch)
treeac154decfa37f2179ebe4e24c0a3d5ade1546d7f
parent5c3f3575d56702c71b44b612eb3a8cdf8f674f1a (diff)
desktop-shell: refactor maximized size calculation into its own function
We need to calculate maximized size to resolve a bug with unsetting fullscreen, might as well share the code. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--desktop-shell/shell.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index a0070a04..8c9b59ae 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2585,6 +2585,19 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
}
static void
+get_maximized_size(struct shell_surface *shsurf, int32_t *width, int32_t *height)
+{
+ struct desktop_shell *shell;
+ pixman_rectangle32_t area;
+
+ shell = shell_surface_get_shell(shsurf);
+ get_output_work_area(shell, shsurf->output, &area);
+
+ *width = area.width;
+ *height = area.height;
+}
+
+static void
set_fullscreen(struct shell_surface *shsurf, bool fullscreen,
struct weston_output *output)
{
@@ -2689,8 +2702,6 @@ set_maximized(struct shell_surface *shsurf, bool maximized)
if (maximized) {
struct weston_output *output;
- struct desktop_shell *shell;
- pixman_rectangle32_t area;
if (!weston_surface_is_mapped(surface))
output = get_focused_output(surface->compositor);
@@ -2699,11 +2710,7 @@ set_maximized(struct shell_surface *shsurf, bool maximized)
shell_surface_set_output(shsurf, output);
- shell = shell_surface_get_shell(shsurf);
- get_output_work_area(shell, shsurf->output, &area);
-
- width = area.width;
- height = area.height;
+ get_maximized_size(shsurf, &width, &height);
}
weston_desktop_surface_set_maximized(desktop_surface, maximized);
weston_desktop_surface_set_size(desktop_surface, width, height);