desktop-shell: Compute panel size without using output
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
55d5701ddf
commit
581df06ad1
+19
-29
@@ -283,6 +283,23 @@ shell_grab_start(struct shell_grab *grab,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_panel_size(struct desktop_shell *shell,
|
||||||
|
struct weston_view *view,
|
||||||
|
int *width,
|
||||||
|
int *height)
|
||||||
|
{
|
||||||
|
float x1, y1;
|
||||||
|
float x2, y2;
|
||||||
|
weston_view_to_global_float(view, 0, 0, &x1, &y1);
|
||||||
|
weston_view_to_global_float(view,
|
||||||
|
view->surface->width,
|
||||||
|
view->surface->height,
|
||||||
|
&x2, &y2);
|
||||||
|
*width = (int)(x2 - x1);
|
||||||
|
*height = (int)(y2 - y1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_output_panel_size(struct desktop_shell *shell,
|
get_output_panel_size(struct desktop_shell *shell,
|
||||||
struct weston_output *output,
|
struct weston_output *output,
|
||||||
@@ -298,36 +315,9 @@ get_output_panel_size(struct desktop_shell *shell,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
wl_list_for_each(view, &shell->panel_layer.view_list.link, layer_link.link) {
|
wl_list_for_each(view, &shell->panel_layer.view_list.link, layer_link.link) {
|
||||||
float x, y;
|
if (view->surface->output == output) {
|
||||||
|
get_panel_size(shell, view, width, height);
|
||||||
if (view->surface->output != output)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
switch (shell->panel_position) {
|
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP:
|
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
|
|
||||||
weston_view_to_global_float(view,
|
|
||||||
view->surface->width, 0,
|
|
||||||
&x, &y);
|
|
||||||
|
|
||||||
*width = (int)x - output->x;
|
|
||||||
*height = view->surface->height + (int) y - output->y;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT:
|
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT:
|
|
||||||
weston_view_to_global_float(view,
|
|
||||||
0, view->surface->height,
|
|
||||||
&x, &y);
|
|
||||||
|
|
||||||
*width = view->surface->width + (int)x - output->x;
|
|
||||||
*height = (int)y - output->y;
|
|
||||||
return;
|
|
||||||
|
|
||||||
default:
|
|
||||||
/* we've already set width and height to
|
|
||||||
* fallback values. */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user