aboutsummaryrefslogtreecommitdiff
path: root/rootston/cursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'rootston/cursor.c')
-rw-r--r--rootston/cursor.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 31001a9f..b153e8c8 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: