output: Add output_is_usable() helper

This commit is contained in:
John Lindgren 2023-02-16 12:24:27 -05:00
parent fe7edf82d9
commit 6efc6a9db4
5 changed files with 20 additions and 18 deletions

View file

@ -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)