From 1ca7d0fa78013e49450a4a9881236a19a6600d64 Mon Sep 17 00:00:00 2001 From: Spodi Date: Thu, 1 Aug 2024 18:26:16 +0200 Subject: [PATCH] Reintroduce Keyboard resize fix (#385) (#649) Shouldn't break now with with proper DPI awareness on windows --- src/graphic/Fast3D/gfx_dxgi.cpp | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/src/graphic/Fast3D/gfx_dxgi.cpp b/src/graphic/Fast3D/gfx_dxgi.cpp index 66b9e1791..112866f48 100644 --- a/src/graphic/Fast3D/gfx_dxgi.cpp +++ b/src/graphic/Fast3D/gfx_dxgi.cpp @@ -42,8 +42,6 @@ using namespace Microsoft::WRL; // For ComPtr static struct { HWND h_wnd; - bool in_paint; - bool recursive_paint_detected; // These four only apply in windowed mode. uint32_t current_width, current_height; // Width and height of client areas @@ -342,25 +340,6 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par dxgi.is_running = false; } break; - - case WM_PAINT: - if (dxgi.in_paint) { - dxgi.recursive_paint_detected = true; - return DefWindowProcW(h_wnd, message, w_param, l_param); - } else { - if (dxgi.run_one_game_iter != nullptr) { - dxgi.in_paint = true; - dxgi.run_one_game_iter(); - dxgi.in_paint = false; - if (dxgi.recursive_paint_detected) { - dxgi.recursive_paint_detected = false; - InvalidateRect(h_wnd, nullptr, false); - UpdateWindow(h_wnd); - } - } - } - break; - case WM_ACTIVATEAPP: if (dxgi.on_all_keys_up != nullptr) { dxgi.on_all_keys_up(); @@ -517,15 +496,9 @@ static void gfx_dxgi_set_keyboard_callbacks(bool (*on_key_down)(int scancode), b static void gfx_dxgi_main_loop(void (*run_one_game_iter)(void)) { dxgi.run_one_game_iter = run_one_game_iter; - MSG msg; - while (GetMessage(&msg, nullptr, 0, 0) && dxgi.is_running) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - /* dxgi.run_one_game_iter = run_one_game_iter; while (dxgi.is_running) { dxgi.run_one_game_iter(); - }*/ + } } static void gfx_dxgi_get_dimensions(uint32_t* width, uint32_t* height, int32_t* posX, int32_t* posY) { @@ -536,7 +509,7 @@ static void gfx_dxgi_get_dimensions(uint32_t* width, uint32_t* height, int32_t* } static void gfx_dxgi_handle_events(void) { - /* MSG msg; + MSG msg; while (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { dxgi.is_running = false; @@ -544,7 +517,7 @@ static void gfx_dxgi_handle_events(void) { } TranslateMessage(&msg); DispatchMessage(&msg); - }*/ + } } static uint64_t qpc_to_ns(uint64_t qpc) {