From df0a8d3abe6a7a8cd010e07f078c0e92ea2fb516 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 15 Oct 2017 11:06:03 -0400 Subject: wlr-data-device: drag icons --- include/rootston/input.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/rootston/input.h') diff --git a/include/rootston/input.h b/include/rootston/input.h index fbabbdb6..8b4fc3b3 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -70,6 +70,15 @@ struct roots_input_event { struct wlr_input_device *device; }; +struct roots_drag_icon { + struct wlr_surface *surface; + struct wl_list link; // roots_input::drag_icons + bool mapped; + + struct wl_listener surface_destroy; + struct wl_listener surface_commit; +}; + struct roots_input { struct roots_config *config; struct roots_server *server; @@ -80,6 +89,7 @@ struct roots_input { struct wlr_xcursor *xcursor; struct wlr_seat *wl_seat; struct roots_view *client_cursor_view; + struct wl_list drag_icons; enum roots_cursor_mode mode; struct roots_view *active_view, *last_active_view; @@ -107,6 +117,7 @@ struct roots_input { struct wl_listener cursor_tool_axis; struct wl_listener cursor_tool_tip; + struct wl_listener pointer_grab_begin; struct wl_listener pointer_grab_end; struct wl_listener request_set_cursor; -- cgit v1.2.3 From c00a94ca76cfc81353b78174e88539f17e9db7e0 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 17 Oct 2017 17:21:11 -0400 Subject: data-device: fix drag icon position --- include/rootston/input.h | 3 +++ rootston/cursor.c | 3 +++ rootston/output.c | 6 ++---- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'include/rootston/input.h') diff --git a/include/rootston/input.h b/include/rootston/input.h index 40aea80a..357991ee 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -75,6 +75,9 @@ struct roots_drag_icon { struct wl_list link; // roots_input::drag_icons bool mapped; + int32_t sx; + int32_t sy; + struct wl_listener surface_destroy; struct wl_listener surface_commit; }; diff --git a/rootston/cursor.c b/rootston/cursor.c index bd988a41..6b509640 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -313,6 +313,9 @@ static void handle_drag_icon_commit(struct wl_listener *listener, void *data) { // 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; + drag_icon->mapped = drag_icon->surface->texture->valid; } diff --git a/rootston/output.c b/rootston/output.c index b431cbc3..f50306a3 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -158,10 +158,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { struct wlr_surface *icon = drag_icon->surface; struct wlr_cursor *cursor = server->input->cursor; - // TODO should also use the hotspot to determine the location, but - // hotspot is broken right now. - double icon_x = cursor->x - icon->current->sx; - double icon_y = cursor->y - icon->current->sy; + double icon_x = cursor->x + drag_icon->sx; + double icon_y = cursor->y + drag_icon->sy; render_surface(icon, desktop, wlr_output, &now, icon_x, icon_y, 0); } -- cgit v1.2.3 From 6fcac087fe1d7b7fa3cd0628a6b7818d26222678 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sat, 21 Oct 2017 09:59:35 -0400 Subject: rootston: remove mostly unused mapped icon param --- include/rootston/input.h | 1 - rootston/cursor.c | 2 -- rootston/output.c | 4 ---- 3 files changed, 7 deletions(-) (limited to 'include/rootston/input.h') diff --git a/include/rootston/input.h b/include/rootston/input.h index aacb3016..33750d7b 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -67,7 +67,6 @@ struct roots_input_event { struct roots_drag_icon { struct wlr_surface *surface; struct wl_list link; // roots_input::drag_icons - bool mapped; int32_t sx; int32_t sy; diff --git a/rootston/cursor.c b/rootston/cursor.c index 83581101..200a6d37 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -374,8 +374,6 @@ static void handle_drag_icon_commit(struct wl_listener *listener, void *data) { // 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; - - drag_icon->mapped = drag_icon->surface->texture->valid; } static void handle_pointer_grab_begin(struct wl_listener *listener, diff --git a/rootston/output.c b/rootston/output.c index fce14fea..f560061d 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -152,10 +152,6 @@ 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; -- cgit v1.2.3