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:
11
src/select.c
11
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) {
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user