view: Tidy up view->output/view->fullscreen redundancy

A fullscreen view currently has its output specified twice by:
  - struct output *output
  - struct wlr_output *fullscreen

view->fullscreen may also become a dangling pointer if the output is
disconnected, because view_on_output_destroy() clears view->output but
not view->fullscreen.

To eliminate the redundancy and the dangling pointer, let's change
view->fullscreen to a Boolean and rely on view->output to specify the
output.

Along the way, change a few related usages of struct wlr_output to
struct output as well.

No functional change intended.

v2: Don't allow entering fullscreen on disabled output (makes
    conditions for entering/leaving fullscreen symmetric)
v3: Use output_is_usable() helper
This commit is contained in:
John Lindgren 2023-02-15 02:12:22 -05:00
parent 6efc6a9db4
commit 49c9466039
3 changed files with 44 additions and 47 deletions

View file

@ -48,6 +48,7 @@ struct view {
bool ssd_enabled;
bool minimized;
bool maximized;
bool fullscreen;
uint32_t tiled; /* private, enum view_edge in src/view.c */
/* Pointer to an output owned struct region, may be NULL */
@ -55,8 +56,6 @@ struct view {
/* Set to region->name when tiled_region is free'd by a destroying output */
char *tiled_region_evacuate;
struct wlr_output *fullscreen;
/*
* Geometry of the wlr_surface contained within the view, as
* currently displayed. Should be kept in sync with the
@ -137,7 +136,7 @@ void view_set_untiled(struct view *view);
void view_maximize(struct view *view, bool maximize,
bool store_natural_geometry);
void view_set_fullscreen(struct view *view, bool fullscreen,
struct wlr_output *wlr_output);
struct output *output);
void view_toggle_maximize(struct view *view);
void view_toggle_decorations(struct view *view);
void view_toggle_always_on_top(struct view *view);