Skip to content

Commit 4b12977

Browse files
committed
bugfix: fixed setcursor dx/dy variable values
1 parent 09da4df commit 4b12977

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/osdep/amiberry.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ int sleep_millis(const int ms)
448448

449449
static void setcursor(AmigaMonitor* mon, int oldx, int oldy)
450450
{
451-
const int dx = (mon->amigawinclip_rect.x - mon->amigawin_rect.x) + ((mon->amigawinclip_rect.x + mon->amigawinclip_rect.w) - mon->amigawinclip_rect.x) / 2;
452-
const int dy = (mon->amigawinclip_rect.y - mon->amigawin_rect.y) + ((mon->amigawinclip_rect.y + mon->amigawinclip_rect.h) - mon->amigawinclip_rect.y) / 2;
451+
const int dx = (mon->amigawinclip_rect.x - mon->amigawin_rect.x) + (mon->amigawinclip_rect.w) / 2;
452+
const int dy = (mon->amigawinclip_rect.y - mon->amigawin_rect.y) + (mon->amigawinclip_rect.h) / 2;
453453
mon->mouseposx = oldx - dx;
454454
mon->mouseposy = oldy - dy;
455455

@@ -471,14 +471,14 @@ static void setcursor(AmigaMonitor* mon, int oldx, int oldy)
471471
}
472472
mon->mouseposx = mon->mouseposy = 0;
473473
if (oldx < 0 || oldy < 0 || oldx > mon->amigawin_rect.w || oldy > mon->amigawin_rect.h) {
474-
write_log(_T("Mouse out of range: mon=%d %dx%d (%dx%d %dx%d)\n"), mon->monitor_id, oldx, oldy,
474+
write_log("Mouse out of range: mon=%d %dx%d (%dx%d %dx%d)\n", mon->monitor_id, oldx, oldy,
475475
mon->amigawin_rect.x, mon->amigawin_rect.y, mon->amigawin_rect.w, mon->amigawin_rect.h);
476476
return;
477477
}
478478
const int cx = mon->amigawinclip_rect.w / 2 + mon->amigawin_rect.x + (mon->amigawinclip_rect.x - mon->amigawin_rect.x);
479479
const int cy = mon->amigawinclip_rect.h / 2 + mon->amigawin_rect.y + (mon->amigawinclip_rect.y - mon->amigawin_rect.y);
480480

481-
SDL_WarpMouseGlobal(cx, cy);
481+
SDL_WarpMouseInWindow(nullptr, cx, cy);
482482
}
483483

484484
static int mon_cursorclipped;

0 commit comments

Comments
 (0)