From: Toni Wilen Date: Sun, 15 Sep 2024 14:55:04 +0000 (+0300) Subject: Do not unnecessarily call SetCursor() continuously. X-Git-Tag: 5310~19 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=138c269cc410c3ea4f90df2e54a20f2e23b19aca;p=francis%2Fwinuae.git Do not unnecessarily call SetCursor() continuously. --- diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 4fc5c2ef..8a7f616e 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -1900,9 +1900,6 @@ static int createwindowscursor(int monid, int set, int chipset) int hiressprite = sprite_0_width / 16; int ds = h * ((w + 15) / 16) * 4; if (!sprite_0 || !mousehack_alive() || w > CURSORMAXWIDTH || h > CURSORMAXHEIGHT || !valid_address(src, ds)) { - if (wincursor) { - SetCursor(normalcursor); - } goto exit; } int yy = 0; @@ -1958,6 +1955,8 @@ static int createwindowscursor(int monid, int set, int chipset) } } + wincursor = NULL; + write_log(_T("wincursor: %dx%d\n"), w, h); tmp_sprite_w = tmp_sprite_h = 0; @@ -2001,9 +2000,7 @@ end: DeleteDC(mainDC); ReleaseDC(NULL, DC); - if (!isdata) { - wincursor = LoadCursor(NULL, IDC_ARROW); - } else if (ret) { + if (isdata) { memset(&ic, 0, sizeof ic); ic.hbmColor = xorBM; ic.hbmMask = andBM; @@ -2026,19 +2023,21 @@ end: write_log(_T("RTG Windows color cursor creation failed\n")); } + if (oldwincursor) { + DestroyIcon(oldwincursor); + oldwincursor = NULL; + } + + return ret; + exit: - if (currprefs.input_tablet && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_magic_mouse_cursor == MAGICMOUSE_NATIVE_ONLY) { - if (GetCursor() != NULL) - SetCursor(NULL); - } else { - if (wincursor == oldwincursor && normalcursor != NULL) { + if (wincursor) { + if (GetCursor() == wincursor) { SetCursor(normalcursor); } + DestroyIcon(wincursor); + wincursor = NULL; } - if (oldwincursor) { - DestroyIcon(oldwincursor); - } - oldwincursor = NULL; return ret; }