tiling drag: only start when there are drop targets (#5213)

This prevents potentially confusing drag & drop on fullscreen containers and
only-containers on workspaces.

fixes https://github.com/i3/i3/issues/5184
This commit is contained in:
Michael Stapelberg
2022-10-18 22:10:03 +02:00
committed by GitHub
parent 941229ee62
commit 5e759ed424
4 changed files with 76 additions and 18 deletions

View File

@ -230,7 +230,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 && is_left_click && !floatingcon &&
(config.tiling_drag == TILING_DRAG_MODIFIER ||
config.tiling_drag == TILING_DRAG_MODIFIER_OR_TITLEBAR)) {
config.tiling_drag == TILING_DRAG_MODIFIER_OR_TITLEBAR) &&
has_drop_targets()) {
const bool use_threshold = !mod_pressed;
tiling_drag(con, event, use_threshold);
allow_replay_pointer(event->time);
@ -311,7 +312,8 @@ static void route_click(Con *con, xcb_button_press_event_t *event, const bool mo
if (is_left_click &&
((config.tiling_drag == TILING_DRAG_TITLEBAR && dest == CLICK_DECORATION) ||
(config.tiling_drag == TILING_DRAG_MODIFIER_OR_TITLEBAR &&
(mod_pressed || dest == CLICK_DECORATION)))) {
(mod_pressed || dest == CLICK_DECORATION))) &&
has_drop_targets()) {
allow_replay_pointer(event->time);
const bool use_threshold = !mod_pressed;
tiling_drag(con, event, use_threshold);