Fix moving views when resizing below min size

This commit is contained in:
emersion 2017-11-03 14:49:15 +01:00
parent ec11a95d0c
commit cf713edc10
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
6 changed files with 159 additions and 66 deletions

View file

@ -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: