MCPcopy Create free account
hub / github.com/bwapi/bwapi / WindowProc

Function WindowProc

bwapi/BWAPI/Source/WMode.cpp:223–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
224{
225 if ( wmode )
226 {
227 // Perform W-Mode only functionality
228 switch ( uMsg )
229 {
230 case WM_SIZING:
231 {
232 SIZE border;
233 GetBorderSize(hWnd, &border);
234
235 RECT *rct = (RECT*)lParam;
236 SIZE ws = { rct->right - rct->left - border.cx, rct->bottom - rct->top - border.cy };
237 if ( ws.cx < WMODE_MIN_WIDTH )
238 {
239 ws.cx = WMODE_MIN_WIDTH;
240 CorrectWindowWidth(wParam, &ws, rct, &border);
241 }
242 if ( ws.cy < WMODE_MIN_HEIGHT )
243 {
244 ws.cy = WMODE_MIN_HEIGHT;
245 CorrectWindowHeight(wParam, &ws, rct, &border);
246 }
247
248 if ( GetKeyState(VK_CONTROL) & 0x8000 && ws.cy != ws.cx * 3 / 4 )
249 {
250 if ( wParam == WMSZ_TOP || wParam == WMSZ_BOTTOM )
251 {
252 ws.cx = ws.cy * 4 / 3;
253 CorrectWindowWidth(WMSZ_RIGHT, &ws, rct, &border);
254 }
255 else
256 {
257 ws.cy = ws.cx * 3 / 4;
258 CorrectWindowHeight( (wParam == WMSZ_RIGHT || wParam == WMSZ_LEFT) ? WMSZ_BOTTOM : wParam, &ws, rct, &border);
259 }
260 }
261
262 if ( isCorrectVersion ) // must be correct version to reference BWDATA
263 {
264 if ( ws.cx >= BW::BWDATA::GameScreenBuffer.width() - WMODE_SNAP_RANGE &&
265 ws.cx <= BW::BWDATA::GameScreenBuffer.width() + WMODE_SNAP_RANGE )
266 {
267 ws.cx = BW::BWDATA::GameScreenBuffer.width();
268 CorrectWindowWidth( (wParam == WMSZ_TOP || wParam == WMSZ_BOTTOM) ? WMSZ_RIGHT : wParam, &ws, rct, &border);
269 }
270 if ( ws.cy >= BW::BWDATA::GameScreenBuffer.height() - WMODE_SNAP_RANGE &&
271 ws.cy <= BW::BWDATA::GameScreenBuffer.height() + WMODE_SNAP_RANGE )
272 {
273 ws.cy = BW::BWDATA::GameScreenBuffer.height();
274 CorrectWindowHeight( (wParam == WMSZ_RIGHT || wParam == WMSZ_LEFT) ? WMSZ_BOTTOM : wParam, &ws, rct, &border);
275 }
276 }
277 break;
278 } // case WM_SIZING
279 case WM_SIZE:
280 {

Callers

nothing calls this directly

Calls 11

GetBorderSizeFunction · 0.85
CorrectWindowWidthFunction · 0.85
CorrectWindowHeightFunction · 0.85
WriteConfigFunction · 0.85
SetCursorShowStateFunction · 0.85
FixPointsFunction · 0.85
SetWModeFunction · 0.85
ButtonEventFunction · 0.85
RegisterThreadNameFunction · 0.85
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected