mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
view: Handle maximized view on disabled output more simply
Partially reverts commit ab07b68d7e.
This commit is contained in:
parent
87f4a60e38
commit
e0264e471c
1 changed files with 16 additions and 17 deletions
33
src/view.c
33
src/view.c
|
|
@ -165,9 +165,15 @@ view_apply_fullscreen_geometry(struct view *view, struct wlr_output *wlr_output)
|
||||||
static void
|
static void
|
||||||
view_apply_maximized_geometry(struct view *view)
|
view_apply_maximized_geometry(struct view *view)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* The same code handles both initial maximize and re-maximize
|
||||||
|
* to account for layout changes. In either case, view_output()
|
||||||
|
* gives the output closest to the current geometry (which may
|
||||||
|
* be different from the output originally maximized onto).
|
||||||
|
* view_output() can return NULL if all outputs are disabled.
|
||||||
|
*/
|
||||||
struct output *output = view_output(view);
|
struct output *output = view_output(view);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
wlr_log(WLR_ERROR, "view %p has no output", view);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_box box = output_usable_area_in_layout_coords(output);
|
struct wlr_box box = output_usable_area_in_layout_coords(output);
|
||||||
|
|
@ -319,26 +325,19 @@ view_adjust_for_layout_change(struct view *view)
|
||||||
if (wlr_output_layout_get(layout, view->fullscreen)) {
|
if (wlr_output_layout_get(layout, view->fullscreen)) {
|
||||||
/* recompute fullscreen geometry */
|
/* recompute fullscreen geometry */
|
||||||
view_apply_fullscreen_geometry(view, view->fullscreen);
|
view_apply_fullscreen_geometry(view, view->fullscreen);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
/* output is gone, exit fullscreen */
|
/* output is gone, exit fullscreen */
|
||||||
view_set_fullscreen(view, false, NULL);
|
view_set_fullscreen(view, false, NULL);
|
||||||
}
|
}
|
||||||
}
|
} else if (view->maximized) {
|
||||||
|
/* recompute maximized geometry */
|
||||||
bool was_maximized = view->maximized;
|
view_apply_maximized_geometry(view);
|
||||||
if (was_maximized) {
|
} else {
|
||||||
view_maximize(view, false);
|
/* reposition view if it's offscreen */
|
||||||
}
|
struct wlr_box box = { view->x, view->y, view->w, view->h };
|
||||||
|
if (!wlr_output_layout_intersects(layout, NULL, &box)) {
|
||||||
/* reposition view if it's offscreen */
|
view_center(view);
|
||||||
struct wlr_box box = { view->x, view->y, view->w, view->h };
|
}
|
||||||
if (!wlr_output_layout_intersects(layout, NULL, &box)) {
|
|
||||||
view_center(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (was_maximized) {
|
|
||||||
view_maximize(view, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue