]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: allow overriding of cursor placement policy
authorJens Peters <jp7677@gmail.com>
Sun, 21 Jan 2024 22:25:01 +0000 (23:25 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 22 Jan 2024 22:27:08 +0000 (22:27 +0000)
include/view.h
src/view.c
src/xdg.c
src/xwayland.c

index f18904fc144ac1f3820d8a3ef47bc1b91656aff3..824657e8166700d40e112e7c676ff4e641a5a9c4 100644 (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: 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_restore_to(struct view *view, struct wlr_box geometry);
index c48ff9e015f86fb39db0c9d16b1acd26b8db48b7..8c26a8f126591df24d03b80e1241662f19ee14dd 100644 (file)
@@ -728,9 +728,9 @@ view_center(struct view *view, const struct wlr_box *ref)
 }
 
 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);
                return;
        } else if (rc.placement_policy == LAB_PLACE_AUTOMATIC) {
index 5787836bc9957327fa85e5e9d467d802773be6fd..5347d78cf7ba4a1ec69230f8c5a9e207561b6dda 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -435,7 +435,7 @@ set_initial_position(struct view *view)
        }
 
        /* All other views are placed according to a configured strategy */
-       view_place_initial(view);
+       view_place_initial(view, /* allow_cursor */ true);
 }
 
 static const char *
index 2d86427f6023676b81046a969e37cc008185f96b..d032fd435f930b057caeb49a8de053fa0b91d7bf 100644 (file)
@@ -519,7 +519,7 @@ set_initial_position(struct view *view,
                view_constrain_size_to_that_of_usable_area(view);
 
                if (view_is_floating(view)) {
-                       view_place_initial(view);
+                       view_place_initial(view, /* allow_cursor */ true);
                } else {
                        /*
                         * View is maximized/fullscreen. Center the