diff --git a/include/labwc.h b/include/labwc.h index 54fbe960..598d4270 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -460,6 +460,7 @@ bool output_is_usable(struct output *output); void output_update_usable_area(struct output *output); void output_update_all_usable_areas(struct server *server, bool layout_changed); struct wlr_box output_usable_area_in_layout_coords(struct output *output); +struct wlr_box output_usable_area_scaled(struct output *output); void handle_output_power_manager_set_mode(struct wl_listener *listener, void *data); diff --git a/src/output.c b/src/output.c index 9074b94f..eef34629 100644 --- a/src/output.c +++ b/src/output.c @@ -565,6 +565,24 @@ output_usable_area_in_layout_coords(struct output *output) return box; } +struct wlr_box +output_usable_area_scaled(struct output *output) +{ + if (!output) { + return (struct wlr_box){0}; + } + struct wlr_box usable = output_usable_area_in_layout_coords(output); + if (usable.height == output->wlr_output->height + && output->wlr_output->scale != 1) { + usable.height /= output->wlr_output->scale; + } + if (usable.width == output->wlr_output->width + && output->wlr_output->scale != 1) { + usable.width /= output->wlr_output->scale; + } + return usable; +} + void handle_output_power_manager_set_mode(struct wl_listener *listener, void *data) {