Re: [PATCH weston] exposay: arrange views per-output
On Mon, Feb 10, 2014 at 01:22:32PM +0100, Emilio Pozuelo Monfort wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk https://bugs.freedesktop.org/show_bug.cgi?id=73173 Thanks for fixing this, patch applied and bug closed. Kristian --- desktop-shell/exposay.c | 108 desktop-shell/shell.c | 7 desktop-shell/shell.h | 74 +++-- 3 files changed, 107 insertions(+), 82 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index fe7a3a7..b7e32c9 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -30,6 +30,7 @@ struct exposay_surface { struct desktop_shell *shell; + struct exposay_output *eoutput; struct weston_surface *surface; struct weston_view *view; struct wl_list link; @@ -140,6 +141,7 @@ exposay_highlight_surface(struct desktop_shell *shell, shell-exposay.row_current = esurface-row; shell-exposay.column_current = esurface-column; + shell-exposay.cur_output = esurface-eoutput; activate(shell, view-surface, shell-exposay.seat); shell-exposay.focus_current = view; @@ -178,32 +180,32 @@ exposay_pick(struct desktop_shell *shell, int x, int y) * aspect ratio into account really. Also needs to be notified of surface * addition and removal and adjust layout/animate accordingly. */ static enum exposay_layout_state -exposay_layout(struct desktop_shell *shell) +exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output) { struct workspace *workspace = shell-exposay.workspace; - struct weston_compositor *compositor = shell-compositor; - struct weston_output *output = get_default_output(compositor); + struct weston_output *output = shell_output-output; + struct exposay_output *eoutput = shell_output-eoutput; struct weston_view *view; struct exposay_surface *esurface, *highlight = NULL; int w, h; int i; int last_row_removed = 0; - wl_list_init(shell-exposay.surface_list); - - shell-exposay.num_surfaces = 0; + eoutput-num_surfaces = 0; wl_list_for_each(view, workspace-layer.view_list, layer_link) { if (!get_shell_surface(view-surface)) continue; - shell-exposay.num_surfaces++; + if (view-output != output) + continue; + eoutput-num_surfaces++; } - if (shell-exposay.num_surfaces == 0) { - shell-exposay.grid_size = 0; - shell-exposay.hpadding_outer = 0; - shell-exposay.vpadding_outer = 0; - shell-exposay.padding_inner = 0; - shell-exposay.surface_size = 0; + if (eoutput-num_surfaces == 0) { + eoutput-grid_size = 0; + eoutput-hpadding_outer = 0; + eoutput-vpadding_outer = 0; + eoutput-padding_inner = 0; + eoutput-surface_size = 0; return EXPOSAY_LAYOUT_OVERVIEW; } @@ -219,37 +221,39 @@ exposay_layout(struct desktop_shell *shell) * XXX: Surely there has to be a better way to express this maths, * right?! */ - shell-exposay.grid_size = floor(sqrtf(shell-exposay.num_surfaces)); - if (pow(shell-exposay.grid_size, 2) != shell-exposay.num_surfaces) - shell-exposay.grid_size++; - last_row_removed = pow(shell-exposay.grid_size, 2) - shell-exposay.num_surfaces; + eoutput-grid_size = floor(sqrtf(eoutput-num_surfaces)); + if (pow(eoutput-grid_size, 2) != eoutput-num_surfaces) + eoutput-grid_size++; + last_row_removed = pow(eoutput-grid_size, 2) - eoutput-num_surfaces; - shell-exposay.hpadding_outer = (output-width / 10); - shell-exposay.vpadding_outer = (output-height / 10); - shell-exposay.padding_inner = 80; + eoutput-hpadding_outer = (output-width / 10); + eoutput-vpadding_outer = (output-height / 10); + eoutput-padding_inner = 80; - w = output-width - (shell-exposay.hpadding_outer * 2); - w -= shell-exposay.padding_inner * (shell-exposay.grid_size - 1); - w /= shell-exposay.grid_size; + w = output-width - (eoutput-hpadding_outer * 2); + w -= eoutput-padding_inner * (eoutput-grid_size - 1); + w /= eoutput-grid_size; - h = output-height - (shell-exposay.vpadding_outer * 2); - h -= shell-exposay.padding_inner * (shell-exposay.grid_size - 1); - h /= shell-exposay.grid_size; + h = output-height - (eoutput-vpadding_outer * 2); + h -= eoutput-padding_inner * (eoutput-grid_size - 1); + h /= eoutput-grid_size; - shell-exposay.surface_size = (w h) ? w : h; - if (shell-exposay.surface_size (output-width / 2)) - shell-exposay.surface_size = output-width / 2; - if (shell-exposay.surface_size
[PATCH weston] exposay: arrange views per-output
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk https://bugs.freedesktop.org/show_bug.cgi?id=73173 --- desktop-shell/exposay.c | 108 desktop-shell/shell.c | 7 desktop-shell/shell.h | 74 +++-- 3 files changed, 107 insertions(+), 82 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index fe7a3a7..b7e32c9 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -30,6 +30,7 @@ struct exposay_surface { struct desktop_shell *shell; + struct exposay_output *eoutput; struct weston_surface *surface; struct weston_view *view; struct wl_list link; @@ -140,6 +141,7 @@ exposay_highlight_surface(struct desktop_shell *shell, shell-exposay.row_current = esurface-row; shell-exposay.column_current = esurface-column; + shell-exposay.cur_output = esurface-eoutput; activate(shell, view-surface, shell-exposay.seat); shell-exposay.focus_current = view; @@ -178,32 +180,32 @@ exposay_pick(struct desktop_shell *shell, int x, int y) * aspect ratio into account really. Also needs to be notified of surface * addition and removal and adjust layout/animate accordingly. */ static enum exposay_layout_state -exposay_layout(struct desktop_shell *shell) +exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output) { struct workspace *workspace = shell-exposay.workspace; - struct weston_compositor *compositor = shell-compositor; - struct weston_output *output = get_default_output(compositor); + struct weston_output *output = shell_output-output; + struct exposay_output *eoutput = shell_output-eoutput; struct weston_view *view; struct exposay_surface *esurface, *highlight = NULL; int w, h; int i; int last_row_removed = 0; - wl_list_init(shell-exposay.surface_list); - - shell-exposay.num_surfaces = 0; + eoutput-num_surfaces = 0; wl_list_for_each(view, workspace-layer.view_list, layer_link) { if (!get_shell_surface(view-surface)) continue; - shell-exposay.num_surfaces++; + if (view-output != output) + continue; + eoutput-num_surfaces++; } - if (shell-exposay.num_surfaces == 0) { - shell-exposay.grid_size = 0; - shell-exposay.hpadding_outer = 0; - shell-exposay.vpadding_outer = 0; - shell-exposay.padding_inner = 0; - shell-exposay.surface_size = 0; + if (eoutput-num_surfaces == 0) { + eoutput-grid_size = 0; + eoutput-hpadding_outer = 0; + eoutput-vpadding_outer = 0; + eoutput-padding_inner = 0; + eoutput-surface_size = 0; return EXPOSAY_LAYOUT_OVERVIEW; } @@ -219,37 +221,39 @@ exposay_layout(struct desktop_shell *shell) * XXX: Surely there has to be a better way to express this maths, * right?! */ - shell-exposay.grid_size = floor(sqrtf(shell-exposay.num_surfaces)); - if (pow(shell-exposay.grid_size, 2) != shell-exposay.num_surfaces) - shell-exposay.grid_size++; - last_row_removed = pow(shell-exposay.grid_size, 2) - shell-exposay.num_surfaces; + eoutput-grid_size = floor(sqrtf(eoutput-num_surfaces)); + if (pow(eoutput-grid_size, 2) != eoutput-num_surfaces) + eoutput-grid_size++; + last_row_removed = pow(eoutput-grid_size, 2) - eoutput-num_surfaces; - shell-exposay.hpadding_outer = (output-width / 10); - shell-exposay.vpadding_outer = (output-height / 10); - shell-exposay.padding_inner = 80; + eoutput-hpadding_outer = (output-width / 10); + eoutput-vpadding_outer = (output-height / 10); + eoutput-padding_inner = 80; - w = output-width - (shell-exposay.hpadding_outer * 2); - w -= shell-exposay.padding_inner * (shell-exposay.grid_size - 1); - w /= shell-exposay.grid_size; + w = output-width - (eoutput-hpadding_outer * 2); + w -= eoutput-padding_inner * (eoutput-grid_size - 1); + w /= eoutput-grid_size; - h = output-height - (shell-exposay.vpadding_outer * 2); - h -= shell-exposay.padding_inner * (shell-exposay.grid_size - 1); - h /= shell-exposay.grid_size; + h = output-height - (eoutput-vpadding_outer * 2); + h -= eoutput-padding_inner * (eoutput-grid_size - 1); + h /= eoutput-grid_size; - shell-exposay.surface_size = (w h) ? w : h; - if (shell-exposay.surface_size (output-width / 2)) - shell-exposay.surface_size = output-width / 2; - if (shell-exposay.surface_size (output-height / 2)) - shell-exposay.surface_size = output-height / 2; +