mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
util/box: Calculation error of wlr_box_closest_point in multi-screen mode
In multi-screen mode, when the mouse is on the first screen (default position (100,100)), when the first mask is removed, box is (1920,0). If you directly assign *dest_x = box->x, the mouse position on the second screen will become (1920,100), which is wrong. When x < box->x, x should also be added to box, and y should be the same.
This commit is contained in:
parent
4da4269d8f
commit
5c2ce751b7
1 changed files with 2 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
|
||||||
|
|
||||||
// find the closest x point
|
// find the closest x point
|
||||||
if (x < box->x) {
|
if (x < box->x) {
|
||||||
*dest_x = box->x;
|
*dest_x = box->x + x - 1/65536.0;
|
||||||
} else if (x > box->x + box->width - 1/65536.0) {
|
} else if (x > box->x + box->width - 1/65536.0) {
|
||||||
*dest_x = box->x + box->width - 1/65536.0;
|
*dest_x = box->x + box->width - 1/65536.0;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -35,7 +35,7 @@ void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
|
||||||
|
|
||||||
// find closest y point
|
// find closest y point
|
||||||
if (y < box->y) {
|
if (y < box->y) {
|
||||||
*dest_y = box->y;
|
*dest_y = box->y + y - 1/65536.0;
|
||||||
} else if (y > box->y + box->height - 1/65536.0) {
|
} else if (y > box->y + box->height - 1/65536.0) {
|
||||||
*dest_y = box->y + box->height - 1/65536.0;
|
*dest_y = box->y + box->height - 1/65536.0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue