[0.4.14][NTUSER][3DTEXT] Squashed backport CORE-17866, CORE-8217

The main part in [USER32] was already committed into 0.4.14-RC-123-g 75e9ac7727
but we do have two follow-ups that are worth picking as well:
---------------------
[NTUSER] Do not remove message from the Msg Queue if it is not for us. (#4129)

CORE-8217 This part of the fix keeps the buttons working (Cancel/Ok/top-Right-X) even under high CPU-load
Patch from 'I_Kill_Bugs' contributor.

Fix picked from 0.4.15-dev-3499-g 7d1b50394b
---------------------
[3DTEXT] Fix 3dtext.scr using near 100% CPU (#4125) CORE-17866, CORE-8217

Fix picked from 0.4.15-dev-3443-g 5c9fdcb1de
This commit is contained in:
Joachim Henze 2022-02-08 12:23:20 +01:00
parent 44b7f9f470
commit 1b0b8527eb
2 changed files with 18 additions and 2 deletions

View file

@ -41,6 +41,9 @@ GLfloat extentY = 0.0f;
HINSTANCE hInstance;
BOOL fullscreen = FALSE;
UINT uTimerID; // SetTimer Actual ID
#define APP_TIMER 1 // Graphics Update Timer ID
#define APP_TIMER_INTERVAL (USER_TIMER_MINIMUM * 5) // Graphics Update Interval
// Build Our Bitmap Font
GLvoid BuildFont(GLvoid)
@ -181,7 +184,7 @@ GLvoid InitGL(GLsizei Width, GLsizei Height)
}
// Handles Window Resizing
GLvoid ReSizeGLScene(GLsizei Width, GLsizei Height)
GLvoid ReSizeGLScene(GLsizei Width, GLsizei Height)
{
// Is Window Too Small (Divide By Zero Error)
if (Height == 0)
@ -338,12 +341,18 @@ ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// Initialize The GL Screen Using Screen Info
InitGL(Screen.right, Screen.bottom);
// Create Graphics update timer
uTimerID = SetTimer(hWnd, APP_TIMER, APP_TIMER_INTERVAL, NULL);
break;
case WM_DESTROY:
// Disable Fullscreen Mode
ChangeDisplaySettings(NULL, 0);
// Delete the Update Timer
KillTimer(hWnd, uTimerID);
// Deletes The Font Display List
KillFont();
@ -360,6 +369,8 @@ ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_PAINT:
DrawGLScene();
SwapBuffers(hDC);
// Mark this window as updated, so the OS won't ask us to update it again.
ValidateRect(hWnd, NULL);
break;
case WM_SIZE: // Resizing The Screen
@ -367,6 +378,11 @@ ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
ReSizeGLScene(LOWORD(lParam), HIWORD(lParam));
break;
case WM_TIMER:
// Used to update graphic based on timer udpate interval
InvalidateRect(hWnd, NULL, TRUE);
break;
default:
// Pass Windows Messages to the default screensaver window procedure
return DefScreenSaverProc(hWnd, message, wParam, lParam);

View file

@ -1524,7 +1524,7 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, BOOL* NotForUs, L
{
// This is not for us and we should leave so the other thread can check for messages!!!
*NotForUs = TRUE;
*RemoveMessages = TRUE;
*RemoveMessages = FALSE;
return FALSE;
}