Przeglądaj źródła

[rcore][win32] stop lying to the OS about when our window is updated

Instead of calling BeginPaint/EndPaint in WM_PAINT which signals to the
OS that our window content is updated, now when we encounter the WM_PAINT
message instead we return back to the raylib application which will
trigger it to render a new frame. We've replaced the call to BeginPaint
and EndPaint with a call to ValidateRect in SwapBuffers, which, means
we're now correctly telling the OS when our window content is actually
up-to-date.

Note that this doesn't fix the window content not being updated during
a window resize/move beacuse thos have their own message loop which
doesn't return early when it's time to paint.
pull/4869/head
Jonathan Marler 1 tydzień temu
rodzic
commit
c1165fd169
1 zmienionych plików z 7 dodań i 6 usunięć
  1. +7
    -6
      src/platforms/rcore_desktop_win32.c

+ 7
- 6
src/platforms/rcore_desktop_win32.c Wyświetl plik

@ -1439,6 +1439,11 @@ void SwapScreenBuffer(void)
LogFail("SwapBuffers", GetLastError());
abort();
}
if (!ValidateRect(global_hwnd, NULL)) {
LogFail("ValidateRect", GetLastError());
abort();
}
}
double GetTime(void)
@ -1551,6 +1556,8 @@ void PollInputEvents(void)
MSG msg;
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_PAINT)
return;
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
@ -1778,12 +1785,6 @@ static LRESULT WndProc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, Flags
}
return 0;
}
case WM_PAINT: {
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
return 0;
}
case WM_SETCURSOR:
if (LOWORD(lparam) == HTCLIENT) {
SetCursor(CORE.Input.Mouse.cursorHidden ? NULL : LoadCursorW(NULL, IDC_ARROW));

||||||
x
 
000:0
Ładowanie…
Anuluj
Zapisz