mirror of
https://github.com/labwc/labwc.git
synced 2026-03-04 01:40:39 -05:00
view.c: remember unmaximized geometry
This commit is contained in:
parent
3fe052222d
commit
be3fea0c1a
2 changed files with 11 additions and 15 deletions
|
|
@ -194,6 +194,9 @@ struct view {
|
||||||
/* geometry of the wlr_surface contained within the view */
|
/* geometry of the wlr_surface contained within the view */
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
|
||||||
|
/* geometry before maximize */
|
||||||
|
struct wlr_box unmaximized_geometry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* margin refers to the space between the extremities of the
|
* margin refers to the space between the extremities of the
|
||||||
* wlr_surface and the max extents of the server-side decorations.
|
* wlr_surface and the max extents of the server-side decorations.
|
||||||
|
|
|
||||||
23
src/view.c
23
src/view.c
|
|
@ -46,13 +46,14 @@ view_maximize(struct view *view, bool maximize)
|
||||||
wlr_output_layout_get(layout, output);
|
wlr_output_layout_get(layout, output);
|
||||||
|
|
||||||
assert(layout);
|
assert(layout);
|
||||||
if(output == NULL)
|
|
||||||
{
|
|
||||||
die("output NULL w/ x and y of: %d, %d", view->x, view->y);
|
|
||||||
}
|
|
||||||
assert(output);
|
assert(output);
|
||||||
assert(ol_output);
|
assert(ol_output);
|
||||||
|
|
||||||
|
view->unmaximized_geometry.x = view->x;
|
||||||
|
view->unmaximized_geometry.y = view->y;
|
||||||
|
view->unmaximized_geometry.width = view->w;
|
||||||
|
view->unmaximized_geometry.height = view->h;
|
||||||
|
|
||||||
int x = ol_output->x;
|
int x = ol_output->x;
|
||||||
int y = ol_output->y;
|
int y = ol_output->y;
|
||||||
int width = output->width;
|
int width = output->width;
|
||||||
|
|
@ -83,17 +84,9 @@ view_maximize(struct view *view, bool maximize)
|
||||||
view_move(view, box.x * output->scale, box.y * output->scale);
|
view_move(view, box.x * output->scale, box.y * output->scale);
|
||||||
|
|
||||||
view->maximized = true;
|
view->maximized = true;
|
||||||
}
|
} else {
|
||||||
else
|
/* unmaximize */
|
||||||
{
|
view_move_resize(view, view->unmaximized_geometry);
|
||||||
struct wlr_box box = {
|
|
||||||
.x = 20,
|
|
||||||
.y = 50,
|
|
||||||
.width = 640,
|
|
||||||
.height = 480
|
|
||||||
};
|
|
||||||
|
|
||||||
view_move_resize(view, box);
|
|
||||||
view->maximized = false;
|
view->maximized = false;
|
||||||
}
|
}
|
||||||
view->impl->maximize(view, maximize);
|
view->impl->maximize(view, maximize);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue