Set min view size to 1x1

This commit is contained in:
emersion 2017-11-20 11:10:43 +01:00
parent c0e2dc6f78
commit ac6385689f
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 13 additions and 13 deletions

View File

@ -69,37 +69,37 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
if (seat->focus) { if (seat->focus) {
double dx = cursor->cursor->x - cursor->offs_x; double dx = cursor->cursor->x - cursor->offs_x;
double dy = cursor->cursor->y - cursor->offs_y; double dy = cursor->cursor->y - cursor->offs_y;
double active_x = seat->focus->x; double x = seat->focus->x;
double active_y = seat->focus->y; double y = seat->focus->y;
int width = cursor->view_width; int width = cursor->view_width;
int height = cursor->view_height; int height = cursor->view_height;
if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) { if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
active_y = cursor->view_y + dy; y = cursor->view_y + dy;
height -= dy; height -= dy;
if (height < 0) { if (height < 1) {
active_y += height; y += height;
} }
} else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) { } else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
height += dy; height += dy;
} }
if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) { if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
active_x = cursor->view_x + dx; x = cursor->view_x + dx;
width -= dx; width -= dx;
if (width < 0) { if (width < 1) {
active_x += width; x += width;
} }
} else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) { } else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
width += dx; width += dx;
} }
if (width < 0) { if (width < 1) {
width = 0; width = 1;
} }
if (height < 0) { if (height < 1) {
height = 0; height = 1;
} }
view_move_resize(seat->focus, active_x, active_y, width, height); view_move_resize(seat->focus, x, y, width, height);
} }
break; break;
case ROOTS_CURSOR_ROTATE: case ROOTS_CURSOR_ROTATE: