aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2022-10-16 17:21:01 +0200
committerMichael Stapelberg <michael@stapelberg.de>2022-10-24 21:12:56 +0200
commitaa876585e82b94b49e25f5438c5ede1a2c6cca15 (patch)
tree329b6ec44ff588c8124d5afe56f686f2f5b586ac
parentf1754e12c043742a8df13eee0175417ae20788de (diff)
downloadi3-aa876585e82b94b49e25f5438c5ede1a2c6cca15.tar.gz
i3-aa876585e82b94b49e25f5438c5ede1a2c6cca15.zip
tiling drag: left-click needs threshold, mod-click doesn’t
related to https://github.com/i3/i3/issues/5155
-rw-r--r--include/tiling_drag.h2
-rw-r--r--src/click.c6
-rw-r--r--src/tiling_drag.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/include/tiling_drag.h b/include/tiling_drag.h
index ab002d43..ac9679b2 100644
--- a/include/tiling_drag.h
+++ b/include/tiling_drag.h
@@ -13,4 +13,4 @@
* Initiates a mouse drag operation on a tiled window.
*
*/
-void tiling_drag(Con *con, xcb_button_press_event_t *event);
+void tiling_drag(Con *con, xcb_button_press_event_t *event, bool use_threshold);
diff --git a/src/click.c b/src/click.c
index 6f41d559..5b0cc2e8 100644
--- a/src/click.c
+++ b/src/click.c
@@ -229,7 +229,8 @@ static void route_click(Con *con, xcb_button_press_event_t *event, const bool mo
/* 2: floating modifier pressed, initiate a drag */
if (mod_pressed && event->detail == XCB_BUTTON_INDEX_1 && !floatingcon) {
- tiling_drag(con, event);
+ const bool use_threshold = !mod_pressed;
+ tiling_drag(con, event, use_threshold);
allow_replay_pointer(event->time);
return;
}
@@ -307,7 +308,8 @@ static void route_click(Con *con, xcb_button_press_event_t *event, const bool mo
/* 8: floating modifier pressed, initiate a drag */
if ((mod_pressed || dest == CLICK_DECORATION) && event->detail == XCB_BUTTON_INDEX_1) {
allow_replay_pointer(event->time);
- tiling_drag(con, event);
+ const bool use_threshold = !mod_pressed;
+ tiling_drag(con, event, use_threshold);
return;
}
diff --git a/src/tiling_drag.c b/src/tiling_drag.c
index 6e2a3a31..2caa7f03 100644
--- a/src/tiling_drag.c
+++ b/src/tiling_drag.c
@@ -267,7 +267,7 @@ static xcb_window_t create_drop_indicator(Rect rect) {
* Initiates a mouse drag operation on a tiled window.
*
*/
-void tiling_drag(Con *con, xcb_button_press_event_t *event) {
+void tiling_drag(Con *con, xcb_button_press_event_t *event, bool use_threshold) {
DLOG("Start dragging tiled container: con = %p\n", con);
bool set_focus = (con == focused);
bool set_fs = con->fullscreen_mode != CF_NONE;
@@ -283,7 +283,6 @@ void tiling_drag(Con *con, xcb_button_press_event_t *event) {
xcb_window_t indicator = 0;
const struct callback_params params = {&indicator, &target, &direction, &drop_type};
- const bool use_threshold = true;
drag_result_t drag_result = drag_pointer(con, event, XCB_NONE, XCURSOR_CURSOR_MOVE, use_threshold, drag_callback, &params);
/* Dragging is done. We don't need the indicator window any more. */