diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-11-09 08:36:27 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-11-09 08:36:27 -0500 |
commit | 66587eb4304af9ffc0eaaea8161e53f8a6fd962b (patch) | |
tree | 382876a5f8f6e730ced207037d3c55a45e8ca66d /rootston/cursor.c | |
parent | 2f6cfe4057fbef41977159e24fea0d19fbeeb052 (diff) | |
parent | b5ad7a5232b919319eef1a198d731b308c0bb9cc (diff) |
Merge remote-tracking branch 'origin/master' into hidpi
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r-- | rootston/cursor.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c index aa8e5122..3a6d087e 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -117,8 +117,8 @@ void cursor_update_position(struct roots_input *input, uint32_t time) { if (input->active_view) { double dx = input->cursor->x - input->offs_x; double dy = input->cursor->y - input->offs_y; - view_set_position(input->active_view, - input->view_x + dx, input->view_y + dy); + view_move(input->active_view, input->view_x + dx, + input->view_y + dy); } break; case ROOTS_CURSOR_RESIZE: @@ -132,15 +132,19 @@ void cursor_update_position(struct roots_input *input, uint32_t time) { if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) { active_y = input->view_y + dy; height -= dy; - } - if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) { + if (height < 0) { + active_y += height; + } + } else if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) { height += dy; } if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) { active_x = input->view_x + dx; width -= dx; - } - if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) { + if (width < 0) { + active_x += width; + } + } else if (input->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) { width += dx; } @@ -151,12 +155,13 @@ void cursor_update_position(struct roots_input *input, uint32_t time) { height = 0; } - // TODO we might need one configure event for this if (active_x != input->active_view->x || active_y != input->active_view->y) { - view_set_position(input->active_view, active_x, active_y); + view_move_resize(input->active_view, active_x, active_y, + width, height); + } else { + view_resize(input->active_view, width, height); } - view_resize(input->active_view, width, height); } break; case ROOTS_CURSOR_ROTATE: |