view: allow overriding of cursor placement policy

This commit is contained in:
Jens Peters 2024-01-21 23:25:01 +01:00 committed by Johan Malm
parent 8517254705
commit 099929cf46
4 changed files with 5 additions and 5 deletions

View file

@ -414,7 +414,7 @@ void view_center(struct view *view, const struct wlr_box *ref);
* view_place_initial - apply initial placement strategy to view * view_place_initial - apply initial placement strategy to view
* @view: view to be placed * @view: view to be placed
*/ */
void view_place_initial(struct view *view); void view_place_initial(struct view *view, bool allow_cursor);
void view_constrain_size_to_that_of_usable_area(struct view *view); void view_constrain_size_to_that_of_usable_area(struct view *view);
void view_restore_to(struct view *view, struct wlr_box geometry); void view_restore_to(struct view *view, struct wlr_box geometry);

View file

@ -728,9 +728,9 @@ view_center(struct view *view, const struct wlr_box *ref)
} }
void void
view_place_initial(struct view *view) view_place_initial(struct view *view, bool allow_cursor)
{ {
if (rc.placement_policy == LAB_PLACE_CURSOR) { if (allow_cursor && rc.placement_policy == LAB_PLACE_CURSOR) {
view_move_to_cursor(view); view_move_to_cursor(view);
return; return;
} else if (rc.placement_policy == LAB_PLACE_AUTOMATIC) { } else if (rc.placement_policy == LAB_PLACE_AUTOMATIC) {

View file

@ -435,7 +435,7 @@ set_initial_position(struct view *view)
} }
/* All other views are placed according to a configured strategy */ /* All other views are placed according to a configured strategy */
view_place_initial(view); view_place_initial(view, /* allow_cursor */ true);
} }
static const char * static const char *

View file

@ -519,7 +519,7 @@ set_initial_position(struct view *view,
view_constrain_size_to_that_of_usable_area(view); view_constrain_size_to_that_of_usable_area(view);
if (view_is_floating(view)) { if (view_is_floating(view)) {
view_place_initial(view); view_place_initial(view, /* allow_cursor */ true);
} else { } else {
/* /*
* View is maximized/fullscreen. Center the * View is maximized/fullscreen. Center the