mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
view: let view_set_fallback_natural_geometry() return wlr_box
This commit is contained in:
parent
164b17c279
commit
e6b5d91b63
3 changed files with 11 additions and 11 deletions
|
|
@ -484,7 +484,7 @@ void view_moved(struct view *view);
|
||||||
void view_minimize(struct view *view, bool minimized);
|
void view_minimize(struct view *view, bool minimized);
|
||||||
bool view_compute_centered_position(struct view *view,
|
bool view_compute_centered_position(struct view *view,
|
||||||
const struct wlr_box *ref, int w, int h, int *x, int *y);
|
const struct wlr_box *ref, int w, int h, int *x, int *y);
|
||||||
void view_set_fallback_natural_geometry(struct view *view);
|
struct wlr_box view_get_fallback_natural_geometry(struct view *view);
|
||||||
void view_store_natural_geometry(struct view *view);
|
void view_store_natural_geometry(struct view *view);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
18
src/view.c
18
src/view.c
|
|
@ -953,16 +953,16 @@ adjust_floating_geometry(struct view *view, struct wlr_box *geometry,
|
||||||
&geometry->x, &geometry->y);
|
&geometry->x, &geometry->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
struct wlr_box
|
||||||
view_set_fallback_natural_geometry(struct view *view)
|
view_get_fallback_natural_geometry(struct view *view)
|
||||||
{
|
{
|
||||||
view->natural_geometry.width = VIEW_FALLBACK_WIDTH;
|
struct wlr_box box = {
|
||||||
view->natural_geometry.height = VIEW_FALLBACK_HEIGHT;
|
.width = VIEW_FALLBACK_WIDTH,
|
||||||
|
.height = VIEW_FALLBACK_HEIGHT,
|
||||||
|
};
|
||||||
view_compute_centered_position(view, NULL,
|
view_compute_centered_position(view, NULL,
|
||||||
view->natural_geometry.width,
|
box.width, box.height, &box.x, &box.y);
|
||||||
view->natural_geometry.height,
|
return box;
|
||||||
&view->natural_geometry.x,
|
|
||||||
&view->natural_geometry.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1502,7 +1502,7 @@ view_maximize(struct view *view, enum view_axis axis,
|
||||||
*/
|
*/
|
||||||
if ((axis == VIEW_AXIS_HORIZONTAL || axis == VIEW_AXIS_VERTICAL)
|
if ((axis == VIEW_AXIS_HORIZONTAL || axis == VIEW_AXIS_VERTICAL)
|
||||||
&& wlr_box_empty(&view->natural_geometry)) {
|
&& wlr_box_empty(&view->natural_geometry)) {
|
||||||
view_set_fallback_natural_geometry(view);
|
view->natural_geometry = view_get_fallback_natural_geometry(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_maximized(view, axis);
|
set_maximized(view, axis);
|
||||||
|
|
|
||||||
|
|
@ -756,7 +756,7 @@ check_natural_geometry(struct view *view)
|
||||||
if (!view_is_floating(view)
|
if (!view_is_floating(view)
|
||||||
&& (view->natural_geometry.width < LAB_MIN_VIEW_WIDTH
|
&& (view->natural_geometry.width < LAB_MIN_VIEW_WIDTH
|
||||||
|| view->natural_geometry.height < LAB_MIN_VIEW_HEIGHT)) {
|
|| view->natural_geometry.height < LAB_MIN_VIEW_HEIGHT)) {
|
||||||
view_set_fallback_natural_geometry(view);
|
view->natural_geometry = view_get_fallback_natural_geometry(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue