From 1c75d4e54a877bb1918afb5bf23c2c142ca30b78 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 5 Jun 2018 18:17:42 -0400 Subject: rename drag-icon map to unmap --- rootston/seat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rootston/seat.c') diff --git a/rootston/seat.c b/rootston/seat.c index b137ff11..81cedc5a 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -263,10 +263,10 @@ static void roots_drag_icon_handle_surface_commit(struct wl_listener *listener, roots_drag_icon_damage_whole(icon); } -static void roots_drag_icon_handle_map(struct wl_listener *listener, +static void roots_drag_icon_handle_unmap(struct wl_listener *listener, void *data) { struct roots_drag_icon *icon = - wl_container_of(listener, icon, map); + wl_container_of(listener, icon, unmap); roots_drag_icon_damage_whole(icon); } @@ -278,7 +278,7 @@ static void roots_drag_icon_handle_destroy(struct wl_listener *listener, wl_list_remove(&icon->link); wl_list_remove(&icon->surface_commit.link); - wl_list_remove(&icon->map.link); + wl_list_remove(&icon->unmap.link); wl_list_remove(&icon->destroy.link); free(icon); } @@ -297,8 +297,8 @@ static void roots_seat_handle_new_drag_icon(struct wl_listener *listener, icon->surface_commit.notify = roots_drag_icon_handle_surface_commit; wl_signal_add(&wlr_drag_icon->surface->events.commit, &icon->surface_commit); - icon->map.notify = roots_drag_icon_handle_map; - wl_signal_add(&wlr_drag_icon->events.map, &icon->map); + icon->unmap.notify = roots_drag_icon_handle_unmap; + wl_signal_add(&wlr_drag_icon->events.unmap, &icon->unmap); icon->destroy.notify = roots_drag_icon_handle_destroy; wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy); -- cgit v1.2.3 From 9333acd68e468d409cbcc30fb742fdf57c631cb9 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 5 Jun 2018 23:01:43 -0400 Subject: handle drag icon map in rootston --- include/rootston/seat.h | 1 + rootston/seat.c | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'rootston/seat.c') diff --git a/include/rootston/seat.h b/include/rootston/seat.h index bed81c88..0e3043dd 100644 --- a/include/rootston/seat.h +++ b/include/rootston/seat.h @@ -58,6 +58,7 @@ struct roots_drag_icon { double x, y; struct wl_listener surface_commit; + struct wl_listener map; struct wl_listener unmap; struct wl_listener destroy; }; diff --git a/rootston/seat.c b/rootston/seat.c index 81cedc5a..132b0f35 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -263,6 +263,13 @@ static void roots_drag_icon_handle_surface_commit(struct wl_listener *listener, roots_drag_icon_damage_whole(icon); } +static void roots_drag_icon_handle_map(struct wl_listener *listener, + void *data) { + struct roots_drag_icon *icon = + wl_container_of(listener, icon, map); + roots_drag_icon_damage_whole(icon); +} + static void roots_drag_icon_handle_unmap(struct wl_listener *listener, void *data) { struct roots_drag_icon *icon = @@ -299,6 +306,8 @@ static void roots_seat_handle_new_drag_icon(struct wl_listener *listener, wl_signal_add(&wlr_drag_icon->surface->events.commit, &icon->surface_commit); icon->unmap.notify = roots_drag_icon_handle_unmap; wl_signal_add(&wlr_drag_icon->events.unmap, &icon->unmap); + icon->map.notify = roots_drag_icon_handle_map; + wl_signal_add(&wlr_drag_icon->events.map, &icon->map); icon->destroy.notify = roots_drag_icon_handle_destroy; wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy); -- cgit v1.2.3 From 7c888a39c6d08e9301032625987a6015fac17c6f Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 5 Jun 2018 23:45:03 -0400 Subject: update drag position at the right times --- rootston/seat.c | 3 +++ types/data_device/wlr_drag.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'rootston/seat.c') diff --git a/rootston/seat.c b/rootston/seat.c index 132b0f35..33dff741 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -260,6 +260,7 @@ static void roots_drag_icon_handle_surface_commit(struct wl_listener *listener, void *data) { struct roots_drag_icon *icon = wl_container_of(listener, icon, surface_commit); + roots_drag_icon_update_position(icon); roots_drag_icon_damage_whole(icon); } @@ -312,6 +313,8 @@ static void roots_seat_handle_new_drag_icon(struct wl_listener *listener, wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy); wl_list_insert(&seat->drag_icons, &icon->link); + + roots_drag_icon_update_position(icon); } void roots_drag_icon_update_position(struct roots_drag_icon *icon) { diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index 4b42307e..4f0b2521 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -100,12 +100,12 @@ static void drag_set_focus(struct wlr_drag *drag, static void drag_icon_set_mapped(struct wlr_drag_icon *icon, bool mapped) { if (mapped && !icon->mapped) { + icon->mapped = true; wlr_signal_emit_safe(&icon->events.map, icon); } else if (!mapped && icon->mapped) { + icon->mapped = false; wlr_signal_emit_safe(&icon->events.unmap, icon); } - - icon->mapped = mapped; } static void drag_end(struct wlr_drag *drag) { -- cgit v1.2.3 From 5d3e95f833ae562bf6926ddfb9f1bdb0492c1674 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Wed, 6 Jun 2018 12:02:01 -0400 Subject: dont damage drag icon after update_position --- rootston/seat.c | 1 - 1 file changed, 1 deletion(-) (limited to 'rootston/seat.c') diff --git a/rootston/seat.c b/rootston/seat.c index 33dff741..91561567 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -261,7 +261,6 @@ static void roots_drag_icon_handle_surface_commit(struct wl_listener *listener, struct roots_drag_icon *icon = wl_container_of(listener, icon, surface_commit); roots_drag_icon_update_position(icon); - roots_drag_icon_damage_whole(icon); } static void roots_drag_icon_handle_map(struct wl_listener *listener, -- cgit v1.2.3