mirror of
https://github.com/labwc/labwc.git
synced 2026-03-24 09:06:09 -04:00
view: honor placement policy in more scenarios
This commit is contained in:
parent
5238dcaa08
commit
1211c43a47
3 changed files with 9 additions and 22 deletions
16
src/view.c
16
src/view.c
|
|
@ -898,16 +898,8 @@ adjust_floating_geometry(struct view *view, struct wlr_box *geometry,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reposition offscreen automatically if configured to do so */
|
/* Reposition offscreen automatically if configured to do so */
|
||||||
if (rc.placement_policy == LAB_PLACE_AUTOMATIC) {
|
return view_compute_position_by_policy(view, geometry,
|
||||||
if (placement_find_best(view, geometry)) {
|
/* allow_cursor */ true, rc.placement_policy);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If automatic placement failed or was not enabled, just center */
|
|
||||||
return view_compute_centered_position(view, NULL,
|
|
||||||
geometry->width, geometry->height,
|
|
||||||
&geometry->x, &geometry->y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box
|
struct wlr_box
|
||||||
|
|
@ -917,8 +909,8 @@ view_get_fallback_natural_geometry(struct view *view)
|
||||||
.width = VIEW_FALLBACK_WIDTH,
|
.width = VIEW_FALLBACK_WIDTH,
|
||||||
.height = VIEW_FALLBACK_HEIGHT,
|
.height = VIEW_FALLBACK_HEIGHT,
|
||||||
};
|
};
|
||||||
view_compute_centered_position(view, NULL,
|
view_compute_position_by_policy(view, &box,
|
||||||
box.width, box.height, &box.x, &box.y);
|
/* allow_cursor */ true, rc.placement_policy);
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,10 +123,8 @@ do_late_positioning(struct view *view)
|
||||||
/* Reposition the view while anchoring it to cursor */
|
/* Reposition the view while anchoring it to cursor */
|
||||||
interactive_anchor_to_cursor(server, &view->pending);
|
interactive_anchor_to_cursor(server, &view->pending);
|
||||||
} else {
|
} else {
|
||||||
/* TODO: smart placement? */
|
view_compute_position_by_policy(view, &view->pending,
|
||||||
view_compute_centered_position(view, NULL,
|
/* allow_cursor */ true, rc.placement_policy);
|
||||||
view->pending.width, view->pending.height,
|
|
||||||
&view->pending.x, &view->pending.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -769,15 +769,12 @@ set_initial_position(struct view *view,
|
||||||
/* allow_cursor */ true, rc.placement_policy);
|
/* allow_cursor */ true, rc.placement_policy);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* View is maximized/fullscreen. Center the
|
* View is maximized/fullscreen. Place the
|
||||||
* stored natural geometry without actually
|
* stored natural geometry without actually
|
||||||
* moving the view.
|
* moving the view.
|
||||||
*/
|
*/
|
||||||
view_compute_centered_position(view, NULL,
|
view_compute_position_by_policy(view, &view->natural_geometry,
|
||||||
view->natural_geometry.width,
|
/* allow_cursor */ true, rc.placement_policy);
|
||||||
view->natural_geometry.height,
|
|
||||||
&view->natural_geometry.x,
|
|
||||||
&view->natural_geometry.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue