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

Method WindowProc

Engine/source/windowManager/win32/win32Window.cpp:707–959  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected