Index: Help/Help.vcxproj |
— | — | @@ -125,6 +125,8 @@ |
126 | 126 | <None Include="html\config\abouttab.htmltitle" />
|
127 | 127 | <None Include="html\config\advancedtab.htmlbody" />
|
128 | 128 | <None Include="html\config\advancedtab.htmltitle" />
|
| 129 | + <None Include="html\config\advanced\capturemouseinwindowmode.htmlbody" />
|
| 130 | + <None Include="html\config\advanced\capturemouseinwindowmode.htmltitle" />
|
129 | 131 | <None Include="html\config\advanced\defaultwindowposition.htmlbody" />
|
130 | 132 | <None Include="html\config\advanced\defaultwindowposition.htmltitle" />
|
131 | 133 | <None Include="html\config\advanced\dontautosizewindow.htmlbody" />
|
Index: Help/Help.vcxproj.filters |
— | — | @@ -501,5 +501,11 @@ |
502 | 502 | <None Include="html\config\debug\disablemousecursorhooks.htmlbody">
|
503 | 503 | <Filter>Help files\html\config\debug</Filter>
|
504 | 504 | </None>
|
| 505 | + <None Include="html\config\advanced\capturemouseinwindowmode.htmltitle">
|
| 506 | + <Filter>Help files\html\config\advanced</Filter>
|
| 507 | + </None>
|
| 508 | + <None Include="html\config\advanced\capturemouseinwindowmode.htmlbody">
|
| 509 | + <Filter>Help files\html\config\advanced</Filter>
|
| 510 | + </None>
|
505 | 511 | </ItemGroup>
|
506 | 512 | </Project> |
\ No newline at end of file |
Index: Help/dxgl.hhp |
— | — | @@ -70,6 +70,7 @@ |
71 | 71 | html\config\advanced\startresizablewindowmaximized.html
|
72 | 72 | html\config\advanced\textureaccessmethod.html
|
73 | 73 | html\config\advanced\textureformat.html
|
| 74 | +html\config\advanced\capturemouseinwindowmode.html
|
74 | 75 | html\config\debug\debugblenddestinationcolor.html
|
75 | 76 | html\config\debug\disablearbdirectstateaccess.html
|
76 | 77 | html\config\debug\disablearbframebuffers.html
|
Index: Help/html/config/advanced/capturemouseinwindowmode.htmlbody |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +<p><em>This option is available in DXGL 0.5.14 and newer.</em></p>
|
| 3 | +<p>Captures the mouse when you first click inside the application window in forced window mode. You can exit mouse capture by pressing and releasing the Ctrl and Alt keys together.</p> |
\ No newline at end of file |
Index: Help/html/config/advanced/capturemouseinwindowmode.htmltitle |
— | — | @@ -0,0 +1 @@ |
| 2 | +Capture mouse in window mode (Press Ctrl+Alt to release) |
\ No newline at end of file |
Index: Help/html/config/advancedtab.htmlbody |
— | — | @@ -30,5 +30,8 @@ |
31 | 31 | <a href="advanced/dontautosizewindow.html">Don't auto-size window in resizable window mode</a>
|
32 | 32 | </p>
|
33 | 33 | <p>
|
| 34 | + <a href="advanced/capturemouseinwindowmode.html">Capture mouse in window mode (Press Ctrl+Alt to release)</a>
|
| 35 | +</p>
|
| 36 | +<p>
|
34 | 37 | <a href="advanced/installationpath.html">Installation path</a>
|
35 | 38 | </p> |
\ No newline at end of file |
Index: Help/images/dxglcfg-advanced.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: Help/toc.hhc |
— | — | @@ -172,6 +172,10 @@ |
173 | 173 | <param name="Name" value="Installation path">
|
174 | 174 | <param name="Local" value="html\config\advanced\installationpath.html">
|
175 | 175 | </OBJECT>
|
| 176 | + <LI> <OBJECT type="text/sitemap">
|
| 177 | + <param name="Name" value="Capture mouse in window mode (Press Ctrl+Alt to release)">
|
| 178 | + <param name="Local" value="html\config\advanced\capturemouseinwindowmode.html">
|
| 179 | + </OBJECT>
|
176 | 180 | </UL>
|
177 | 181 | <LI> <OBJECT type="text/sitemap">
|
178 | 182 | <param name="Name" value="Debug Tab">
|
Index: ddraw/hooks.c |
— | — | @@ -55,6 +55,11 @@ |
56 | 56 | BOOL(WINAPI *_SetCursorPos)(int X, int Y) = NULL;
|
57 | 57 | HCURSOR(WINAPI *_SetCursor)(HCURSOR hCursor) = NULL;
|
58 | 58 | UINT wndhook_count = 0;
|
| 59 | +static BOOL keyctrlalt = FALSE;
|
| 60 | +static BOOL cursorclipped = FALSE;
|
| 61 | +static RECT rcOldClip;
|
| 62 | +static RECT rcClip;
|
| 63 | +static RECT rcWindow;
|
59 | 64 |
|
60 | 65 | int hwndhookcmp(const HWND_HOOK *key, const HWND_HOOK *cmp)
|
61 | 66 | {
|
— | — | @@ -292,8 +297,21 @@ |
293 | 298 | switch (uMsg)
|
294 | 299 | {
|
295 | 300 | case WM_DESTROY:
|
| 301 | + if (cursorclipped)
|
| 302 | + {
|
| 303 | + ClipCursor(NULL);
|
| 304 | + cursorclipped = FALSE;
|
| 305 | + }
|
296 | 306 | UninstallDXGLFullscreenHook(hWnd);
|
297 | 307 | break;
|
| 308 | + case WM_MOVE:
|
| 309 | + case WM_KILLFOCUS:
|
| 310 | + if (cursorclipped)
|
| 311 | + {
|
| 312 | + ClipCursor(NULL);
|
| 313 | + cursorclipped = FALSE;
|
| 314 | + }
|
| 315 | + break;
|
298 | 316 | case WM_ACTIVATEAPP:
|
299 | 317 | if (!wParam)
|
300 | 318 | {
|
— | — | @@ -398,6 +416,14 @@ |
399 | 417 | }
|
400 | 418 | break;
|
401 | 419 | case WM_SYSCOMMAND:
|
| 420 | + if ((wParam == SC_MOVE) || (wParam == SC_SIZE))
|
| 421 | + {
|
| 422 | + if (cursorclipped)
|
| 423 | + {
|
| 424 | + ClipCursor(NULL);
|
| 425 | + cursorclipped = FALSE;
|
| 426 | + }
|
| 427 | + }
|
402 | 428 | if (wParam == SC_RESTORE)
|
403 | 429 | {
|
404 | 430 | if (lpDD7 && (dxglcfg.fullmode < 2)) glDirectDraw7_UnrestoreDisplayMode(lpDD7);
|
— | — | @@ -404,6 +430,27 @@ |
405 | 431 | }
|
406 | 432 | break;
|
407 | 433 | case WM_LBUTTONDOWN:
|
| 434 | + if (dxglcfg.CaptureMouse)
|
| 435 | + {
|
| 436 | + if (!cursorclipped)
|
| 437 | + {
|
| 438 | + GetClipCursor(&rcOldClip);
|
| 439 | + ClipCursor(NULL);
|
| 440 | + GetClipCursor(&rcClip);
|
| 441 | + if (!memcmp(&rcOldClip, &rcClip, sizeof(RECT)))
|
| 442 | + {
|
| 443 | + // Cursor is not clipped
|
| 444 | + pt.x = 0;
|
| 445 | + pt.y = 0;
|
| 446 | + GetClientRect(hWnd, &rcWindow);
|
| 447 | + ClientToScreen(hWnd, &pt);
|
| 448 | + OffsetRect(&rcWindow, pt.x, pt.y);
|
| 449 | + ClipCursor(&rcWindow);
|
| 450 | + cursorclipped = TRUE;
|
| 451 | + }
|
| 452 | + else ClipCursor(&rcOldClip);
|
| 453 | + }
|
| 454 | + }
|
408 | 455 | if (lpDD7)
|
409 | 456 | {
|
410 | 457 | if (((dxglcfg.scaler != 0) || ((dxglcfg.fullmode >= 2) && (dxglcfg.fullmode <= 4)))
|
— | — | @@ -430,6 +477,38 @@ |
431 | 478 | else return CallWindowProc(parentproc, hWnd, uMsg, wParam, lParam);
|
432 | 479 | }
|
433 | 480 | else return CallWindowProc(parentproc, hWnd, uMsg, wParam, lParam);
|
| 481 | + case WM_KEYDOWN:
|
| 482 | + case WM_SYSKEYDOWN:
|
| 483 | + if (dxglcfg.CaptureMouse)
|
| 484 | + {
|
| 485 | + if (wParam == VK_CONTROL)
|
| 486 | + {
|
| 487 | + if (GetKeyState(VK_MENU)) keyctrlalt = TRUE;
|
| 488 | + }
|
| 489 | + if (wParam == VK_MENU)
|
| 490 | + {
|
| 491 | + if (GetKeyState(VK_CONTROL)) keyctrlalt = TRUE;
|
| 492 | + }
|
| 493 | + }
|
| 494 | + break;
|
| 495 | + case WM_KEYUP:
|
| 496 | + case WM_SYSKEYUP:
|
| 497 | + if (dxglcfg.CaptureMouse)
|
| 498 | + {
|
| 499 | + if ((wParam == VK_CONTROL) || (wParam == VK_MENU))
|
| 500 | + {
|
| 501 | + if (keyctrlalt)
|
| 502 | + {
|
| 503 | + keyctrlalt = FALSE;
|
| 504 | + if (cursorclipped)
|
| 505 | + {
|
| 506 | + ClipCursor(NULL);
|
| 507 | + cursorclipped = FALSE;
|
| 508 | + }
|
| 509 | + }
|
| 510 | + }
|
| 511 | + }
|
| 512 | + break;
|
434 | 513 | case WM_MOUSEMOVE:
|
435 | 514 | case WM_LBUTTONUP:
|
436 | 515 | case WM_LBUTTONDBLCLK:
|
— | — | @@ -502,6 +581,11 @@ |
503 | 582 | }
|
504 | 583 | else return CallWindowProc(parentproc, hWnd, uMsg, wParam, lParam);
|
505 | 584 | case WM_SIZE:
|
| 585 | + if (cursorclipped)
|
| 586 | + {
|
| 587 | + ClipCursor(NULL);
|
| 588 | + cursorclipped = FALSE;
|
| 589 | + }
|
506 | 590 | if (wParam != SIZE_MINIMIZED)
|
507 | 591 | {
|
508 | 592 | if (((dxglcfg.fullmode == 0) || (dxglcfg.fullmode == 1)) && lpDD7 && (dxglcfg.scaler != 0))
|