data-device: fix drag icon position
This commit is contained in:
parent
b7c622a319
commit
c00a94ca76
|
@ -75,6 +75,9 @@ struct roots_drag_icon {
|
||||||
struct wl_list link; // roots_input::drag_icons
|
struct wl_list link; // roots_input::drag_icons
|
||||||
bool mapped;
|
bool mapped;
|
||||||
|
|
||||||
|
int32_t sx;
|
||||||
|
int32_t sy;
|
||||||
|
|
||||||
struct wl_listener surface_destroy;
|
struct wl_listener surface_destroy;
|
||||||
struct wl_listener surface_commit;
|
struct wl_listener surface_commit;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
// 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
|
// 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.
|
// 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;
|
drag_icon->mapped = drag_icon->surface->texture->valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct wlr_surface *icon = drag_icon->surface;
|
struct wlr_surface *icon = drag_icon->surface;
|
||||||
struct wlr_cursor *cursor = server->input->cursor;
|
struct wlr_cursor *cursor = server->input->cursor;
|
||||||
// TODO should also use the hotspot to determine the location, but
|
double icon_x = cursor->x + drag_icon->sx;
|
||||||
// hotspot is broken right now.
|
double icon_y = cursor->y + drag_icon->sy;
|
||||||
double icon_x = cursor->x - icon->current->sx;
|
|
||||||
double icon_y = cursor->y - icon->current->sy;
|
|
||||||
render_surface(icon, desktop, wlr_output, &now, icon_x, icon_y, 0);
|
render_surface(icon, desktop, wlr_output, &now, icon_x, icon_y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue