aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar Nick Diego Yamane <nickdiego@igalia.com>2020-07-06 17:17:04 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2020-07-07 00:05:35 +0200
commite5954f321f76c9337efaf9c5f66140bfba2bae77 (patch)
treed3ad2b6b85e942079a3b5407ca7085bcba9866fc /sway/input
parentISSUE_TEMPLATE: Use the newer issue templates (diff)
downloadsway-e5954f321f76c9337efaf9c5f66140bfba2bae77.tar.gz
sway-e5954f321f76c9337efaf9c5f66140bfba2bae77.tar.zst
sway-e5954f321f76c9337efaf9c5f66140bfba2bae77.zip
seat/dnd: support null drag icon surfaces
As per the Wayland spec [1]: > The icon surface is an optional (can be NULL) surface that provides an > icon to be moved around with the cursor. However, as of now Sway "start_drag" signal handler does not starts the DND session unless a non-NULL drag icons is provided. This patch fixes it by skipping handling of the drag icon if it is null. Fixes #5509 [1] https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_data_device Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seat.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 656e3e7e..bcf01962 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -470,31 +470,29 @@ static void handle_start_drag(struct wl_listener *listener, void *data) {
470 wl_signal_add(&wlr_drag->events.destroy, &drag->destroy); 470 wl_signal_add(&wlr_drag->events.destroy, &drag->destroy);
471 471
472 struct wlr_drag_icon *wlr_drag_icon = wlr_drag->icon; 472 struct wlr_drag_icon *wlr_drag_icon = wlr_drag->icon;
473 if (wlr_drag_icon == NULL) { 473 if (wlr_drag_icon != NULL) {
474 return; 474 struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon));
475 } 475 if (icon == NULL) {
476 476 sway_log(SWAY_ERROR, "Allocation failed");
477 struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon)); 477 return;
478 if (icon == NULL) { 478 }
479 sway_log(SWAY_ERROR, "Allocation failed"); 479 icon->seat = seat;
480 return; 480 icon->wlr_drag_icon = wlr_drag_icon;
481 } 481 wlr_drag_icon->data = icon;
482 icon->seat = seat;
483 icon->wlr_drag_icon = wlr_drag_icon;
484 wlr_drag_icon->data = icon;
485 482
486 icon->surface_commit.notify = drag_icon_handle_surface_commit; 483 icon->surface_commit.notify = drag_icon_handle_surface_commit;
487 wl_signal_add(&wlr_drag_icon->surface->events.commit, &icon->surface_commit); 484 wl_signal_add(&wlr_drag_icon->surface->events.commit, &icon->surface_commit);
488 icon->unmap.notify = drag_icon_handle_unmap; 485 icon->unmap.notify = drag_icon_handle_unmap;
489 wl_signal_add(&wlr_drag_icon->events.unmap, &icon->unmap); 486 wl_signal_add(&wlr_drag_icon->events.unmap, &icon->unmap);
490 icon->map.notify = drag_icon_handle_map; 487 icon->map.notify = drag_icon_handle_map;
491 wl_signal_add(&wlr_drag_icon->events.map, &icon->map); 488 wl_signal_add(&wlr_drag_icon->events.map, &icon->map);
492 icon->destroy.notify = drag_icon_handle_destroy; 489 icon->destroy.notify = drag_icon_handle_destroy;
493 wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy); 490 wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy);
494 491
495 wl_list_insert(&root->drag_icons, &icon->link); 492 wl_list_insert(&root->drag_icons, &icon->link);
496 493
497 drag_icon_update_position(icon); 494 drag_icon_update_position(icon);
495 }
498 seatop_begin_default(seat); 496 seatop_begin_default(seat);
499} 497}
500 498