| 262 | } |
| 263 | |
| 264 | void 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) |
nothing calls this directly
no test coverage detected