diff --git a/src/xenia/ui/window.h b/src/xenia/ui/window.h index 204b716cd..1e71e2d9b 100644 --- a/src/xenia/ui/window.h +++ b/src/xenia/ui/window.h @@ -53,6 +53,9 @@ class Window { virtual bool is_fullscreen() const { return false; } virtual void ToggleFullscreen(bool fullscreen) {} + virtual bool is_bordered() const { return false; } + virtual void SetBordered(bool enabled) {} + bool has_focus() const { return has_focus_; } virtual void set_focus(bool value) { has_focus_ = value; } diff --git a/src/xenia/ui/window_win.cc b/src/xenia/ui/window_win.cc index 622a2b680..7be2b1128 100644 --- a/src/xenia/ui/window_win.cc +++ b/src/xenia/ui/window_win.cc @@ -159,8 +159,7 @@ bool Win32Window::set_title(const std::wstring& title) { } bool Win32Window::is_fullscreen() const { - DWORD style = GetWindowLong(hwnd_, GWL_STYLE); - return (style & WS_OVERLAPPEDWINDOW) != WS_OVERLAPPEDWINDOW; + return fullscreen_; } void Win32Window::ToggleFullscreen(bool fullscreen) { @@ -168,6 +167,8 @@ void Win32Window::ToggleFullscreen(bool fullscreen) { return; } + fullscreen_ = fullscreen; + DWORD style = GetWindowLong(hwnd_, GWL_STYLE); if (fullscreen) { // Kill our borders and resize to take up entire primary monitor. @@ -195,6 +196,25 @@ void Win32Window::ToggleFullscreen(bool fullscreen) { } } +bool Win32Window::is_bordered() const { + DWORD style = GetWindowLong(hwnd_, GWL_STYLE); + return (style & WS_OVERLAPPEDWINDOW) == WS_OVERLAPPEDWINDOW; +} + +void Win32Window::SetBordered(bool enabled) { + if (is_fullscreen()) { + // Don't screw with the borders if we're fullscreen. + return; + } + + DWORD style = GetWindowLong(hwnd_, GWL_STYLE); + if (enabled) { + SetWindowLong(hwnd_, GWL_STYLE, style | WS_OVERLAPPEDWINDOW); + } else { + SetWindowLong(hwnd_, GWL_STYLE, style & ~WS_OVERLAPPEDWINDOW); + } +} + void Win32Window::set_cursor_visible(bool value) { if (is_cursor_visible_ == value) { return; diff --git a/src/xenia/ui/window_win.h b/src/xenia/ui/window_win.h index 9fa6c9884..fa7236eb1 100644 --- a/src/xenia/ui/window_win.h +++ b/src/xenia/ui/window_win.h @@ -34,6 +34,9 @@ class Win32Window : public Window { bool is_fullscreen() const override; void ToggleFullscreen(bool fullscreen) override; + bool is_bordered() const override; + void SetBordered(bool enabled) override; + void set_cursor_visible(bool value) override; void set_focus(bool value) override; @@ -65,6 +68,7 @@ class Win32Window : public Window { HWND hwnd_ = nullptr; bool closing_ = false; + bool fullscreen_ = false; WINDOWPLACEMENT windowed_pos_; };