mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
xdg: account for drag resistance in do_late_positioning()
The position where the view should be anchored can now be slightly different from the current cursor position. Addresses a TODO from #2009.
This commit is contained in:
parent
4bda13d870
commit
1a339f9c7e
3 changed files with 18 additions and 12 deletions
13
src/xdg.c
13
src/xdg.c
|
|
@ -93,13 +93,14 @@ do_late_positioning(struct view *view)
|
|||
struct server *server = view->server;
|
||||
if (server->input_mode == LAB_INPUT_STATE_MOVE
|
||||
&& view == server->grabbed_view) {
|
||||
/* Keep view underneath cursor */
|
||||
/* TODO: resistance is not considered */
|
||||
interactive_anchor_to_cursor(view, &view->pending);
|
||||
/* Update grab offsets */
|
||||
server->grab_x = server->seat.cursor->x;
|
||||
server->grab_y = server->seat.cursor->y;
|
||||
/* Anchor view to original grab position */
|
||||
interactive_anchor_to_cursor(view, &view->pending,
|
||||
server->grab_x, server->grab_y);
|
||||
/* Next update grab offsets */
|
||||
server->grab_box = view->pending;
|
||||
/* Finally, move by same distance cursor has moved */
|
||||
view->pending.x += server->seat.cursor->x - server->grab_x;
|
||||
view->pending.y += server->seat.cursor->y - server->grab_y;
|
||||
} else {
|
||||
/* TODO: smart placement? */
|
||||
view_compute_centered_position(view, NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue