aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-11-01 08:38:39 -0400
committerGitHub <noreply@github.com>2017-11-01 08:38:39 -0400
commit03c0d41ca956e3eb5ddac15a34918bfb97fc4c09 (patch)
tree3a1d00fae00ed0e932dc25e945faea50846cefce /rootston
parente903a69698aabfd5469db2aa6b75bcd708574a16 (diff)
parent1a756b3123a76637ea69babf71af1202c71d89a8 (diff)
Merge pull request #367 from acrisci/bug/dnd-force-cancel
bugfix: dnd force cancel
Diffstat (limited to 'rootston')
-rw-r--r--rootston/cursor.c16
-rw-r--r--rootston/output.c3
2 files changed, 16 insertions, 3 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 7307b6b2..31001a9f 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -405,9 +405,6 @@ static void handle_drag_icon_destroy(struct wl_listener *listener, void *data) {
static void handle_drag_icon_commit(struct wl_listener *listener, void *data) {
struct roots_drag_icon *drag_icon =
wl_container_of(listener, drag_icon, surface_commit);
- // TODO the spec hints at rules that can determine whether the drag icon is
- // mapped here, but it is not completely clear so we need to test more
- // toolkits to see how we should interpret the surface state here.
drag_icon->sx += drag_icon->surface->current->sx;
drag_icon->sy += drag_icon->surface->current->sy;
}
@@ -431,6 +428,7 @@ static void handle_pointer_grab_begin(struct wl_listener *listener,
struct roots_drag_icon *drag_icon =
calloc(1, sizeof(struct roots_drag_icon));
+ drag_icon->mapped = true;
drag_icon->surface = drag->icon;
wl_list_insert(&input->drag_icons, &drag_icon->link);
@@ -448,6 +446,18 @@ static void handle_pointer_grab_begin(struct wl_listener *listener,
static void handle_pointer_grab_end(struct wl_listener *listener, void *data) {
struct roots_input *input =
wl_container_of(listener, input, pointer_grab_end);
+ struct wlr_seat_pointer_grab *grab = data;
+
+ if (grab->interface == &wlr_data_device_pointer_drag_interface) {
+ struct wlr_drag *drag = grab->data;
+ struct roots_drag_icon *icon;
+ wl_list_for_each(icon, &input->drag_icons, link) {
+ if (icon->surface == drag->icon) {
+ icon->mapped = false;
+ }
+ }
+ }
+
cursor_update_position(input, 0);
}
diff --git a/rootston/output.c b/rootston/output.c
index 9e1cd4d5..baa7b6cc 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -152,6 +152,9 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
struct roots_drag_icon *drag_icon = NULL;
wl_list_for_each(drag_icon, &server->input->drag_icons, link) {
+ if (!drag_icon->mapped) {
+ continue;
+ }
struct wlr_surface *icon = drag_icon->surface;
struct wlr_cursor *cursor = server->input->cursor;
double icon_x = cursor->x + drag_icon->sx;