11 #include "guilib/DispResource.h" 12 #include "threads/CriticalSection.h" 13 #include "threads/SystemClock.h" 14 #include "windowing/WinSystem.h" 19 static const DWORD WINDOWED_STYLE = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
20 static const DWORD WINDOWED_EX_STYLE = NULL;
21 static const DWORD FULLSCREEN_WINDOW_STYLE = WS_POPUP | WS_SYSMENU | WS_CLIPCHILDREN;
22 static const DWORD FULLSCREEN_WINDOW_EX_STYLE = WS_EX_APPWINDOW;
23 static const UINT ID_TIMER_HDR = 34
U;
28 WINDOW_STATE_FULLSCREEN = 1,
29 WINDOW_STATE_FULLSCREEN_WINDOW,
30 WINDOW_STATE_WINDOWED,
31 WINDOW_STATE_BORDERLESS
34 static const char* window_state_names[] =
38 "windowed fullscreen",
44 enum WINDOW_FULLSCREEN_STATE
46 WINDOW_FULLSCREEN_STATE_FULLSCREEN = WINDOW_STATE_FULLSCREEN,
47 WINDOW_FULLSCREEN_STATE_FULLSCREEN_WINDOW = WINDOW_STATE_FULLSCREEN_WINDOW
51 enum WINDOW_WINDOW_STATE
53 WINDOW_WINDOW_STATE_WINDOWED = WINDOW_STATE_WINDOWED,
54 WINDOW_WINDOW_STATE_BORDERLESS = WINDOW_STATE_BORDERLESS
68 std::wstring MonitorNameW;
69 std::wstring CardNameW;
70 std::wstring DeviceNameW;
71 std::wstring DeviceStringW;
83 bool InitWindowSystem()
override;
84 bool DestroyWindowSystem()
override;
85 bool ResizeWindow(
int newWidth,
int newHeight,
int newLeft,
int newTop)
override;
86 void FinishWindowResize(
int newWidth,
int newHeight)
override;
88 void UpdateResolutions()
override;
89 bool CenterWindow()
override;
90 virtual void NotifyAppFocusChange(
bool bGaining)
override;
91 void ShowOSMouse(
bool show)
override;
92 bool HasInertialGestures()
override {
return true; }
93 bool Minimize()
override;
94 bool Restore()
override;
96 bool Show(
bool raise =
true)
override;
97 std::string GetClipboardText()
override;
98 bool UseLimitedColor()
override;
99 bool HasSystemSdrPeakLuminance()
override;
104 bool SetFullScreen(
bool fullScreen,
RESOLUTION_INFO& res,
bool blankOtherDisplays)
override;
106 std::vector<std::string> GetConnectedOutputs()
override;
109 HWND GetHwnd()
const {
return m_hWnd; }
110 bool IsAlteringWindow()
const {
return m_IsAlteringWindow; }
111 void SetAlteringWindow(
bool altering) { m_IsAlteringWindow = altering; }
112 bool IsTogglingHDR()
const {
return m_IsTogglingHDR; }
113 void SetTogglingHDR(
bool toggling);
114 virtual bool DPIChanged(WORD dpi, RECT windowRect)
const;
115 bool IsMinimized()
const {
return m_bMinimized; }
116 void SetMinimized(
bool minimized);
117 float GetGuiSdrPeakLuminance()
const;
118 void CacheSystemSdrPeakLuminance();
120 void SetSizeMoveMode(
bool mode) { m_bSizeMoveEnabled = mode; }
121 bool IsInSizeMoveMode()
const {
return m_bSizeMoveEnabled; }
124 bool MessagePump()
override;
127 bool CreateNewWindow(
const std::string& name,
bool fullScreen,
RESOLUTION_INFO& res)
override = 0;
128 virtual void UpdateStates(
bool fullScreen);
129 WINDOW_STATE GetState(
bool fullScreen)
const;
130 virtual void SetDeviceFullScreen(
bool fullScreen,
RESOLUTION_INFO& res) = 0;
131 virtual void ReleaseBackBuffer() = 0;
132 virtual void CreateBackBuffer() = 0;
133 virtual void ResizeDeviceBuffers() = 0;
134 virtual bool IsStereoEnabled() = 0;
135 virtual void OnScreenChange(HMONITOR monitor) = 0;
136 virtual void AdjustWindow(
bool forceResize =
false);
137 void CenterCursor()
const;
142 virtual bool ChangeResolution(
const RESOLUTION_INFO& res,
bool forceChange =
false);
143 virtual bool CreateBlankWindows();
144 virtual bool BlankNonActiveMonitors(
bool bBlank);
148 RECT ScreenRect(HMONITOR handle);
149 void GetConnectedDisplays(std::vector<MONITOR_DETAILS>& outputs);
158 void OnDisplayLost();
159 void OnDisplayReset();
160 void OnDisplayBack();
161 void ResolutionChanged();
162 static void SetForegroundWindowInternal(HWND hWnd);
163 static RECT GetVirtualScreenRect();
167 RECT GetScreenWorkArea(HMONITOR handle)
const;
173 RECT GetNcAreaOffsets(DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
const;
178 std::vector<HWND> m_hBlankWindows;
179 HINSTANCE m_hInstance;
181 bool m_ValidWindowedPosition;
182 bool m_IsAlteringWindow;
183 bool m_IsTogglingHDR{
false};
185 CCriticalSection m_resourceSection;
186 std::vector<IDispResource*> m_resources;
187 bool m_delayDispReset;
190 WINDOW_STATE m_state;
191 WINDOW_FULLSCREEN_STATE m_fullscreenState;
192 WINDOW_WINDOW_STATE m_windowState;
194 DWORD m_windowExStyle;
197 bool m_bSizeMoveEnabled =
false;
198 bool m_bFirstResChange =
true;
199 std::unique_ptr<CIRServerSuite> m_irss;
200 std::vector<MONITOR_DETAILS> m_displays;
202 NOTIFYICONDATA m_trayIcon = {};
204 static const char* SETTING_WINDOW_TOP;
205 static const char* SETTING_WINDOW_LEFT;
207 bool m_validSystemSdrPeakLuminance{
false};
208 float m_systemSdrPeakLuminance{.0f};
Definition: WinSystemWin10.h:53
Definition: WinSystem.h:49
Definition: SystemClock.h:31
Definition: DispResource.h:14
Provide info of a resolution.
Definition: Resolution.h:66
Definition: WinSystemWin32.h:76
Definition: VideoReferenceClock.h:19
#define U(j)
uj for division
Definition: bigint.c:73
Definition: IRServerSuite.h:20