|
25 | 25 | #include "xrSASH.h" |
26 | 26 | #include "IGame_Persistent.h" |
27 | 27 | #include "xrScriptEngine/ScriptExporter.hpp" |
| 28 | +#include "xr_input.h" |
28 | 29 |
|
29 | 30 | ENGINE_API CRenderDevice Device; |
30 | 31 | ENGINE_API CLoadScreenRenderer load_screen_renderer; |
@@ -444,23 +445,35 @@ BOOL CRenderDevice::Paused() { return g_pauseMngr()->Paused(); } |
444 | 445 | void CRenderDevice::OnWM_Activate(WPARAM wParam, LPARAM /*lParam*/) |
445 | 446 | { |
446 | 447 | u16 fActive = LOWORD(wParam); |
447 | | - BOOL fMinimized = (BOOL)HIWORD(wParam); |
448 | | - BOOL bActive = ((fActive != WA_INACTIVE) && (!fMinimized)) ? TRUE : FALSE; |
449 | | - if (bActive != Device.b_is_Active) |
| 448 | + const BOOL fMinimized = (BOOL)HIWORD(wParam); |
| 449 | + |
| 450 | + const BOOL isWndActive = (fActive != WA_INACTIVE && !fMinimized) ? TRUE : FALSE; |
| 451 | + if (!editor() && !GEnv.isDedicatedServer && isWndActive) |
| 452 | + { |
| 453 | + pInput->ClipCursor(true); |
| 454 | + ShowCursor(FALSE); |
| 455 | + } |
| 456 | + else |
| 457 | + { |
| 458 | + pInput->ClipCursor(false); |
| 459 | + ShowCursor(TRUE); |
| 460 | + } |
| 461 | + |
| 462 | + extern int ps_always_active; |
| 463 | + const BOOL isGameActive = ps_always_active || isWndActive; |
| 464 | + |
| 465 | + if (isGameActive != Device.b_is_Active) |
450 | 466 | { |
451 | | - Device.b_is_Active = bActive; |
| 467 | + Device.b_is_Active = isGameActive; |
452 | 468 | if (Device.b_is_Active) |
453 | 469 | { |
454 | 470 | Device.seqAppActivate.Process(rp_AppActivate); |
455 | 471 | app_inactive_time += TimerMM.GetElapsed_ms() - app_inactive_time_start; |
456 | | - if (!editor() && !GEnv.isDedicatedServer) |
457 | | - ShowCursor(FALSE); |
458 | 472 | } |
459 | 473 | else |
460 | 474 | { |
461 | 475 | app_inactive_time_start = TimerMM.GetElapsed_ms(); |
462 | 476 | Device.seqAppDeactivate.Process(rp_AppDeactivate); |
463 | | - ShowCursor(TRUE); |
464 | 477 | } |
465 | 478 | } |
466 | 479 | } |
|
0 commit comments