Merge pull request #2603 from emersion/fix-dnd

Fix drag-and-drop
This commit is contained in:
Drew DeVault 2018-09-07 11:09:02 -04:00 committed by GitHub
commit 030b5bc024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -80,7 +80,8 @@ static bool get_surface_box(struct surface_iterator_data *data,
int sw = surface->current.width; int sw = surface->current.width;
int sh = surface->current.height; int sh = surface->current.height;
double _sx = sx, _sy = sy; double _sx = sx + surface->sx;
double _sy = sy + surface->sy;
rotate_child_position(&_sx, &_sy, sw, sh, data->width, data->height, rotate_child_position(&_sx, &_sy, sw, sh, data->width, data->height,
data->rotation); data->rotation);

View File

@ -395,6 +395,7 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
} }
struct sway_seat *seat = cursor->seat; struct sway_seat *seat = cursor->seat;
struct wlr_seat *wlr_seat = seat->wlr_seat;
if (seat->operation != OP_NONE) { if (seat->operation != OP_NONE) {
switch (seat->operation) { switch (seat->operation) {
@ -418,7 +419,6 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
return; return;
} }
struct wlr_seat *wlr_seat = seat->wlr_seat;
struct wlr_surface *surface = NULL; struct wlr_surface *surface = NULL;
double sx, sy; double sx, sy;

View File

@ -222,16 +222,16 @@ void drag_icon_update_position(struct sway_drag_icon *icon) {
struct sway_seat *seat = icon->seat; struct sway_seat *seat = icon->seat;
struct wlr_cursor *cursor = seat->cursor->cursor; struct wlr_cursor *cursor = seat->cursor->cursor;
if (wlr_icon->is_pointer) { if (wlr_icon->is_pointer) {
icon->x = cursor->x + wlr_icon->sx; icon->x = cursor->x;
icon->y = cursor->y + wlr_icon->sy; icon->y = cursor->y;
} else { } else {
struct wlr_touch_point *point = struct wlr_touch_point *point =
wlr_seat_touch_get_point(seat->wlr_seat, wlr_icon->touch_id); wlr_seat_touch_get_point(seat->wlr_seat, wlr_icon->touch_id);
if (point == NULL) { if (point == NULL) {
return; return;
} }
icon->x = seat->touch_x + wlr_icon->sx; icon->x = seat->touch_x;
icon->y = seat->touch_y + wlr_icon->sy; icon->y = seat->touch_y;
} }
drag_icon_damage_whole(icon); drag_icon_damage_whole(icon);
@ -289,6 +289,7 @@ static void handle_new_drag_icon(struct wl_listener *listener, void *data) {
wl_list_insert(&root->drag_icons, &icon->link); wl_list_insert(&root->drag_icons, &icon->link);
drag_icon_update_position(icon); drag_icon_update_position(icon);
seat_end_mouse_operation(seat);
} }
static void collect_focus_iter(struct sway_node *node, void *data) { static void collect_focus_iter(struct sway_node *node, void *data) {