action: allow configurable policy in AutoPlace action

Closes: #1784.
This commit is contained in:
Andrew J. Hesford 2024-05-07 09:46:05 -04:00 committed by Johan Malm
parent 208f383c66
commit 89589f17c4
8 changed files with 60 additions and 21 deletions

View file

@ -16,7 +16,8 @@
#include "theme.h"
enum view_placement_policy {
LAB_PLACE_CENTER = 0,
LAB_PLACE_INVALID = 0,
LAB_PLACE_CENTER,
LAB_PLACE_CURSOR,
LAB_PLACE_AUTOMATIC
};

View file

@ -456,10 +456,13 @@ int view_effective_height(struct view *view, bool use_pending);
void view_center(struct view *view, const struct wlr_box *ref);
/**
* view_place_initial - apply initial placement strategy to view
* view_place_by_policy - apply placement strategy to view
* @view: view to be placed
* @allow_cursor: set to false to ignore center-on-cursor policy
* @policy: placement policy to apply
*/
void view_place_initial(struct view *view, bool allow_cursor);
void view_place_by_policy(struct view *view, bool allow_cursor,
enum view_placement_policy);
void view_constrain_size_to_that_of_usable_area(struct view *view);
void view_restore_to(struct view *view, struct wlr_box geometry);
@ -525,6 +528,7 @@ struct output *view_get_adjacent_output(struct view *view, enum view_edge edge,
bool wrap);
enum view_axis view_axis_parse(const char *direction);
enum view_edge view_edge_parse(const char *direction);
enum view_placement_policy view_placement_parse(const char *policy);
/* xdg.c */
struct wlr_xdg_surface *xdg_surface_from_view(struct view *view);