Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtwindowsglobal.h
Go to the documentation of this file.
1// Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
2// Copyright (C) 2016 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QTWINDOWSGLOBAL_H
6#define QTWINDOWSGLOBAL_H
7
8#include <QtCore/qt_windows.h>
9#include <QtCore/qnamespace.h>
10
11#ifndef WM_DWMCOMPOSITIONCHANGED
12# define WM_DWMCOMPOSITIONCHANGED 0x31E
13#endif
14
15#ifndef WM_DWMCOLORIZATIONCOLORCHANGED
16# define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
17#endif
18
19#ifndef WM_SYSCOLORCHANGE
20# define WM_SYSCOLORCHANGE 0x0015
21#endif
22
23#ifndef WM_TOUCH
24# define WM_TOUCH 0x0240
25#endif
26
27#ifndef WM_GESTURE
28# define WM_GESTURE 0x0119
29#endif
30
31#ifndef WM_DPICHANGED
32# define WM_DPICHANGED 0x02E0
33#endif
34
35#ifndef WM_GETDPISCALEDSIZE
36# define WM_GETDPISCALEDSIZE 0x02E4
37#endif
38
39// WM_POINTER support from Windows 8 onwards (WINVER >= 0x0602)
40#ifndef WM_POINTERUPDATE
41# define WM_NCPOINTERUPDATE 0x0241
42# define WM_NCPOINTERDOWN 0x0242
43# define WM_NCPOINTERUP 0x0243
44# define WM_POINTERUPDATE 0x0245
45# define WM_POINTERDOWN 0x0246
46# define WM_POINTERUP 0x0247
47# define WM_POINTERENTER 0x0249
48# define WM_POINTERLEAVE 0x024A
49# define WM_POINTERACTIVATE 0x024B
50# define WM_POINTERCAPTURECHANGED 0x024C
51# define WM_POINTERWHEEL 0x024E
52# define WM_POINTERHWHEEL 0x024F
53#endif // WM_POINTERUPDATE
54
55#if !defined(_DPI_AWARENESS_CONTEXTS_)
56# define DPI_AWARENESS_CONTEXT_UNAWARE ((HANDLE)-1)
57# define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((HANDLE)-2)
58# define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((HANDLE)-3)
59# define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE)-4)
60# define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((HANDLE)-5)
61#endif
62
63QT_BEGIN_NAMESPACE
64
65namespace QtWindows
66{
67
68enum WindowsEventTypeFlags
69{
70 WindowEventFlag = 0x10000,
71 MouseEventFlag = 0x20000,
72 NonClientEventFlag = 0x40000,
73 InputMethodEventFlag = 0x80000,
74 KeyEventFlag = 0x100000,
75 KeyDownEventFlag = 0x200000,
76 TouchEventFlag = 0x400000,
77 ClipboardEventFlag = 0x800000,
78 ApplicationEventFlag = 0x1000000,
79 ThemingEventFlag = 0x2000000,
80 GenericEventFlag = 0x4000000, // Misc
81 PointerEventFlag = 0x8000000,
82};
83
84enum WindowsEventType // Simplify event types
85{
86 ExposeEvent = WindowEventFlag + 1,
87 ActivateWindowEvent = WindowEventFlag + 2,
88 DeactivateWindowEvent = WindowEventFlag + 3,
89 MouseActivateWindowEvent = WindowEventFlag + 4,
90 LeaveEvent = WindowEventFlag + 5,
91 CloseEvent = WindowEventFlag + 6,
92 ShowEvent = WindowEventFlag + 7,
93 ShowEventOnParentRestoring = WindowEventFlag + 20,
94 HideEvent = WindowEventFlag + 8,
95 DestroyEvent = WindowEventFlag + 9,
96 GeometryChangingEvent = WindowEventFlag + 10,
97 MoveEvent = WindowEventFlag + 11,
98 ResizeEvent = WindowEventFlag + 12,
99 QuerySizeHints = WindowEventFlag + 15,
100 CalculateSize = WindowEventFlag + 16,
101 FocusInEvent = WindowEventFlag + 17,
102 FocusOutEvent = WindowEventFlag + 18,
103 WhatsThisEvent = WindowEventFlag + 19,
104 DpiChangedEvent = WindowEventFlag + 21,
105 EnterSizeMoveEvent = WindowEventFlag + 22,
106 ExitSizeMoveEvent = WindowEventFlag + 23,
107 PointerActivateWindowEvent = WindowEventFlag + 24,
108 DpiScaledSizeEvent = WindowEventFlag + 25,
109 DpiChangedAfterParentEvent = WindowEventFlag + 27,
110 TaskbarButtonCreated = WindowEventFlag + 28,
111 MouseEvent = MouseEventFlag + 1,
112 MouseWheelEvent = MouseEventFlag + 2,
113 CursorEvent = MouseEventFlag + 3,
114 TouchEvent = TouchEventFlag + 1,
115 PointerEvent = PointerEventFlag + 1,
116 NonClientMouseEvent = NonClientEventFlag + MouseEventFlag + 1,
117 NonClientHitTest = NonClientEventFlag + 2,
118 NonClientCreate = NonClientEventFlag + 3,
119 NonClientActivate = NonClientEventFlag + 4,
120 NonClientPointerEvent = NonClientEventFlag + PointerEventFlag + 4,
121 KeyEvent = KeyEventFlag + 1,
122 KeyDownEvent = KeyEventFlag + KeyDownEventFlag + 1,
123 InputLanguageChangeEvent = KeyEventFlag + 2,
124 InputMethodKeyEvent = InputMethodEventFlag + KeyEventFlag + 1,
125 InputMethodKeyDownEvent = InputMethodEventFlag + KeyEventFlag + KeyDownEventFlag + 1,
126 ClipboardEvent = ClipboardEventFlag + 1,
127 ActivateApplicationEvent = ApplicationEventFlag + 1,
128 DeactivateApplicationEvent = ApplicationEventFlag + 2,
129 AccessibleObjectFromWindowRequest = ApplicationEventFlag + 3,
130 QueryEndSessionApplicationEvent = ApplicationEventFlag + 4,
131 EndSessionApplicationEvent = ApplicationEventFlag + 5,
132 AppCommandEvent = ApplicationEventFlag + 6,
133 DeviceChangeEvent = ApplicationEventFlag + 7,
134 MenuAboutToShowEvent = ApplicationEventFlag + 8,
135 AcceleratorCommandEvent = ApplicationEventFlag + 9,
136 MenuCommandEvent = ApplicationEventFlag + 10,
137 InputMethodStartCompositionEvent = InputMethodEventFlag + 1,
138 InputMethodCompositionEvent = InputMethodEventFlag + 2,
139 InputMethodEndCompositionEvent = InputMethodEventFlag + 3,
140 InputMethodOpenCandidateWindowEvent = InputMethodEventFlag + 4,
141 InputMethodCloseCandidateWindowEvent = InputMethodEventFlag + 5,
142 InputMethodRequest = InputMethodEventFlag + 6,
143 ThemeChanged = ThemingEventFlag + 1,
144 CompositionSettingsChanged = ThemingEventFlag + 2,
145 SettingChangedEvent = 438,
146 ScrollEvent = GenericEventFlag + 1,
147 ContextMenu = 123,
148 GestureEvent = 124,
149 UnknownEvent = 542
150};
151Q_DECLARE_MIXED_ENUM_OPERATORS(bool, WindowsEventTypeFlags, WindowsEventType);
152Q_DECLARE_MIXED_ENUM_OPERATORS(bool, WindowsEventType, WindowsEventTypeFlags);
153
154enum class DpiAwareness
155{
156 Invalid = -1,
157 Unaware,
158 System,
159 PerMonitor,
160 PerMonitorVersion2,
161 Unaware_GdiScaled
162};
163
164} // namespace QtWindows
165
166inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamIn, LPARAM lParamIn)
167{
168 static const UINT WM_TASKBAR_BUTTON_CREATED = []{
169 UINT message = RegisterWindowMessage(L"TaskbarButtonCreated");
170 // In case the application is run elevated, allow the
171 // TaskbarButtonCreated message through.
172 ChangeWindowMessageFilter(message, MSGFLT_ADD);
173 return message;
174 }();
175
176 switch (message) {
177 case WM_PAINT:
178 case WM_ERASEBKGND:
179 return QtWindows::ExposeEvent;
180 case WM_CLOSE:
181 return QtWindows::CloseEvent;
182 case WM_DESTROY:
183 return QtWindows::DestroyEvent;
184 case WM_ACTIVATEAPP:
185 return (int)wParamIn ?
186 QtWindows::ActivateApplicationEvent : QtWindows::DeactivateApplicationEvent;
187 case WM_MOUSEACTIVATE:
188 return QtWindows::MouseActivateWindowEvent;
190 return QtWindows::PointerActivateWindowEvent;
191 case WM_ACTIVATE:
192 return LOWORD(wParamIn) == WA_INACTIVE ?
193 QtWindows::DeactivateWindowEvent : QtWindows::ActivateWindowEvent;
194 case WM_SETCURSOR:
195 return QtWindows::CursorEvent;
196 case WM_MOUSELEAVE:
197 return QtWindows::MouseEvent;
198 case WM_HSCROLL:
199 return QtWindows::ScrollEvent;
200 case WM_MOUSEWHEEL:
201 case WM_MOUSEHWHEEL:
202 return QtWindows::MouseWheelEvent;
203 case WM_WINDOWPOSCHANGING:
204 return QtWindows::GeometryChangingEvent;
205 case WM_MOVE:
206 return QtWindows::MoveEvent;
207 case WM_SHOWWINDOW:
208 if (wParamIn)
209 return lParamIn == SW_PARENTOPENING ? QtWindows::ShowEventOnParentRestoring : QtWindows::ShowEvent;
210 return QtWindows::HideEvent;
211 case WM_SIZE:
212 return QtWindows::ResizeEvent;
213 case WM_NCCREATE:
214 return QtWindows::NonClientCreate;
215 case WM_NCCALCSIZE:
216 return QtWindows::CalculateSize;
217 case WM_NCHITTEST:
218 return QtWindows::NonClientHitTest;
219 case WM_NCACTIVATE:
220 return QtWindows::NonClientActivate;
221 case WM_GETMINMAXINFO:
222 return QtWindows::QuerySizeHints;
223 case WM_KEYDOWN: // keyboard event
224 case WM_SYSKEYDOWN:
225 return QtWindows::KeyDownEvent;
226 case WM_KEYUP:
227 case WM_SYSKEYUP:
228 case WM_CHAR:
229 return QtWindows::KeyEvent;
230 case WM_IME_CHAR:
231 return QtWindows::InputMethodKeyEvent;
232 case WM_IME_KEYDOWN:
233 return QtWindows::InputMethodKeyDownEvent;
234#ifdef WM_INPUTLANGCHANGE
235 case WM_INPUTLANGCHANGE:
236 return QtWindows::InputLanguageChangeEvent;
237#endif // WM_INPUTLANGCHANGE
238 case WM_TOUCH:
239 return QtWindows::TouchEvent;
240 case WM_CHANGECBCHAIN:
241 case WM_DRAWCLIPBOARD:
242 case WM_RENDERFORMAT:
243 case WM_RENDERALLFORMATS:
244 case WM_DESTROYCLIPBOARD:
245 return QtWindows::ClipboardEvent;
246 case WM_IME_STARTCOMPOSITION:
247 return QtWindows::InputMethodStartCompositionEvent;
248 case WM_IME_ENDCOMPOSITION:
249 return QtWindows::InputMethodEndCompositionEvent;
250 case WM_IME_COMPOSITION:
251 return QtWindows::InputMethodCompositionEvent;
252 case WM_IME_REQUEST:
253 return QtWindows::InputMethodRequest;
254 case WM_IME_NOTIFY:
255 switch (int(wParamIn)) {
256 case IMN_OPENCANDIDATE:
257 return QtWindows::InputMethodOpenCandidateWindowEvent;
258 case IMN_CLOSECANDIDATE:
259 return QtWindows::InputMethodCloseCandidateWindowEvent;
260 default:
261 break;
262 }
263 break;
264 case WM_GETOBJECT:
265 return QtWindows::AccessibleObjectFromWindowRequest;
266 case WM_SETFOCUS:
267 return QtWindows::FocusInEvent;
268 case WM_KILLFOCUS:
269 return QtWindows::FocusOutEvent;
270 // Among other things, WM_SETTINGCHANGE happens when the taskbar is moved
271 // and therefore the "working area" changes.
272 // http://msdn.microsoft.com/en-us/library/ms695534(v=vs.85).aspx
273 case WM_SETTINGCHANGE:
274 return QtWindows::SettingChangedEvent;
275 case WM_THEMECHANGED:
276 case WM_SYSCOLORCHANGE: // Handle color change as theme change (QTBUG-34170).
278 return QtWindows::ThemeChanged;
280 return QtWindows::CompositionSettingsChanged;
281#ifndef QT_NO_CONTEXTMENU
282 case WM_CONTEXTMENU:
283 return QtWindows::ContextMenu;
284#endif
285 case WM_SYSCOMMAND:
286 if ((wParamIn & 0xfff0) == SC_CONTEXTHELP)
287 return QtWindows::WhatsThisEvent;
288 break;
289 case WM_QUERYENDSESSION:
290 return QtWindows::QueryEndSessionApplicationEvent;
291 case WM_ENDSESSION:
292 return QtWindows::EndSessionApplicationEvent;
293#if defined(WM_APPCOMMAND)
294 case WM_APPCOMMAND:
295 return QtWindows::AppCommandEvent;
296#endif
297 case WM_GESTURE:
298 return QtWindows::GestureEvent;
299 case WM_DEVICECHANGE:
300 return QtWindows::DeviceChangeEvent;
301 case WM_INITMENU:
302 case WM_INITMENUPOPUP:
303 return QtWindows::MenuAboutToShowEvent;
304 case WM_COMMAND:
305 return HIWORD(wParamIn) ? QtWindows::AcceleratorCommandEvent : QtWindows::MenuCommandEvent;
306 case WM_DPICHANGED:
307 return QtWindows::DpiChangedEvent;
308 case WM_DPICHANGED_AFTERPARENT:
309 return QtWindows::DpiChangedAfterParentEvent;
311 return QtWindows::DpiScaledSizeEvent;
312 case WM_ENTERSIZEMOVE:
313 return QtWindows::EnterSizeMoveEvent;
314 case WM_EXITSIZEMOVE:
315 return QtWindows::ExitSizeMoveEvent;
316 default:
317 break;
318 }
319 if (message >= WM_NCMOUSEMOVE && message <= WM_NCMBUTTONDBLCLK)
320 return QtWindows::NonClientMouseEvent; //
321 if ((message >= WM_MOUSEFIRST && message <= WM_MOUSELAST)
322 || (message >= WM_XBUTTONDOWN && message <= WM_XBUTTONDBLCLK))
323 return QtWindows::MouseEvent;
324 if (message >= WM_NCPOINTERUPDATE && message <= WM_NCPOINTERUP)
325 return QtWindows::NonClientPointerEvent;
326 if (message >= WM_POINTERUPDATE && message <= WM_POINTERHWHEEL)
327 return QtWindows::PointerEvent;
328 if (message == WM_TASKBAR_BUTTON_CREATED)
329 return QtWindows::TaskbarButtonCreated;
330 return QtWindows::UnknownEvent;
331}
332
333#ifndef QT_NO_DEBUG_STREAM
334extern QDebug operator<<(QDebug, QtWindows::DpiAwareness);
335#endif
336
338
339#endif // QTWINDOWSGLOBAL_H
Base class for QWindowsForeignWindow, QWindowsWindow.
virtual bool isTopLevel() const
QMargins frameMargins_sys() const
bool isTopLevel_sys() const
unsigned exStyle() const
void setHasBorderInFullScreen(bool border) override
QMargins customMargins() const override
bool windowEvent(QEvent *event) override
Reimplement this method to be able to do any platform specific event handling.
bool hasBorderInFullScreen() const override
static QWindowsBaseWindow * baseWindowOf(const QWindow *w)
bool hasMaximumWidth() const
HWND parentHwnd() const
virtual QMargins fullFrameMargins() const
unsigned style() const
QRect geometry() const override
Returns the current geometry of a window.
std::optional< TouchWindowTouchTypes > touchWindowTouchTypes_sys() const
static HWND handleOf(const QWindow *w)
QPoint mapToGlobal(const QPoint &pos) const override
Translates the window coordinate pos to global screen coordinates using native methods.
QMargins frameMargins() const override
QWindowsBaseWindow(QWindow *window)
bool hasMaximumHeight() const
static bool isRtlLayout(HWND hwnd)
QRect frameGeometry_sys() const
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
QRect geometry_sys() const
virtual HWND handle() const =0
QPoint mapFromGlobal(const QPoint &pos) const override
Translates the global screen coordinate pos to window coordinates using native methods.
void setCustomMargins(const QMargins &margins) override
void setGeometry_sys(const QRect &rect) const
bool hasMaximumSize() const
void setWindowTitle_sys(const QString &title)
Platform cursor implementation.
static bool hasOverrideCursor()
static QPoint mousePosition()
void setOverrideCursor(const QCursor &cursor) override
Reimplement this function in subclass to set an override cursor on the associated screen and return t...
static HCURSOR createPixmapCursor(const PixmapCursor &pc, qreal scaleFactor=1)
static HCURSOR createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor=1)
void changeCursor(QCursor *widgetCursor, QWindow *widget) override
Set a cursor on a window.
static PixmapCursor customCursor(Qt::CursorShape cursorShape, const QPlatformScreen *screen=nullptr)
HCURSOR hCursor(const QCursor &c) const
void clearOverrideCursor() override
Reimplement this function in subclass to clear the override cursor.
CursorHandlePtr standardWindowCursor(Qt::CursorShape s=Qt::ArrowCursor)
Return cached standard cursor resources or create new ones.
static State cursorState()
static HCURSOR createCursorFromShape(Qt::CursorShape cursorShape, const QPlatformScreen *screen=nullptr)
static void enforceOverrideCursor()
QWindowsCursor(const QPlatformScreen *screen)
QPixmap dragDefaultCursor(Qt::DropAction action) const
CursorHandlePtr pixmapWindowCursor(const QCursor &c)
Return cached pixmap cursor or create new one.
QSize size() const override
Returns the size of the cursor, in native pixels.
QPoint pos() const override
void setPos(const QPoint &pos) override
Window wrapping GetDesktopWindow not allowing any manipulation.
HWND handle() const override
QMargins frameMargins() const override
QWindowsDesktopWindow(QWindow *window)
bool isTopLevel() const override
Window wrapping a foreign native window.
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
bool isForeignWindow() const override
HWND handle() const override
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
void setParent(const QPlatformWindow *window) override
This function is called to enable native child window in QPA.
void setWindowTitle(const QString &title) override
Reimplement to set the window title to title.
QWindowsForeignWindow(QWindow *window, HWND hwnd)
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
static QWindowsStaticOpenGLContext * staticOpenGLContext()
Windows native menu bar.
Provides access to native handles.
void * nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override
void * nativeResourceForWindow(const QByteArray &resource, QWindow *window) override
void * nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override
void * nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override
Implementation of IDropTarget.
Manages a list of QWindowsScreen.
bool handleScreenChanges()
Synchronizes the screen list, adds new screens, removes deleted ones and propagates resolution change...
const QWindowsScreen * screenForHwnd(HWND hwnd) const
const WindowsScreenList & screens() const
Windows screen.
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
QString serialNumber() const override
Reimplement this function in subclass to return the serial number of this screen.
QDpi logicalDpi() const override
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
QList< QPlatformScreen * > virtualSiblings() const override
Determine siblings in a virtual desktop system.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const override
This function is called when Qt needs to be able to grab the content of a window.
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
qreal devicePixelRatio() const override
Reimplement this function in subclass to return the device pixel ratio for the screen.
const CursorPtr & cursorPtr() const
QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override
Queries ClearType settings to check the pixel layout.
static bool setOrientationPreference(Qt::ScreenOrientation o)
static int baseDpi
QRect availableGeometry() const override
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
QString name() const override
QString manufacturer() const override
Reimplement this function in subclass to return the manufacturer of this screen.
QString model() const override
Reimplement this function in subclass to return the model of this screen.
QDpi logicalBaseDpi() const override
Reimplement to return the base logical DPI for the platform.
HMONITOR handle() const override
int depth() const override
Reimplement in subclass to return current depth of the screen.
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
const QWindowsScreenData & data() const
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
static Qt::ScreenOrientation orientationPreference()
virtual void * moduleHandle() const =0
Raster or OpenGL Window.
bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const
void alertWindow(int durationMs=0)
void setWindowFlags(Qt::WindowFlags flags) override
Requests setting the window flags of this surface to flags.
void setCustomMargins(const QMargins &m) override
Sets custom margins to be added to the default margins determined by the windows style in the handlin...
void setMenuBar(QWindowsMenuBar *mb)
static QWindowsWindow * windowsWindowOf(const QWindow *w)
void invalidateSurface() override
Invalidates the window's surface by releasing its surface buffers.
HDC getDC()
Allocates a HDC for the window or returns the temporary one obtained from WinAPI BeginPaint within a ...
QMargins fullFrameMargins() const override
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void handleDpiChangedAfterParent(HWND hwnd)
static void setHasBorderInFullScreenStatic(QWindow *window, bool border)
int savedDpi() const
void checkForScreenChanged(ScreenChangeMode mode=FromGeometryChange)
void requestUpdate() override
Requests an QEvent::UpdateRequest event.
bool testFlag(unsigned f) const
static QString formatWindowTitle(const QString &title)
void setFlag(unsigned f) const
void clearFlag(unsigned f) const
void setFrameStrutEventsEnabled(bool enabled) override
Reimplement this method to set whether frame strut events should be sent to enabled.
static void settingsChanged()
static bool handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &marginsDp)
void getSizeHints(MINMAXINFO *mmi) const
static void setHasBorderInFullScreenDefault(bool border)
~QWindowsWindow() override
bool handleWmPaint(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)
void setParent(const QPlatformWindow *window) override
This function is called to enable native child window in QPA.
static bool hasNoNativeFrame(HWND hwnd, Qt::WindowFlags flags)
qreal opacity() const
QRect restoreGeometry() const
static void * userDataOf(HWND hwnd)
bool setMouseGrabEnabled(bool grab) override
void propagateSizeHints() override
Reimplement to propagate the size hints of the QWindow.
static void setUserDataOf(HWND hwnd, void *ud)
void applyCursor()
Applies to cursor property set on the window to the global cursor.
bool isExposed() const override
Returns if this window is exposed in the windowing system.
bool handleGeometryChanging(MSG *message) const
bool isActive() const override
Returns true if the window should appear active from a style perspective.
void setStyle(unsigned s) const
static QScreen * forcedScreenForGLWindow(const QWindow *w)
QString windowTitle() const override
Reimplement to return the actual window title used in the underlying windowing system unless the titl...
static void displayChanged()
bool setKeyboardGrabEnabled(bool grab) override
static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity)
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
bool windowEvent(QEvent *event) override
Reimplement this method to be able to do any platform specific event handling.
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
void setEnabled(bool enabled)
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
QSurfaceFormat format() const override
Returns the actual surface format of the window.
static const char * embeddedNativeParentHandleProperty
QWindowsMenuBar * menuBar() const
bool isLayered() const
void handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam)
QMargins frameMargins() const override
void setWindowIcon(const QIcon &icon) override
Reimplement to set the window icon to icon.
bool isClientAreaExpanded() const
void handleResized(int wParam, LPARAM lParam)
void setOpacity(qreal level) override
Reimplement to be able to let Qt set the opacity level of a window.
bool isEmbedded() const override
Returns true if the window is a child of a non-Qt window.
QMargins customMargins() const override
bool handleNonClientActivate(LRESULT *result) const
bool isEnabled() const
bool isAncestorOf(const QPlatformWindow *child) const override
Returns true if the window is an ancestor of the given child.
QRect normalGeometry() const override
Returns the geometry of a window in 'normal' state (neither maximized, fullscreen nor minimized) for ...
void setExStyle(unsigned s) const
qreal dpiRelativeScale(const UINT dpi) const
QMargins safeAreaMargins() const override
The safe area margins of a window represent the area that is safe to place content within,...
void setSavedDpi(int dpi)
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
static QWindow * topLevelOf(QWindow *w)
void handleDpiScaledSize(WPARAM wParam, LPARAM lParam, LRESULT *result)
static bool setDarkBorderToWindow(HWND hwnd, bool d)
QRect geometry() const override
Returns the current geometry of a window.
bool frameStrutEventsEnabled() const override
Reimplement this method to return whether frame strut events are enabled.
@ WithinSetParent
Automatic mouse capture on button press.
QPoint mapToGlobal(const QPoint &pos) const override
Translates the window coordinate pos to global screen coordinates using native methods.
static const char * hasBorderInFullScreenProperty
bool startSystemMove() override
Reimplement this method to start a system move operation if the system supports it and return true to...
bool isTopLevel() const override
void releaseDC()
Releases the HDC for the window or does nothing in case it was obtained from WinAPI BeginPaint within...
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
void setCursor(const CursorHandlePtr &c)
bool hasBorderInFullScreen() const override
bool hasMouseCapture() const
void * surface(void *nativeConfig, int *err)
void setHasBorderInFullScreen(bool border) override
QPoint mapFromGlobal(const QPoint &pos) const override
Translates the global screen coordinate pos to window coordinates using native methods.
CursorHandlePtr cursor() const
bool isVisible() const
void handleCompositionSettingsChanged()
void setWindowTitle(const QString &title) override
Reimplement to set the window title to title.
void setDarkBorder(bool d)
QWindowsWindow(QWindow *window, const QWindowsWindowData &data)
bool startSystemResize(Qt::Edges edges) override
Reimplement this method to start a system resize operation if the system supports it and return true ...
void setFullFrameMargins(const QMargins &newMargins)
void setMask(const QRegion &region) override
Reimplement to be able to let Qt set the mask of a window.
void setAlertState(bool enabled) override
Reimplement this method to set whether the window demands attention (for example, by flashing the tas...
HWND handle() const override
bool isAlertState() const override
Reimplement this method return whether the window is in an alert state.
static int resourceType(const QByteArray &key)
#define WM_GESTURE
#define WM_TOUCH
#define WM_POINTERUPDATE
#define WM_GETDPISCALEDSIZE
#define WM_NCPOINTERUP
#define WM_POINTERHWHEEL
#define WM_DPICHANGED
#define WM_SYSCOLORCHANGE
#define WM_DWMCOMPOSITIONCHANGED
#define WM_NCPOINTERUPDATE
#define WM_POINTERACTIVATE
#define WM_DWMCOLORIZATIONCOLORCHANGED
bool operator==(const QWindowsPixmapCursorCacheKey &k1, const QWindowsPixmapCursorCacheKey &k2)
size_t qHash(const QWindowsPixmapCursorCacheKey &k, size_t seed) noexcept
static void clientToScreen(HWND hwnd, POINT *wP)
static void screenToClient(HWND hwnd, POINT *wP)
Active Context for creating windows.
const QScreen * screen
const QWindow * window
QWindowCreationContext(const QWindow *w, const QScreen *s, const QRect &geometryIn, const QRect &geometry, const QMargins &customMargins, DWORD style, DWORD exStyle)
void applyToMinMaxInfo(MINMAXINFO *mmi) const
PixmapCursor(const QPixmap &pix=QPixmap(), const QPoint &h=QPoint())
Stores geometry constraints and provides utility functions.
static QMargins frameOnPrimaryScreen(const QWindow *w, DWORD style, DWORD exStyle)
static QMargins frame(const QWindow *w, HWND hwnd)
static QMargins frame(const QWindow *w, const QRect &geometry, DWORD style, DWORD exStyle)
static QMargins frameOnPrimaryScreen(const QWindow *w, HWND hwnd)
static bool positionIncludesFrame(const QWindow *w)
static bool handleCalculateSize(const QWindow *window, const QMargins &customMargins, const MSG &msg, LRESULT *result)
static QPoint mapToGlobal(const QWindow *w, const QPoint &)
static QMargins frame(const QWindow *w, DWORD style, DWORD exStyle, qreal dpi)
static QPoint mapToGlobal(HWND hwnd, const QPoint &)
static QPoint mapFromGlobal(const HWND hwnd, const QPoint &)
static QPoint mapFromGlobal(const QWindow *w, const QPoint &)
static void applyToMinMaxInfo(const QWindow *w, const QMargins &margins, MINMAXINFO *mmi)
static void applyToMinMaxInfo(const QWindow *w, const QScreen *screen, const QMargins &margins, MINMAXINFO *mmi)
QWindowsPixmapCursorCacheKey(const QCursor &c, qreal scaleFactor)
Qt::WindowFlags flags
static QWindowsWindowData create(const QWindow *w, const QWindowsWindowData &parameters, const QString &title)