diff --git a/src/select.c b/src/select.c index ce0aa2d..60d5771 100644 --- a/src/select.c +++ b/src/select.c @@ -59,6 +59,17 @@ static void update_action(struct dp_selection *selection, struct dp_output *outp static void do_resize(struct dp_selection *selection, int x, int y) { int ptr_x = x - selection->ptr_off_x, ptr_y = y - selection->ptr_off_y; + if (ptr_x < 0) { + ptr_x = 0; + } else if (ptr_x > selection->output->width) { + ptr_x = selection->output->width; + } + if (ptr_y < 0) { + ptr_y = 0; + } else if (ptr_y > selection->output->height) { + ptr_y = selection->output->height; + } + int width = selection->width, height = selection->height; retry_horiz: