Skip to content

Commit d42849d

Browse files
authored
Reintroduce Keyboard resize fix (Kenix3#385)
Shouldn't break now with with proper DPI awareness on windows
1 parent 6a83dbf commit d42849d

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

src/graphic/Fast3D/gfx_dxgi.cpp

+3-30
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ using namespace Microsoft::WRL; // For ComPtr
4242

4343
static struct {
4444
HWND h_wnd;
45-
bool in_paint;
46-
bool recursive_paint_detected;
4745

4846
// These four only apply in windowed mode.
4947
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
342340
dxgi.is_running = false;
343341
}
344342
break;
345-
346-
case WM_PAINT:
347-
if (dxgi.in_paint) {
348-
dxgi.recursive_paint_detected = true;
349-
return DefWindowProcW(h_wnd, message, w_param, l_param);
350-
} else {
351-
if (dxgi.run_one_game_iter != nullptr) {
352-
dxgi.in_paint = true;
353-
dxgi.run_one_game_iter();
354-
dxgi.in_paint = false;
355-
if (dxgi.recursive_paint_detected) {
356-
dxgi.recursive_paint_detected = false;
357-
InvalidateRect(h_wnd, nullptr, false);
358-
UpdateWindow(h_wnd);
359-
}
360-
}
361-
}
362-
break;
363-
364343
case WM_ACTIVATEAPP:
365344
if (dxgi.on_all_keys_up != nullptr) {
366345
dxgi.on_all_keys_up();
@@ -517,15 +496,9 @@ static void gfx_dxgi_set_keyboard_callbacks(bool (*on_key_down)(int scancode), b
517496

518497
static void gfx_dxgi_main_loop(void (*run_one_game_iter)(void)) {
519498
dxgi.run_one_game_iter = run_one_game_iter;
520-
MSG msg;
521-
while (GetMessage(&msg, nullptr, 0, 0) && dxgi.is_running) {
522-
TranslateMessage(&msg);
523-
DispatchMessage(&msg);
524-
}
525-
/* dxgi.run_one_game_iter = run_one_game_iter;
526499
while (dxgi.is_running) {
527500
dxgi.run_one_game_iter();
528-
}*/
501+
}
529502
}
530503

531504
static void gfx_dxgi_get_dimensions(uint32_t* width, uint32_t* height, int32_t* posX, int32_t* posY) {
@@ -536,15 +509,15 @@ static void gfx_dxgi_get_dimensions(uint32_t* width, uint32_t* height, int32_t*
536509
}
537510

538511
static void gfx_dxgi_handle_events(void) {
539-
/* MSG msg;
512+
MSG msg;
540513
while (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE)) {
541514
if (msg.message == WM_QUIT) {
542515
dxgi.is_running = false;
543516
break;
544517
}
545518
TranslateMessage(&msg);
546519
DispatchMessage(&msg);
547-
}*/
520+
}
548521
}
549522

550523
static uint64_t qpc_to_ns(uint64_t qpc) {

0 commit comments

Comments
 (0)