From 13d4fa8d86d6526d98a223f5505b6dc75578eba9 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Mon, 24 Jun 2024 14:09:08 +0300 Subject: [PATCH] select: fix clamping for transformed outputs --- src/select.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/select.c b/src/select.c index 9c098cf..e5c8829 100644 --- a/src/select.c +++ b/src/select.c @@ -63,13 +63,13 @@ 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; + } else if (ptr_x > selection->output->transformed_width) { + ptr_x = selection->output->transformed_width; } if (ptr_y < 0) { ptr_y = 0; - } else if (ptr_y > selection->output->height) { - ptr_y = selection->output->height; + } else if (ptr_y > selection->output->transformed_height) { + ptr_y = selection->output->transformed_height; } int width = selection->width, height = selection->height; @@ -122,13 +122,13 @@ static void do_move(struct dp_selection *selection, int x, int y) { if (new_x < 0) { new_x = 0; - } else if (new_x > selection->output->width - selection->width) { - new_x = selection->output->width - selection->width; + } else if (new_x > selection->output->transformed_width - selection->width) { + new_x = selection->output->transformed_width - selection->width; } if (new_y < 0) { new_y = 0; - } else if (new_y > selection->output->height - selection->height) { - new_y = selection->output->height - selection->height; + } else if (new_y > selection->output->transformed_height - selection->height) { + new_y = selection->output->transformed_height - selection->height; } if (new_x == selection->x && new_y == selection->y) {