aboutsummaryrefslogtreecommitdiff
path: root/rootston/cursor.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-03 14:49:15 +0100
committeremersion <contact@emersion.fr>2017-11-03 14:49:15 +0100
commitcf713edc1052943ceaf33fd3b41242b5775fd924 (patch)
treec20f7b856e8bb08b40b41bbab3afe6b9a0ff41f2 /rootston/cursor.c
parentec11a95d0c945d138cede66b7c6e53e343c82f8f (diff)
Fix moving views when resizing below min size
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: