1
0
mirror of https://codeberg.org/vyivel/dulcepan/ synced 2025-12-17 15:45:12 +02:00

select: clamp pointer position on resize

This commit is contained in:
Kirill Primak
2024-06-23 20:50:24 +03:00
parent eba288479e
commit a2d13cbdf8

View File

@@ -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) { 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; 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; int width = selection->width, height = selection->height;
retry_horiz: retry_horiz: