From f89c31c2de3f9211d735eafc9a94eb69fb5c3576 Mon Sep 17 00:00:00 2001 From: elviosak <33790211+elviosak@users.noreply.github.com> Date: Sat, 29 Nov 2025 08:01:46 -0300 Subject: [PATCH] replace range with horizontalRange and verticalRange --- docs/labwc-config.5.scd | 14 ++++++++------ docs/rc.xml.all | 5 +++-- include/config/rcxml.h | 3 ++- src/config/rcxml.c | 10 ++++++++-- src/interactive.c | 10 +++++----- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 9b0f8291..27f10d1e 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -498,13 +498,15 @@ activated with SnapToEdge actions or, optionally, by dragging windows to the edges of an output. Edge snapping causes a window to occupy half of its output, extending outward from the snapped edge. -**++ +**++ +**++ ** - If an interactive move ends with the cursor within ** pixels of an - output edge, the window is snapped to the edge. If it's also within - ** pixels of an output corner, the window is snapped to the - corner instead. A ** of 0 disables snapping. - Default is 10 for ** and 50 for **. + If an interactive move ends with the cursor within ** pixels of + the left/right output edge, or ** of the top/bottom output edge, + the window is snapped to the edge. If it's also within ** pixels of + an output corner, the window is snapped to the corner instead. + If ** and ** is 0, snapping is disabled. + Default is 10 for ** and **, and 50 for **. ** [yes|no] Show an overlay when snapping to a window to an edge. Default is yes. diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 97698aac..7066695a 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -162,7 +162,8 @@ - 10 + 10 + 10 50 @@ -586,7 +587,7 @@ - sendEventsMode [yes|no|disabledOnExternalMouse] - calibrationMatrix [six float values split by space] - scrollFactor [float] - + The following ... block may not be complete for your requirements. Default values are device specific. Only set an option if you require to override the default. Valid values must be inserted. diff --git a/include/config/rcxml.h b/include/config/rcxml.h index 91a73d58..2e5a6170 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -151,7 +151,8 @@ struct rcxml { int unmaximize_threshold; /* window snapping */ - int snap_edge_range; + int snap_edge_horizontal_range; + int snap_edge_vertical_range; int snap_edge_corner_range; bool snap_overlay_enabled; int snap_overlay_delay_inner; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 264c65a8..a6a5fdeb 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1177,7 +1177,12 @@ entry(xmlNode *node, char *nodename, char *content) } else if (!strcasecmp(nodename, "unMaximizeThreshold.resistance")) { rc.unmaximize_threshold = atoi(content); } else if (!strcasecmp(nodename, "range.snapping")) { - rc.snap_edge_range = atoi(content); + rc.snap_edge_horizontal_range = atoi(content); + rc.snap_edge_vertical_range = atoi(content); + } else if (!strcasecmp(nodename, "horizontalRange.snapping")) { + rc.snap_edge_horizontal_range = atoi(content); + } else if (!strcasecmp(nodename, "verticalRange.snapping")) { + rc.snap_edge_vertical_range = atoi(content); } else if (!strcasecmp(nodename, "cornerRange.snapping")) { rc.snap_edge_corner_range = atoi(content); } else if (!strcasecmp(nodename, "enabled.overlay.snapping")) { @@ -1456,7 +1461,8 @@ rcxml_init(void) rc.unsnap_threshold = 20; rc.unmaximize_threshold = 150; - rc.snap_edge_range = 10; + rc.snap_edge_horizontal_range = 10; + rc.snap_edge_vertical_range = 10; rc.snap_edge_corner_range = 50; rc.snap_overlay_enabled = true; rc.snap_overlay_delay_inner = 500; diff --git a/src/interactive.c b/src/interactive.c index 8ca258c1..dda93919 100644 --- a/src/interactive.c +++ b/src/interactive.c @@ -186,7 +186,7 @@ edge_from_cursor(struct seat *seat, struct output **dest_output, return false; } - if (rc.snap_edge_range == 0) { + if (rc.snap_edge_horizontal_range == 0 && rc.snap_edge_vertical_range == 0) { return false; } @@ -210,13 +210,13 @@ edge_from_cursor(struct seat *seat, struct output **dest_output, int left = cursor_x - area->x; int right = area->x + area->width - cursor_x; - if (top < rc.snap_edge_range) { + if (top < rc.snap_edge_vertical_range) { *edge1 = LAB_EDGE_TOP; - } else if (bottom < rc.snap_edge_range) { + } else if (bottom < rc.snap_edge_vertical_range) { *edge1 = LAB_EDGE_BOTTOM; - } else if (left < rc.snap_edge_range) { + } else if (left < rc.snap_edge_horizontal_range) { *edge1 = LAB_EDGE_LEFT; - } else if (right < rc.snap_edge_range) { + } else if (right < rc.snap_edge_horizontal_range) { *edge1 = LAB_EDGE_RIGHT; } else { return false;