mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
view.c: refactor view_maximize()
This commit is contained in:
parent
b616bb6842
commit
e0067536fc
2 changed files with 15 additions and 28 deletions
|
|
@ -306,6 +306,7 @@ void interactive_begin(struct view *view, enum input_mode mode,
|
|||
void output_init(struct server *server);
|
||||
void output_damage_surface(struct output *output, struct wlr_surface *surface,
|
||||
double lx, double ly, bool whole);
|
||||
void scale_box(struct wlr_box *box, float scale);
|
||||
|
||||
void damage_all_outputs(struct server *server);
|
||||
void damage_view_whole(struct view *view);
|
||||
|
|
|
|||
42
src/view.c
42
src/view.c
|
|
@ -37,8 +37,7 @@ view_unminimize(struct view *view)
|
|||
void
|
||||
view_maximize(struct view *view, bool maximize)
|
||||
{
|
||||
if(maximize == true)
|
||||
{
|
||||
if(maximize == true) {
|
||||
struct wlr_output_layout *layout = view->server->output_layout;
|
||||
struct wlr_output* output = wlr_output_layout_output_at(
|
||||
layout, view->x + view->w / 2, view->y + view->h / 2);
|
||||
|
|
@ -54,35 +53,22 @@ view_maximize(struct view *view, bool maximize)
|
|||
view->unmaximized_geometry.width = view->w;
|
||||
view->unmaximized_geometry.height = view->h;
|
||||
|
||||
int x = ol_output->x;
|
||||
int y = ol_output->y;
|
||||
int width = output->width;
|
||||
int height = output->height;
|
||||
|
||||
if(view->server_side_deco)
|
||||
{
|
||||
struct border border = deco_thickness(view);
|
||||
x += border.right;
|
||||
x += border.left;
|
||||
y += border.top;
|
||||
y += border.bottom;
|
||||
|
||||
width -= border.right;
|
||||
width -= border.left;
|
||||
height -= border.top;
|
||||
height -= border.bottom;
|
||||
}
|
||||
|
||||
struct wlr_box box = {
|
||||
.x = x * output->scale,
|
||||
.y = y * output->scale,
|
||||
.width = width * output->scale,
|
||||
.height = height * output->scale
|
||||
.x = ol_output->x,
|
||||
.y = ol_output->y,
|
||||
.width = output->width,
|
||||
.height = output->height,
|
||||
};
|
||||
|
||||
if (view->server_side_deco) {
|
||||
struct border border = deco_thickness(view);
|
||||
box.x += border.left;
|
||||
box.y += border.top;
|
||||
box.width -= border.right + border.left;
|
||||
box.height -= border.top + border.bottom;
|
||||
}
|
||||
scale_box(&box, output->scale);
|
||||
view_move_resize(view, box);
|
||||
view_move(view, box.x * output->scale, box.y * output->scale);
|
||||
|
||||
view_move(view, box.x, box.y);
|
||||
view->maximized = true;
|
||||
} else {
|
||||
/* unmaximize */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue