# HG changeset patch # User sam # Date 1718435687 -25200 # Node ID 558c76bb362cfab5fec4a6fbbec119fe8f4dd05a # Parent 4d9e345da77268016f4799742f472c8e89180c41 fix: windows cursor not visible on border 1 diff -r 4d9e345da772 -r 558c76bb362c semicongine/platform/windows/window.nim --- a/semicongine/platform/windows/window.nim Sat Jun 15 12:31:09 2024 +0700 +++ b/semicongine/platform/windows/window.nim Sat Jun 15 14:14:47 2024 +0700 @@ -22,6 +22,9 @@ if value == 0: raise newException(Exception, "Win32 error: " & astToStr(call) & " returned " & $value) +let andCursorMask = [0xff] +let xorCursorMask = [0x00] +let invisibleCursor = CreateCursor(0, 0, 1, 1, addr andCursorMask, addr xorCursorMask) proc MapLeftRightKeys(key: INT, lparam: LPARAM): INT = case key @@ -62,9 +65,8 @@ currentEvents.add(Event(eventType: events.MouseWheel, amount: float32(GET_WHEEL_DELTA_WPARAM(wParam)) / WHEEL_DELTA)) of WM_SETCURSOR: if LOWORD(lParam) == HTCLIENT: - ShowCursor(false) - else: - ShowCursor(true) + SetCursor(invisibleCursor) + return 0 else: return DefWindowProc(hwnd, uMsg, wParam, lParam) @@ -85,7 +87,8 @@ lpfnWndProc: WindowHandler, hInstance: result.hInstance, lpszClassName: windowClassName, - hcursor: LoadCursor(HINSTANCE(0), IDC_ARROW), + # hcursor: LoadCursor(HINSTANCE(0), IDC_ARROW), + hcursor: invisibleCursor, ) if(RegisterClassEx(addr(windowClass)) == 0): @@ -124,10 +127,12 @@ SetWindowPos(window.hwnd, HWND(0), 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER or SWP_NOOWNERZORDER or SWP_FRAMECHANGED) proc HideSystemCursor*(window: NativeWindow) = - discard ShowCursor(false) + discard + # discard ShowCursor(false) proc ShowSystemCursor*(window: NativeWindow) = - discard ShowCursor(true) + discard + # discard ShowCursor(true) proc Destroy*(window: NativeWindow) = discard