From 9e8aa3953098adb6175c26aebd984a32a2beccb0 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Wed, 7 Nov 2018 22:44:11 -0500 Subject: Implement per side and per direction outer gaps This introduces the following command extensions from `i3-gaps`: * `gaps horizontal|vertical|top|right|bottom|left ` * `gaps horizontal|vertical|top|right|bottom|left all|current set|plus|minus ` * `workspace gaps horizontal|vertical|top|right|bottom|left ` `inner` and `outer` are also still available as options for all three of the above commands. `outer` now acts as a shorthand to set/alter all sides. Additionally, this fixes two bugs with the prevention of invalid gap configurations for workspace configs: 1. If outer gaps were not set and inner gaps were, the outer gaps would be snapped to the negation of the inner gaps due to `INT_MIN` being less than the negation. This took precedence over the default outer gaps. 2. Similarly, if inner gaps were not set and outer gaps were, inner gaps would be set to zero, which would take precedence over the default inner gaps. Fixing both of the above items also requires checking the gaps again when creating a workspace since the default outer gaps can be smaller than the negation of the workspace specific inner gaps. --- sway/tree/view.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sway/tree/view.c') diff --git a/sway/tree/view.c b/sway/tree/view.c index 1aa59e68..7ae8efaa 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -190,7 +190,8 @@ static bool gaps_to_edge(struct sway_view *view) { } con = con->parent; } - return view->container->workspace->current_gaps > 0; + struct side_gaps gaps = view->container->workspace->current_gaps; + return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0; } void view_autoconfigure(struct sway_view *view) { -- cgit v1.2.3-54-g00ecf