Browse Source

sokol_app.h d3d11: implement workaround for 0.5sec freeze at start of window movement

see https://gamedev.net/forums/topic/672094-keeping-things-moving-during-win32-moveresize-events/5254386/
Andre Weissflog 3 years ago
parent
commit
c9a3614632
1 changed files with 11 additions and 0 deletions
  1. 11 0
      sokol_app.h

+ 11 - 0
sokol_app.h

@@ -6601,6 +6601,17 @@ _SOKOL_PRIVATE LRESULT CALLBACK _sapp_win32_wndproc(HWND hWnd, UINT uMsg, WPARAM
                 }
                 */
                 break;
+            case WM_NCLBUTTONDOWN:
+                /* workaround for half-second pause when starting to move window
+                    see: https://gamedev.net/forums/topic/672094-keeping-things-moving-during-win32-moveresize-events/5254386/
+                */
+                if (SendMessage(_sapp.win32.hwnd, WM_NCHITTEST, wParam, lParam) == HTCAPTION) {
+                    POINT point;
+                    GetCursorPos(&point);
+                    ScreenToClient(_sapp.win32.hwnd, &point);
+                    PostMessage(_sapp.win32.hwnd, WM_MOUSEMOVE, 0, point.x|(point.y << 16));
+                }
+                break;
             case WM_DROPFILES:
                 _sapp_win32_files_dropped((HDROP)wParam);
                 break;