MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetBorderless

Method SetBorderless

Source/Engine/Platform/Windows/WindowsWindow.cpp:264–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264void WindowsWindow::SetBorderless(bool isBorderless, bool maximized)
265{
266 ASSERT(HasHWND());
267
268 if (IsFullscreen())
269 SetIsFullscreen(false);
270
271 // Fixes issue of borderless window not going full screen
272 if (IsMaximized())
273 Restore();
274
275 _settings.HasBorder = !isBorderless;
276
277 BringToFront();
278
279 if (isBorderless)
280 {
281 LONG lStyle = GetWindowLong(_handle, GWL_STYLE);
282 lStyle &= ~(WS_THICKFRAME | WS_SYSMENU | WS_OVERLAPPED | WS_BORDER | WS_CAPTION);
283 lStyle |= WS_POPUP;
284 lStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
285#if WINDOWS_USE_NEW_BORDER_LESS
286 if (_settings.Type == WindowType::Regular)
287 style |= WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP;
288#elif WINDOWS_USE_NEWER_BORDER_LESS
289 if (_settings.Type == WindowType::Regular)
290 lStyle |= WS_THICKFRAME | WS_SYSMENU;
291#endif
292
293 SetWindowLong(_handle, GWL_STYLE, lStyle);
294 SetWindowPos(_handle, HWND_TOP, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
295
296 if (maximized)
297 {
298 ShowWindow(_handle, SW_SHOWMAXIMIZED);
299 }
300 else
301 {
302 ShowWindow(_handle, SW_SHOW);
303 }
304 }
305 else
306 {
307 LONG lStyle = GetWindowLong(_handle, GWL_STYLE);
308 lStyle &= ~(WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
309 if (_settings.AllowMaximize)
310 lStyle |= WS_MAXIMIZEBOX;
311 if (_settings.AllowMinimize)
312 lStyle |= WS_MINIMIZEBOX;
313 if (_settings.HasSizingFrame)
314 lStyle |= WS_THICKFRAME;
315 lStyle |= WS_OVERLAPPED | WS_SYSMENU | WS_BORDER | WS_CAPTION;
316
317 SetWindowLong(_handle, GWL_STYLE, lStyle);
318 const Float2 clientSize = GetClientSize();
319 const Float2 desktopSize = Platform::GetDesktopSize();
320 // Move window and half size if it is larger than desktop size
321 if (clientSize.X >= desktopSize.X && clientSize.Y >= desktopSize.Y)

Callers

nothing calls this directly

Calls 5

RestoreFunction · 0.85
BringToFrontFunction · 0.85
GetClientSizeFunction · 0.85
MaximizeFunction · 0.85
HasHWNDFunction · 0.70

Tested by

no test coverage detected