mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
output: Add output_is_usable() helper
This commit is contained in:
parent
fe7edf82d9
commit
6efc6a9db4
5 changed files with 20 additions and 18 deletions
|
|
@ -416,6 +416,7 @@ void output_init(struct server *server);
|
|||
void output_manager_init(struct server *server);
|
||||
struct output *output_from_wlr_output(struct server *server,
|
||||
struct wlr_output *wlr_output);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -110,21 +110,16 @@ void
|
|||
foreign_toplevel_update_outputs(struct view *view)
|
||||
{
|
||||
assert(view->toplevel.handle);
|
||||
|
||||
struct wlr_box view_geo = view->current;
|
||||
struct wlr_output_layout *layout = view->server->output_layout;
|
||||
|
||||
struct output *output;
|
||||
wl_list_for_each(output, &view->server->outputs, link) {
|
||||
if (output->wlr_output->enabled && !output->leased) {
|
||||
if (wlr_output_layout_intersects(layout,
|
||||
output->wlr_output, &view_geo)) {
|
||||
wlr_foreign_toplevel_handle_v1_output_enter(
|
||||
view->toplevel.handle, output->wlr_output);
|
||||
continue;
|
||||
}
|
||||
if (output_is_usable(output) && wlr_output_layout_intersects(
|
||||
layout, output->wlr_output, &view->current)) {
|
||||
wlr_foreign_toplevel_handle_v1_output_enter(
|
||||
view->toplevel.handle, output->wlr_output);
|
||||
} else {
|
||||
wlr_foreign_toplevel_handle_v1_output_leave(
|
||||
view->toplevel.handle, output->wlr_output);
|
||||
}
|
||||
wlr_foreign_toplevel_handle_v1_output_leave(
|
||||
view->toplevel.handle, output->wlr_output);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,10 +407,9 @@ osd_update(struct server *server)
|
|||
struct output *output;
|
||||
wl_list_for_each(output, &server->outputs, link) {
|
||||
destroy_osd_nodes(output);
|
||||
if (!output->wlr_output->enabled) {
|
||||
continue;
|
||||
if (output_is_usable(output)) {
|
||||
display_osd(output);
|
||||
}
|
||||
display_osd(output);
|
||||
}
|
||||
|
||||
/* Outline current window */
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ static void
|
|||
output_frame_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct output *output = wl_container_of(listener, output, frame);
|
||||
if (!output->wlr_output->enabled) {
|
||||
if (!output_is_usable(output)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -458,6 +458,13 @@ output_from_wlr_output(struct server *server, struct wlr_output *wlr_output)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
output_is_usable(struct output *output)
|
||||
{
|
||||
/* output_is_usable(NULL) is safe and returns false */
|
||||
return output && output->wlr_output->enabled && !output->leased;
|
||||
}
|
||||
|
||||
/* returns true if usable area changed */
|
||||
static bool
|
||||
update_usable_area(struct output *output)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ resistance_move_apply(struct view *view, double *x, double *y)
|
|||
}
|
||||
|
||||
wl_list_for_each(output, &server->outputs, link) {
|
||||
if (!output->wlr_output->enabled) {
|
||||
if (!output_is_usable(output)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ resistance_resize_apply(struct view *view, struct wlr_box *new_view_geo)
|
|||
return;
|
||||
}
|
||||
wl_list_for_each(output, &server->outputs, link) {
|
||||
if (!output->wlr_output->enabled) {
|
||||
if (!output_is_usable(output)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue