mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-04 21:32:42 +00:00
desktop-shell: Use saved panel position
Don't look it up from the view every time, but instead just work completely from global co-ordinates. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
aae1abb8df
commit
82d25f3ce7
|
@ -229,11 +229,6 @@ shell_fade(struct desktop_shell *shell, enum fade_type type);
|
||||||
static struct shell_seat *
|
static struct shell_seat *
|
||||||
get_shell_seat(struct weston_seat *seat);
|
get_shell_seat(struct weston_seat *seat);
|
||||||
|
|
||||||
static void
|
|
||||||
get_output_panel_size(struct desktop_shell *shell,
|
|
||||||
struct weston_output *output,
|
|
||||||
int *width, int *height);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shell_surface_update_child_surface_layers(struct shell_surface *shsurf);
|
shell_surface_update_child_surface_layers(struct shell_surface *shsurf);
|
||||||
|
|
||||||
|
@ -373,39 +368,17 @@ shell_grab_start(struct shell_grab *grab,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
get_panel_size(struct desktop_shell *shell,
|
get_output_work_area(struct desktop_shell *shell,
|
||||||
struct weston_view *view,
|
struct weston_output *output,
|
||||||
int *width,
|
pixman_rectangle32_t *area)
|
||||||
int *height)
|
|
||||||
{
|
|
||||||
struct weston_coord_global a, b;
|
|
||||||
struct weston_coord_surface tmp_s;
|
|
||||||
|
|
||||||
tmp_s = weston_coord_surface(0, 0, view->surface);
|
|
||||||
a = weston_coord_surface_to_global(view, tmp_s);
|
|
||||||
|
|
||||||
tmp_s = weston_coord_surface(view->surface->width,
|
|
||||||
view->surface->height,
|
|
||||||
view->surface);
|
|
||||||
b = weston_coord_surface_to_global(view, tmp_s);
|
|
||||||
|
|
||||||
a = weston_coord_global_sub(b, a);
|
|
||||||
*width = a.c.x;
|
|
||||||
*height = a.c.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_output_panel_size(struct desktop_shell *shell,
|
|
||||||
struct weston_output *output,
|
|
||||||
int *width,
|
|
||||||
int *height)
|
|
||||||
{
|
{
|
||||||
struct shell_output *sh_output;
|
struct shell_output *sh_output;
|
||||||
struct weston_view *view;
|
|
||||||
|
|
||||||
*width = 0;
|
area->x = 0;
|
||||||
*height = 0;
|
area->y = 0;
|
||||||
|
area->width = 0;
|
||||||
|
area->height = 0;
|
||||||
|
|
||||||
if (!output)
|
if (!output)
|
||||||
return;
|
return;
|
||||||
|
@ -413,50 +386,31 @@ get_output_panel_size(struct desktop_shell *shell,
|
||||||
sh_output = find_shell_output_from_weston_output(shell, output);
|
sh_output = find_shell_output_from_weston_output(shell, output);
|
||||||
assert(sh_output);
|
assert(sh_output);
|
||||||
|
|
||||||
view = sh_output->panel_view;
|
area->x = output->pos.c.x;
|
||||||
if (!view || !weston_view_is_mapped(view))
|
area->y = output->pos.c.y;
|
||||||
return;
|
area->width = output->width;
|
||||||
|
area->height = output->height;
|
||||||
weston_view_update_transform(view);
|
|
||||||
get_panel_size(shell, view, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
get_output_work_area(struct desktop_shell *shell,
|
|
||||||
struct weston_output *output,
|
|
||||||
pixman_rectangle32_t *area)
|
|
||||||
{
|
|
||||||
int32_t panel_width = 0, panel_height = 0;
|
|
||||||
|
|
||||||
if (!output) {
|
|
||||||
area->x = 0;
|
|
||||||
area->y = 0;
|
|
||||||
area->width = 0;
|
|
||||||
area->height = 0;
|
|
||||||
|
|
||||||
|
if (!sh_output->panel_view ||
|
||||||
|
!weston_view_is_mapped(sh_output->panel_view)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
area->x = output->pos.c.x;
|
|
||||||
area->y = output->pos.c.y;
|
|
||||||
|
|
||||||
get_output_panel_size(shell, output, &panel_width, &panel_height);
|
|
||||||
switch (shell->panel_position) {
|
switch (shell->panel_position) {
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP:
|
case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP:
|
||||||
default:
|
area->y += sh_output->panel_surface->height;
|
||||||
area->y += panel_height;
|
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
|
case WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
|
||||||
area->width = output->width;
|
area->height -= sh_output->panel_surface->height;
|
||||||
area->height = output->height - panel_height;
|
|
||||||
break;
|
break;
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT:
|
case WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT:
|
||||||
area->x += panel_width;
|
area->x += sh_output->panel_surface->width;
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT:
|
case WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT:
|
||||||
area->width = output->width - panel_width;
|
area->width -= sh_output->panel_surface->width;
|
||||||
area->height = output->height;
|
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
unreachable("unknown panel position");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue