From 644a1f73e80034912ce91b18f70a9e51ce3edb2c Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 20 Dec 2025 11:59:16 +0200 Subject: [PATCH] Fix magic mouse positioning in some filter modes. --- drawing.cpp | 4 ++-- inputdevice.cpp | 6 +++--- od-win32/win32_scaler.cpp | 10 ++++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index 9cd9eb22..7e7097e1 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -584,7 +584,7 @@ int coord_native_to_amiga_y(int y) if (y >= native2amiga_line_map_height) { y = native2amiga_line_map_height - 1; } - return native2amiga_line_map[y] - minfirstline; + return native2amiga_line_map[y]; } void notice_screen_contents_lost(int monid) @@ -1074,7 +1074,7 @@ void get_custom_mouse_limits (int *pw, int *ph, int *pdx, int *pdy, int dbl) w = diwlastword_total - diwfirstword_total; dx = diwfirstword_total - visible_left_border; - y2 = plflastline_total; + y2 = plflastline_total + 1; y1 = plffirstline_total; if (minfirstline > y1) y1 = minfirstline; diff --git a/inputdevice.cpp b/inputdevice.cpp index 150558ea..e166df9f 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -2653,7 +2653,7 @@ static bool get_mouse_position(int *xp, int *yp, int inx, int iny) getgfxoffset(monid, &fdx, &fdy, &fmx, &fmy); - //write_log("%.2f*%.2f %.2f*%.2f\n", fdx, fdy, fmx, fmy); + //write_log("%d %d, %.2f*%.2f %.2f*%.2f\n", x, y, fdx, fdy, fmx, fmy); #ifdef PICASSO96 if (ad->picasso_on) { @@ -3353,8 +3353,6 @@ end: if (!ad->picasso_on) { int aw = 0, ah = 0, dx, dy; get_custom_mouse_limits(&aw, &ah, &dx, &dy, dimensioninfo_dbl); - x += dx; - y += dy; float dx2, dy2, mx2, my2; getgfxoffset(monid, &dx2, &dy2, &mx2, &my2); if (mx2) { @@ -3363,6 +3361,8 @@ end: if (my2) { y = (int)(y / my2); } + x += dx; + y += dy; x += (int)dx2; y += (int)dy2; } else { diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index a555dd26..42efaa0b 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -616,6 +616,11 @@ void getfilterdata(int monid, struct displayscale *ds) filteroffsetx = (float)-ds->xoffset / ds->scale; filteroffsety = (float)-ds->yoffset / ds->scale; + + diff = ds->outwidth; + filterxmult = ((float)ds->dstwidth * ds->scale) / diff; + diff = ds->outheight; + filterymult = ((float)ds->dstheight * ds->scale) / diff; goto end; } @@ -758,8 +763,9 @@ cont: filterxmult = xmult; filterymult = ymult; - filteroffsetx += (ds->dstwidth - ds->srcwidth * filterxmult) / 2; - filteroffsety += (ds->dstheight - ds->srcheight * filterymult) / 2; + + filteroffsetx = (float)-ds->xoffset / ds->scale; + filteroffsety = (float)-ds->yoffset / ds->scale; end: -- 2.47.3