diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2015-04-15 12:23:54 -0500 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-07-17 17:46:49 -0700 |
commit | f814c5dc9db7fd6597ddebe5ae221e33768323a0 (patch) | |
tree | 76846d74ec57afeedc8cb5a0bd8ea8cc24e9f5c4 /desktop-shell | |
parent | c68362329ea0abf91f5f4f8d3df051c775ec1653 (diff) | |
download | weston-f814c5dc9db7fd6597ddebe5ae221e33768323a0.tar.gz |
desktop-shell: add output co-ordinates to get_output_work_area()
get_output_work_area() now returns the absolute work area including the
output's offset.
This will make math a little simpler later when we use it to constrain
window moves.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r-- | desktop-shell/shell.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index f673f041..f87b6bbe 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -460,21 +460,20 @@ get_output_work_area(struct desktop_shell *shell, { int32_t panel_width = 0, panel_height = 0; - area->x = 0; - area->y = 0; + area->x = output->x; + area->y = output->y; get_output_panel_size(shell, output, &panel_width, &panel_height); - switch (shell->panel_position) { case DESKTOP_SHELL_PANEL_POSITION_TOP: default: - area->y = panel_height; + area->y += panel_height; case DESKTOP_SHELL_PANEL_POSITION_BOTTOM: area->width = output->width; area->height = output->height - panel_height; break; case DESKTOP_SHELL_PANEL_POSITION_LEFT: - area->x = panel_width; + area->x += panel_width; case DESKTOP_SHELL_PANEL_POSITION_RIGHT: area->width = output->width - panel_width; area->height = output->height; @@ -5437,7 +5436,7 @@ weston_view_set_initial_position(struct weston_view *view, struct weston_compositor *compositor = shell->compositor; int ix = 0, iy = 0; int32_t range_x, range_y; - int32_t dx, dy, x, y; + int32_t x, y; struct weston_output *output, *target_output = NULL; struct weston_seat *seat; pixman_rectangle32_t area; @@ -5474,19 +5473,16 @@ weston_view_set_initial_position(struct weston_view *view, */ get_output_work_area(shell, target_output, &area); - dx = area.x; - dy = area.y; + x = area.x; + y = area.y; range_x = area.width - view->surface->width; range_y = area.height - view->surface->height; if (range_x > 0) - dx += random() % range_x; + x += random() % range_x; if (range_y > 0) - dy += random() % range_y; - - x = target_output->x + dx; - y = target_output->y + dy; + y += random() % range_y; weston_view_set_position(view, x, y); } |