From 670cc0f511cef7e82ba4024d4c50f980de479b4c Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Thu, 8 Aug 2024 09:19:52 +0900 Subject: [PATCH] Rename to As we already have <{screen,window}EdgeStrength>, will be a better place for this setting. --- docs/labwc-config.5.scd | 8 ++++---- docs/rc.xml.all | 2 +- include/config/rcxml.h | 2 +- include/labwc.h | 4 ++-- src/config/rcxml.c | 6 +++--- src/input/cursor.c | 2 +- src/interactive.c | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 55956db4..dd8e4bcb 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -326,6 +326,10 @@ this is for compatibility with Openbox. The default value for both parameters is 20 pixels. +** + Sets the movement of cursor in pixel required for a tiled or maximized + window to be moved with an interactive move. Default is 20. + ## FOCUS ** [yes|no] @@ -356,10 +360,6 @@ extending outward from the snapped edge. SnapToEdge action for that edge. A *range* of 0 disables snapping via interactive moves. Default is 1. -** - Sets the movement of cursor in pixel required for a tiled or maximized - window to be moved with an interactive move. Default is 20. - ** [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 ea331352..f71014a6 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -107,6 +107,7 @@ 20 20 + 20 @@ -125,7 +126,6 @@ 1 - 20 diff --git a/include/config/rcxml.h b/include/config/rcxml.h index c49bafd2..2b5da588 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -124,6 +124,7 @@ struct rcxml { /* resistance */ int screen_edge_strength; int window_edge_strength; + int unsnap_threshold; /* window snapping */ int snap_edge_range; @@ -132,7 +133,6 @@ struct rcxml { int snap_overlay_delay_outer; bool snap_top_maximize; enum tiling_events_mode snap_tiling_events_mode; - int snap_drag_resistance; enum resize_indicator_mode resize_indicator; bool resize_draw_contents; diff --git a/include/labwc.h b/include/labwc.h index 466a90d3..1e577c86 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -504,7 +504,7 @@ void seat_output_layout_changed(struct seat *seat); * geometry->{width,height} are provided by the caller. * geometry->{x,y} are computed by this function. * - * @note When drag-resistance is used, cursor_x/y should be the original + * @note When is non-zero, cursor_x/y should be the original * cursor position when the button was pressed. */ void interactive_anchor_to_cursor(struct view *view, struct wlr_box *geometry, @@ -514,7 +514,7 @@ void interactive_anchor_to_cursor(struct view *view, struct wlr_box *geometry, * interactive_move_tiled_view_to() - Un-tile the tiled/maximized view at the * start of an interactive move or when an interactive move is pending. * Returns true if the distance of cursor motion exceeds the value of - * and the view is un-tiled. + * and the view is un-tiled. */ bool interactive_move_tiled_view_to(struct server *server, struct view *view, struct wlr_box *geometry); diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 0227911b..da0bbde3 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -965,6 +965,8 @@ entry(xmlNode *node, char *nodename, char *content) rc.screen_edge_strength = atoi(content); } else if (!strcasecmp(nodename, "windowEdgeStrength.resistance")) { rc.window_edge_strength = atoi(content); + } else if (!strcasecmp(nodename, "unSnapThreshold.resistance")) { + rc.unsnap_threshold = atoi(content); } else if (!strcasecmp(nodename, "range.snapping")) { rc.snap_edge_range = atoi(content); } else if (!strcasecmp(nodename, "enabled.overlay.snapping")) { @@ -987,8 +989,6 @@ entry(xmlNode *node, char *nodename, char *content) } else { wlr_log(WLR_ERROR, "ignoring invalid value for notifyClient"); } - } else if (!strcasecmp(nodename, "dragResistance.snapping")) { - rc.snap_drag_resistance = atoi(content); /* */ } else if (!strcasecmp(nodename, "show.windowSwitcher")) { @@ -1289,6 +1289,7 @@ rcxml_init(void) rc.kb_layout_per_window = false; rc.screen_edge_strength = 20; rc.window_edge_strength = 20; + rc.unsnap_threshold = 20; rc.snap_edge_range = 1; rc.snap_overlay_enabled = true; @@ -1296,7 +1297,6 @@ rcxml_init(void) rc.snap_overlay_delay_outer = 500; rc.snap_top_maximize = true; rc.snap_tiling_events_mode = LAB_TILING_EVENTS_ALWAYS; - rc.snap_drag_resistance = 20; rc.window_switcher.show = true; rc.window_switcher.preview = true; diff --git a/src/input/cursor.c b/src/input/cursor.c index 3df48983..94e23fdd 100644 --- a/src/input/cursor.c +++ b/src/input/cursor.c @@ -236,7 +236,7 @@ process_cursor_move(struct server *server, uint32_t time) /* * Un-tile the view when interactive move is delayed and the distance - * of cursor movement exceeds . + * of cursor movement exceeds . */ if (server->move_pending && !interactive_move_tiled_view_to( server, server->grabbed_view, &server->grab_box)) { diff --git a/src/interactive.c b/src/interactive.c index d8c2f342..13392b06 100644 --- a/src/interactive.c +++ b/src/interactive.c @@ -38,7 +38,7 @@ interactive_move_tiled_view_to(struct server *server, struct view *view, { assert(!view_is_floating(view)); - int resistance = rc.snap_drag_resistance; + int threshold = rc.unsnap_threshold; if (server->input_mode == LAB_INPUT_STATE_MOVE) { /* When called from cursor motion handler */ @@ -46,12 +46,12 @@ interactive_move_tiled_view_to(struct server *server, struct view *view, double dx = server->seat.cursor->x - server->grab_x; double dy = server->seat.cursor->y - server->grab_y; - if (dx * dx + dy * dy < resistance * resistance) { + if (dx * dx + dy * dy < threshold * threshold) { return false; } } else { /* When called from interactive_begin() */ - if (resistance > 0) { + if (threshold > 0) { return false; } } @@ -118,7 +118,7 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges) } /* - * If is non-zero, the + * If is non-zero, the * tiled/maximized view is un-tiled later in cursor * motion handler. */