MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / WindowProc

Method WindowProc

Engine/source/windowManager/win32/win32Window.cpp:706–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

704}
705
706LRESULT PASCAL Win32Window::WindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
707{
708 // CodeReview [tom, 4/30/2007] The two casts here seem somewhat silly and redundant ?
709 Win32Window* window = (Win32Window*)((PlatformWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA));
710 const WindowId devId = window ? window->getWindowId() : 0;
711
712 if (window && window->getOffscreenRender())
713 return DefWindowProc(hWnd, message, wParam, lParam);
714
715 switch (message)
716 {
717
718 case WM_DISPLAYCHANGE:
719 // Update the monitor list
720 PlatformWindowManager::get()->buildMonitorsList();
721
722 if(window && window->isVisible() && !window->mSuppressReset && window->getVideoMode().bitDepth != wParam)
723 {
724 Con::warnf("Win32Window::WindowProc - resetting device due to display mode BPP change.");
725 window->getGFXTarget()->resetMode();
726 }
727 break;
728
729 case WM_MOUSEACTIVATE:
730 SetFocus(hWnd);
731 return MA_ACTIVATE;
732
733 case WM_MOUSEMOVE:
734 if (window && GetFocus() != hWnd && IsChild(hWnd, GetFocus()))
735 {
736 SetFocus(hWnd);
737 break;
738 }
739
740 // If our foreground window is the browser and we don't have focus grab it
741 if (Platform::getWebDeployment() && GetFocus() != hWnd)
742 {
743 HWND phwnd = GetParent(hWnd);
744 while (phwnd)
745 {
746 if (GetForegroundWindow() == phwnd)
747 {
748 SetFocus(hWnd);
749 break;
750 }
751 phwnd = GetParent(phwnd);
752 }
753 }
754 break;
755
756 // Associate the window pointer with this window
757 case WM_CREATE:
758 // CodeReview [tom, 4/30/2007] Why don't we just cast this to a LONG
759 // instead of having a ton of essentially pointless casts ?
760 SetWindowLongPtr(hWnd, GWLP_USERDATA,
761 (LONG_PTR)((PlatformWindow*)((CREATESTRUCT*)lParam)->lpCreateParams));
762 break;
763

Callers

nothing calls this directly

Calls 15

DispatchFunction · 0.85
IsPlayingFunction · 0.85
IsDispatchingFunction · 0.85
getOffscreenRenderMethod · 0.80
isSizeLockedMethod · 0.80
getLockedSizeMethod · 0.80
allowRenderMethod · 0.80
onMenuSelectMethod · 0.80
getFunction · 0.50
warnfFunction · 0.50
getWindowIdMethod · 0.45
buildMonitorsListMethod · 0.45

Tested by

no test coverage detected