4#include <QtCore/qt_windows.h>
9#if QT_CONFIG(draganddrop)
16#if QT_CONFIG(dynamicgl)
26#include <QtGui/qguiapplication.h>
27#include <QtGui/qscreen.h>
28#include <QtGui/qwindow.h>
29#include <QtGui/qregion.h>
30#include <QtGui/qopenglcontext.h>
31#include <QtGui/private/qwindowsthemecache_p.h>
32#include <private/qwindow_p.h>
33#include <private/qguiapplication_p.h>
34#include <private/qhighdpiscaling_p.h>
35#include <qpa/qwindowsysteminterface.h>
37#include <QtCore/qdebug.h>
38#include <QtCore/qlibraryinfo.h>
46#include <shellscalingapi.h>
67 if (style & WS_OVERLAPPED)
68 rc +=
" WS_OVERLAPPED";
69 if (style & WS_CLIPSIBLINGS)
70 rc +=
" WS_CLIPSIBLINGS";
71 if (style & WS_CLIPCHILDREN)
72 rc +=
" WS_CLIPCHILDREN";
73 if (style & WS_THICKFRAME)
74 rc +=
" WS_THICKFRAME";
75 if (style & WS_DLGFRAME)
77 if (style & WS_SYSMENU)
79 if (style & WS_MINIMIZEBOX)
80 rc +=
" WS_MINIMIZEBOX";
81 if (style & WS_MAXIMIZEBOX)
82 rc +=
" WS_MAXIMIZEBOX";
83 if (style & WS_BORDER)
85 if (style & WS_CAPTION)
87 if (style & WS_CHILDWINDOW)
88 rc +=
" WS_CHILDWINDOW";
89 if (style & WS_DISABLED)
93 if (style & WS_HSCROLL)
95 if (style & WS_ICONIC)
97 if (style & WS_MAXIMIZE)
99 if (style & WS_MINIMIZE)
100 rc +=
" WS_MINIMIZE";
101 if (style & WS_SIZEBOX)
103 if (style & WS_TABSTOP)
105 if (style & WS_TILED)
107 if (style & WS_VISIBLE)
109 if (style & WS_VSCROLL)
118 if (exStyle & WS_EX_TOOLWINDOW)
119 rc +=
" WS_EX_TOOLWINDOW";
120 if (exStyle & WS_EX_CONTEXTHELP)
121 rc +=
" WS_EX_CONTEXTHELP";
122 if (exStyle & WS_EX_LAYERED)
123 rc +=
" WS_EX_LAYERED";
124 if (exStyle & WS_EX_DLGMODALFRAME)
125 rc +=
" WS_EX_DLGMODALFRAME";
126 if (exStyle & WS_EX_LAYOUTRTL)
127 rc +=
" WS_EX_LAYOUTRTL";
128 if (exStyle & WS_EX_NOINHERITLAYOUT)
129 rc +=
" WS_EX_NOINHERITLAYOUT";
130 if (exStyle & WS_EX_ACCEPTFILES)
131 rc +=
" WS_EX_ACCEPTFILES";
132 if (exStyle & WS_EX_APPWINDOW)
133 rc +=
" WS_EX_APPWINDOW";
134 if (exStyle & WS_EX_CLIENTEDGE)
135 rc +=
" WS_EX_CLIENTEDGE";
136 if (exStyle & WS_EX_COMPOSITED)
137 rc +=
" WS_EX_COMPOSITED";
138 if (exStyle & WS_EX_CONTROLPARENT)
139 rc +=
" WS_EX_CONTROLPARENT";
140 if (exStyle & WS_EX_LEFT)
142 if (exStyle & WS_EX_LEFTSCROLLBAR)
143 rc +=
" WS_EX_LEFTSCROLLBAR";
144 if (exStyle & WS_EX_LTRREADING)
145 rc +=
" WS_EX_LTRREADING";
146 if (exStyle & WS_EX_MDICHILD)
147 rc +=
" WS_EX_MDICHILD";
148 if (exStyle & WS_EX_NOACTIVATE)
149 rc +=
" WS_EX_NOACTIVATE";
150 if (exStyle & WS_EX_NOPARENTNOTIFY)
151 rc +=
" WS_EX_NOPARENTNOTIFY";
152 if (exStyle & WS_EX_NOREDIRECTIONBITMAP)
153 rc +=
" WS_EX_NOREDIRECTIONBITMAP";
154 if (exStyle & WS_EX_RIGHT)
155 rc +=
" WS_EX_RIGHT";
156 if (exStyle & WS_EX_RIGHTSCROLLBAR)
157 rc +=
" WS_EX_RIGHTSCROLLBAR";
158 if (exStyle & WS_EX_RTLREADING)
159 rc +=
" WS_EX_RTLREADING";
160 if (exStyle & WS_EX_STATICEDGE)
161 rc +=
" WS_EX_STATICEDGE";
162 if (exStyle & WS_EX_TOPMOST)
163 rc +=
" WS_EX_TOPMOST";
164 if (exStyle & WS_EX_TRANSPARENT)
165 rc +=
" WS_EX_TRANSPARENT";
166 if (exStyle & WS_EX_WINDOWEDGE)
167 rc +=
" WS_EX_WINDOWEDGE";
175 if (
flags & SWP_FRAMECHANGED)
176 rc +=
" SWP_FRAMECHANGED";
177 if (
flags & SWP_HIDEWINDOW)
178 rc +=
" SWP_HIDEWINDOW";
179 if (
flags & SWP_NOACTIVATE)
180 rc +=
" SWP_NOACTIVATE";
181 if (
flags & SWP_NOCOPYBITS)
182 rc +=
" SWP_NOCOPYBITS";
183 if (
flags & SWP_NOMOVE)
185 if (
flags & SWP_NOOWNERZORDER)
186 rc +=
" SWP_NOOWNERZORDER";
187 if (
flags & SWP_NOREDRAW)
188 rc +=
" SWP_NOREDRAW";
189 if (
flags & SWP_NOSENDCHANGING)
190 rc +=
" SWP_NOSENDCHANGING";
191 if (
flags & SWP_NOSIZE)
193 if (
flags & SWP_NOZORDER)
194 rc +=
" SWP_NOZORDER";
195 if (
flags & SWP_SHOWWINDOW)
196 rc +=
" SWP_SHOWWINDOW";
197 if (
flags & SWP_ASYNCWINDOWPOS)
198 rc +=
" SWP_ASYNCWINDOWPOS";
199 if (
flags & SWP_DEFERERASE)
200 rc +=
" SWP_DEFERERASE";
201 if (
flags & SWP_DRAWFRAME)
202 rc +=
" SWP_DRAWFRAME";
203 if (
flags & SWP_NOREPOSITION)
204 rc +=
" SWP_NOREPOSITION";
212 if (
flags & WPF_SETMINPOSITION)
213 rc +=
" WPF_SETMINPOSITION";
214 if (
flags & WPF_RESTORETOMAXIMIZED)
215 rc +=
" WPF_RESTORETOMAXIMIZED";
216 if (
flags & WPF_ASYNCWINDOWPLACEMENT)
217 rc +=
" WPF_ASYNCWINDOWPLACEMENT";
227 if (cmd == SW_SHOWNORMAL)
228 rc +=
" SW_SHOWNORMAL";
229 if (cmd == SW_NORMAL)
231 if (cmd == SW_SHOWMINIMIZED)
232 rc +=
" SW_SHOWMINIMIZED";
233 if (cmd == SW_SHOWMAXIMIZED)
234 rc +=
" SW_SHOWMAXIMIZED";
235 if (cmd == SW_MAXIMIZE)
236 rc +=
" SW_MAXIMIZE";
237 if (cmd == SW_SHOWNOACTIVATE)
238 rc +=
" SW_SHOWNOACTIVATE";
241 if (cmd == SW_MINIMIZE)
242 rc +=
" SW_MINIMIZE";
243 if (cmd == SW_SHOWMINNOACTIVE)
244 rc +=
" SW_SHOWMINNOACTIVE";
245 if (cmd == SW_SHOWNA)
247 if (cmd == SW_RESTORE)
249 if (cmd == SW_SHOWDEFAULT)
250 rc +=
" SW_SHOWDEFAULT";
251 if (cmd == SW_FORCEMINIMIZE)
252 rc +=
" SW_FORCEMINIMIZE";
268 const int x =
rect.left();
269 const int y =
rect.top();
275#ifndef QT_NO_DEBUG_STREAM
280 d <<
"RECT(left=" <<
r.left <<
", top=" <<
r.top
281 <<
", right=" <<
r.right <<
", bottom=" <<
r.bottom
282 <<
" (" <<
r.right -
r.left <<
'x' <<
r.bottom -
r.top <<
"))";
290 d <<
"POINT(x=" <<
p.x <<
", y=" <<
p.y <<
')';
300 << wp.hwnd <<
", hwndInsertAfter=" << wp.hwndInsertAfter <<
", x=" << wp.x
301 <<
", y=" << wp.y <<
", cx=" << wp.cx <<
", cy=" << wp.cy <<
')';
309 d <<
"NCCALCSIZE_PARAMS(rgrc=[" <<
p.rgrc[0] <<
", " <<
p.rgrc[1] <<
", "
310 <<
p.rgrc[2] <<
"], lppos=" << *
p.lppos <<
')';
318 d <<
"MINMAXINFO(maxSize=" <<
i.ptMaxSize <<
", "
319 <<
"maxpos=" <<
i.ptMaxPosition <<
", "
320 <<
"maxtrack=" <<
i.ptMaxTrackSize <<
", "
321 <<
"mintrack=" <<
i.ptMinTrackSize <<
')';
332 <<
", ptMaxPosition=" << wp.ptMaxPosition <<
", rcNormalPosition="
333 << wp.rcNormalPosition <<
')';
348 for (
int i = 2;
i < 8; ++
i)
362 d <<
m.left() <<
", " <<
m.top() <<
", " <<
m.right() <<
", " <<
m.bottom();
369 if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)
383 RECT
rect = { 0, 0, 0, 0 };
385 WINDOWPLACEMENT windowPlacement;
386 windowPlacement.length =
sizeof(WINDOWPLACEMENT);
387 GetWindowPlacement(hwnd, &windowPlacement);
388 if (windowPlacement.showCmd == SW_SHOWMINIMIZED) {
393 GetWindowRect(hwnd, &
rect);
394 const HWND parent = GetParent(hwnd);
395 if (parent && !topLevel) {
398 POINT leftTop = {
rect.left,
rect.top };
400 rect.left = leftTop.x;
401 rect.top = leftTop.y;
411 if (!IsWindowVisible(hwnd))
412 return QWindow::Hidden;
413 WINDOWPLACEMENT windowPlacement;
414 windowPlacement.length =
sizeof(WINDOWPLACEMENT);
415 if (GetWindowPlacement(hwnd, &windowPlacement)) {
416 switch (windowPlacement.showCmd) {
417 case SW_SHOWMINIMIZED:
419 case SW_FORCEMINIMIZE:
420 return QWindow::Minimized;
421 case SW_SHOWMAXIMIZED:
422 return QWindow::Maximized;
427 return QWindow::Windowed;
432 switch (
w->surfaceType()) {
444 DWM_BLURBEHIND blurBehind = {0, 0,
nullptr, 0};
446 blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
447 blurBehind.fEnable = TRUE;
448 blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
450 const bool result = DwmEnableBlurBehindWindow(hwnd, &blurBehind) == S_OK;
452 if (blurBehind.hRgnBlur)
453 DeleteObject(blurBehind.hRgnBlur);
471 const LONG_PTR
style = GetWindowLongPtr(hwnd, GWL_STYLE);
480 const LONG_PTR
exStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
487 SetWindowLongPtr(hwnd, GWL_EXSTYLE,
exStyle | WS_EX_LAYERED);
489 SetWindowLongPtr(hwnd, GWL_EXSTYLE,
exStyle & ~WS_EX_LAYERED);
501 BLENDFUNCTION blend = {AC_SRC_OVER, 0,
alpha, AC_SRC_ALPHA};
502 UpdateLayeredWindow(hwnd,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, 0, &blend, ULW_ALPHA);
504 SetLayeredWindowAttributes(hwnd, 0,
alpha, LWA_ALPHA);
506 }
else if (IsWindowVisible(hwnd)) {
507 InvalidateRect(hwnd,
nullptr, TRUE);
514 const bool hasAlpha =
w->format().hasAlpha();
527 return GetSystemMetricsForDpi(SM_CXSIZEFRAME, dpi)
528 + GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi);
538 POINT pt = {screenPoint.x(), screenPoint.y()};
539 if (HMONITOR hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL)) {
542 if (SUCCEEDED(GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY))) {
552 const UINT dpi = GetDpiForWindow(hwnd);
613 debug <<
"WindowCreationData: " <<
d.flags
614 <<
"\n topLevel=" <<
d.topLevel;
616 debug <<
" parent=" <<
d.parentHandle;
617 debug <<
" popup=" <<
d.popup <<
" dialog=" <<
d.dialog
618 <<
" embedded=" <<
d.embedded <<
" tool=" <<
d.tool
629 flags &=
~Qt::WindowFullscreenButtonHint;
650 return s->
data().deviceName;
654 if (winScreen && getDeviceName(winScreen) !=
name) {
655 const auto screens = winScreen->virtualSiblings();
678 const QRect scrGeo = screenForGL->handle()->availableGeometry();
681 if (scrGeo.contains(orgPos))
686 if (scrGeo.contains(posFrame))
690 const auto screens = screenForGL->virtualSiblings();
691 const QScreen *orgScreen =
nullptr;
700 qMax(scrGeo.top(), scrGeo.center().y()
707 const QRect orgGeo = orgScreen->handle()->availableGeometry();
712 if (orgGeo.center() == (orgFrame - margins).center())
716 const QPoint newPos(scrGeo.left() + ((posFrame.x() - orgGeo.left()) * scrGeo.width()) / orgGeo.width(),
717 scrGeo.top() + ((posFrame.y() - orgGeo.top()) * scrGeo.height()) / orgGeo.height());
718 const QPoint newPosNoMargin(newPos.
x() - invMargins.left(), newPos.
y() - invMargins.top());
720 return scrGeo.contains(newPosNoMargin) ? newPosNoMargin : newPos;
724 unsigned creationFlags)
777 exStyle |= WS_EX_LAYOUTRTL | WS_EX_NOINHERITLAYOUT;
794 style = WS_OVERLAPPED;
801 style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN ;
808 style |= WS_DLGFRAME;
810 style |= WS_THICKFRAME;
818 style |= WS_SYSMENU | WS_BORDER;
819 exStyle |= WS_EX_DLGMODALFRAME;
822 if (showMinimizeButton)
823 style |= WS_MINIMIZEBOX;
825 if (showMaximizeButton)
826 style |= WS_MAXIMIZEBOX;
827 if (showMinimizeButton || showMaximizeButton)
832 && !showMaximizeButton)
841 exStyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT;
845 exStyle |= WS_EX_NOREDIRECTIONBITMAP;
867 const QPalette windowPal = dWindow->windowPalette();
878 const auto appinst =
reinterpret_cast<HINSTANCE
>(GetModuleHandle(
nullptr));
890 const auto *titleUtf16 =
reinterpret_cast<const wchar_t *
>(
title.
utf16());
891 const auto *classNameUtf16 =
reinterpret_cast<const wchar_t *
>(
windowClassName.utf16());
900 const bool hasFrame = (
style & (WS_DLGFRAME | WS_THICKFRAME))
907 <<
'\n' << *
this <<
"\nrequested: " <<
rect <<
": "
910 <<
" custom margins: " <<
context->customMargins
911 <<
" invisible margins: " << invMargins;
917 int mirrorParentWidth = 0;
921 mirrorParentWidth =
rect.right;
923 if (mirrorParentWidth != 0 &&
pos.x() != CW_USEDEFAULT &&
context->frameWidth != CW_USEDEFAULT)
926 result.hwnd = CreateWindowEx(
exStyle, classNameUtf16, titleUtf16,
932 <<
"CreateWindowEx: returns " <<
w <<
' ' <<
result.hwnd <<
" obtained geometry: "
943 if (mirrorParentWidth != 0) {
944 context->obtainedPos.setX(mirrorParentWidth -
context->obtainedSize.width()
950 result.geometry = obtainedGeometry;
954 result.hasFrame = hasFrame;
963 const LONG_PTR oldStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
964 const LONG_PTR oldExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
966 const LONG_PTR newStyle =
style | (oldStyle & (WS_DISABLED|WS_VISIBLE));
967 if (oldStyle != newStyle)
968 SetWindowLongPtr(hwnd, GWL_STYLE, newStyle);
969 const LONG_PTR newExStyle =
exStyle;
970 if (newExStyle != oldExStyle)
971 SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle);
972 qCDebug(lcQpaWindow).nospace() << __FUNCTION__ << hwnd << *
this
973 <<
"\n Style from " <<
debugWinStyle(DWORD(oldStyle)) <<
"\n to "
983 UINT swpFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER;
985 swpFlags |= SWP_FRAMECHANGED;
987 swpFlags |= SWP_NOACTIVATE;
989 SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, swpFlags);
991 qWarning(
"QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time");
993 SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, swpFlags);
994 }
else if (frameChange) {
995 SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, swpFlags);
998 HMENU systemMenu = GetSystemMenu(hwnd, FALSE);
1000 EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_ENABLED);
1002 EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
1006 SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags);
1018 dip.setWidth(
qRound(
qreal(dip.width()) * factor));
1020 dip.setHeight(
qRound(
qreal(dip.height()) * factor));
1037 DWORD style = hwnd !=
nullptr ? DWORD(GetWindowLongPtr(hwnd, GWL_STYLE)) : 0;
1055 RECT
rect = {0,0,0,0};
1056 style &= ~DWORD(WS_OVERLAPPED);
1057 if (AdjustWindowRectEx(&
rect, style, FALSE, exStyle) == FALSE)
1058 qErrnoWarning(
"%s: AdjustWindowRectEx failed", __FUNCTION__);
1061 qCDebug(lcQpaWindow).nospace() << __FUNCTION__ <<
" style="
1070 DWORD(GetWindowLongPtr(hwnd, GWL_EXSTYLE)));
1077 RECT
rect = {0,0,0,0};
1078 style &= ~DWORD(WS_OVERLAPPED);
1079 if (AdjustWindowRectExForDpi(&
rect, style, FALSE, exStyle,
unsigned(
qRound(dpi))) == FALSE) {
1080 qErrnoWarning(
"%s: AdjustWindowRectExForDpi failed", __FUNCTION__);
1084 qCDebug(lcQpaWindow).nospace() << __FUNCTION__ <<
" style="
1098 auto screen = screenManager.screenForHwnd(hwnd);
1100 screen = screenManager.screens().value(0);
1102 return frame(
w, style, exStyle, dpi);
1107 return frame(
w, hwnd, DWORD(GetWindowLongPtr(hwnd, GWL_STYLE)),
1108 DWORD(GetWindowLongPtr(hwnd, GWL_EXSTYLE)));
1113 DWORD style, DWORD exStyle)
1123 auto screen = screenManager.screenAtDp(geometry.
center());
1125 screen = screenManager.screens().value(0);
1127 dpi =
screen->logicalDpi().first;
1134 if (!msg.wParam || customMargins.
isNull())
1136 *
result = DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
1137 auto *ncp =
reinterpret_cast<NCCALCSIZE_PARAMS *
>(msg.lParam);
1138 const RECT oldClientArea = ncp->rgrc[0];
1139 ncp->rgrc[0].left += customMargins.
left();
1140 ncp->rgrc[0].top += customMargins.
top();
1141 ncp->rgrc[0].right -= customMargins.
right();
1142 ncp->rgrc[0].bottom -= customMargins.
bottom();
1144 qCDebug(lcQpaWindow).nospace() << __FUNCTION__ << oldClientArea <<
'+' << customMargins <<
"-->"
1145 << ncp->rgrc[0] <<
' ' << ncp->rgrc[1] <<
' ' << ncp->rgrc[2]
1146 <<
' ' << ncp->lppos->cx <<
',' << ncp->lppos->cy;
1157 const int maximumWidth =
qMax(maximumSize->
width(), minimumSize->
width());
1158 const int maximumHeight =
qMax(maximumSize->
height(), minimumSize->
height());
1159 const int frameWidth = margins.
left() + margins.
right();
1160 const int frameHeight = margins.
top() + margins.
bottom();
1162 if (minimumSize->
width() > 0)
1163 minimumSize->
rwidth() += frameWidth;
1164 if (minimumSize->
height() > 0)
1165 minimumSize->
rheight() += frameHeight;
1167 maximumSize->
setWidth(maximumWidth + frameWidth);
1169 maximumSize->
setHeight(maximumHeight + frameHeight);
1180 qCDebug(lcQpaWindow).nospace() <<
'>' << __FUNCTION__ <<
'<' <<
" min="
1181 << minimumSize.
width() <<
',' << minimumSize.
height()
1182 <<
" max=" << maximumSize.
width() <<
',' << maximumSize.
height()
1183 <<
" margins=" << margins
1186 if (minimumSize.
width() > 0)
1187 mmi->ptMinTrackSize.x = minimumSize.
width();
1188 if (minimumSize.
height() > 0)
1189 mmi->ptMinTrackSize.y = minimumSize.
height();
1192 mmi->ptMaxTrackSize.x = maximumSize.
width();
1194 mmi->ptMaxTrackSize.y = maximumSize.
height();
1195 qCDebug(lcQpaWindow).nospace() <<
'<' << __FUNCTION__ <<
" out " << *mmi;
1230 return (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LAYOUTRTL) != 0;
1245 return bw ? bw->handle() : HWND(
nullptr);
1269std::optional<QWindowsBaseWindow::TouchWindowTouchTypes>
1272 ULONG touchFlags = 0;
1273 if (IsTouchWindow(
handle(), &touchFlags) == FALSE)
1276 if ((touchFlags & TWF_FINETOUCH) != 0)
1277 result.setFlag(TouchWindowTouchType::FineTouch);
1278 if ((touchFlags & TWF_WANTPALM) != 0)
1279 result.setFlag(TouchWindowTouchType::WantPalmTouch);
1285 SetWindowPos(
handle(),
nullptr , 0, 0, 0, 0,
1286 SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
1296 SetWindowPos(
handle(), HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
1304 SetWindowPos(
handle(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
1366 , m_topLevelStyle(0)
1375 const HWND newParent = newParentWindow ?
reinterpret_cast<HWND
>(newParentWindow->winId()) : HWND(
nullptr);
1377 const DWORD oldStyle =
style();
1378 qCDebug(lcQpaWindow) << __FUNCTION__ <<
window() <<
"newParent="
1379 << newParentWindow << newParent <<
"oldStyle=" <<
debugWinStyle(oldStyle);
1380 SetParent(m_hwnd, newParent);
1382 DWORD newStyle = oldStyle;
1384 newStyle = m_topLevelStyle;
1386 m_topLevelStyle = oldStyle;
1387 newStyle &= ~(WS_OVERLAPPEDWINDOW | WS_POPUPWINDOW);
1388 newStyle |= WS_CHILD;
1390 SetWindowLongPtr(m_hwnd, GWL_STYLE, newStyle);
1396 qCDebug(lcQpaWindow) << __FUNCTION__ <<
window() << visible;
1398 ShowWindow(
handle(), SW_SHOWNOACTIVATE);
1424 const QRect &geometryIn,
const QRect &geometry,
1426 DWORD style, DWORD exStyle) :
1429 requestedGeometryIn(geometryIn),
1430 requestedGeometry(geometry),
1431 obtainedPos(geometryIn.topLeft()),
1432 obtainedSize(geometryIn.
size()),
1454 const bool isDefaultPosition = !
frameX && !
frameY &&
w->isTopLevel();
1461 qCDebug(lcQpaWindow).nospace()
1462 << __FUNCTION__ <<
' ' <<
w <<
' ' << geometry
1497bool QWindowsWindow::m_borderInFullScreenDefault =
false;
1498bool QWindowsWindow::m_inSetgeometry =
false;
1505 , m_vkSurface(VK_NULL_HANDLE)
1514#if QT_CONFIG(opengl)
1518#if QT_CONFIG(vulkan)
1535 if (aWindow->isTopLevel())
1547 UnregisterTouchWindow(m_data.
hwnd);
1567 if (obtainedScreen &&
screen() != obtainedScreen)
1568 QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(
w, obtainedScreen->screen());
1571 QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(
w, obtainedGeometry);
1579 return window()->requestedFormat();
1582void QWindowsWindow::fireExpose(
const QRegion ®ion,
bool force)
1584 if (region.
isEmpty() && !force)
1591void QWindowsWindow::fireFullExpose(
bool force)
1596void QWindowsWindow::destroyWindow()
1604 if (
w->transientParent() ==
window()) {
1606 tw->updateTransientParent();
1611 context->clearWindowUnderMouse();
1614 setDropSiteEnabled(
false);
1615#if QT_CONFIG(vulkan)
1620 m_vkSurface = VK_NULL_HANDLE;
1626 staticOpenGLContext->destroyWindowSurface(m_surface);
1627 m_surface =
nullptr;
1630 DestroyWindow(m_data.
hwnd);
1632 m_data.
hwnd =
nullptr;
1636void QWindowsWindow::updateDropSite(
bool topLevel)
1639 bool parentIsEmbedded =
false;
1646 parentIsEmbedded =
true;
1649 if (topLevel || parentIsEmbedded) {
1666void QWindowsWindow::setDropSiteEnabled(
bool dropEnabled)
1668 if (isDropSiteEnabled() == dropEnabled)
1670 qCDebug(lcQpaMime) << __FUNCTION__ <<
window() << dropEnabled;
1671#if QT_CONFIG(clipboard) && QT_CONFIG(draganddrop)
1675 RegisterDragDrop(m_data.
hwnd, m_dropTarget);
1676 CoLockObjectExternal(m_dropTarget,
true,
true);
1678 CoLockObjectExternal(m_dropTarget,
false,
true);
1679 m_dropTarget->Release();
1680 RevokeDragDrop(m_data.
hwnd);
1681 m_dropTarget =
nullptr;
1686bool QWindowsWindow::m_screenForGLInitialized =
false;
1690 m_screenForGLInitialized =
false;
1695 m_screenForGLInitialized =
false;
1701 if (!m_screenForGLInitialized) {
1703 m_screenForGLInitialized =
true;
1717 if (ww->isEmbedded()) {
1718 HWND parentHWND = GetAncestor(ww->handle(), GA_PARENT);
1719 const HWND desktopHwnd = GetDesktopWindow();
1721 while (parentHWND && parentHWND != desktopHwnd) {
1724 parentHWND = GetAncestor(parentHWND, GA_PARENT);
1747 qCDebug(lcQpaWindow) << __FUNCTION__ <<
this <<
win << m_data.
hwnd << visible;
1761 SetForegroundWindow(m_data.
hwnd);
1766 ShowWindow(m_data.
hwnd, SW_HIDE);
1776 return m_data.
hwnd && IsWindowVisible(m_data.
hwnd);
1782 if (
const HWND activeHwnd = GetForegroundWindow())
1783 if (m_data.
hwnd == activeHwnd || IsChild(activeHwnd, m_data.
hwnd))
1791 return IsChild(m_data.
hwnd, childWindow->handle());
1814#ifndef GWL_HWNDPARENT
1815# define GWL_HWNDPARENT (-8)
1818void QWindowsWindow::updateTransientParent()
const
1823 const HWND oldTransientParent = GetWindow(m_data.
hwnd, GW_OWNER);
1824 HWND newTransientParent =
nullptr;
1828 newTransientParent = tw->handle();
1832 while (newTransientParent && (GetWindowLongPtr(newTransientParent, GWL_STYLE) & WS_CHILD) != 0)
1833 newTransientParent = GetParent(newTransientParent);
1835 if (newTransientParent != oldTransientParent)
1842 const QVariant showWithoutActivating =
window->property(
"_q_showWithoutActivating");
1843 return showWithoutActivating.
isValid() && showWithoutActivating.
toBool();
1848 WINDOWPLACEMENT windowPlacement;
1849 windowPlacement.length =
sizeof(WINDOWPLACEMENT);
1850 if (GetWindowPlacement(hwnd, &windowPlacement)) {
1851 windowPlacement.showCmd = SW_SHOWMINIMIZED;
1853 SetWindowPlacement(hwnd, &windowPlacement);
1860 WINDOWPLACEMENT windowPlacement;
1861 windowPlacement.length =
sizeof(WINDOWPLACEMENT);
1862 if (GetWindowPlacement(hwnd, &windowPlacement)) {
1864 windowPlacement.flags |= WPF_RESTORETOMAXIMIZED;
1866 windowPlacement.flags &= ~WPF_RESTORETOMAXIMIZED;
1867 SetWindowPlacement(hwnd, &windowPlacement);
1872void QWindowsWindow::show_sys()
const
1874 int sm = SW_SHOWNORMAL;
1875 bool fakedMaximize =
false;
1876 bool restoreMaximize =
false;
1878 const Qt::WindowFlags
flags =
w->flags();
1880 if (
w->isTopLevel()) {
1881 const Qt::WindowStates
state =
w->windowStates();
1883 sm = SW_SHOWMINIMIZED;
1885 sm = SW_SHOWMINNOACTIVE;
1887 restoreMaximize =
true;
1889 updateTransientParent();
1891 sm = SW_SHOWMAXIMIZED;
1899 fakedMaximize = TRUE;
1906 sm = SW_SHOWNOACTIVATE;
1911 ShowWindow(m_data.
hwnd, sm);
1915 if (fakedMaximize) {
1917 SetWindowPos(m_data.
hwnd,
nullptr, 0, 0, 0, 0,
1918 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER
1919 | SWP_FRAMECHANGED);
1921 if (restoreMaximize)
1927 qCDebug(lcQpaWindow) << __FUNCTION__ <<
window() << newParent;
1930 setParent_sys(newParent);
1937 HWND newParentHWND =
nullptr;
1940 newParentHWND = parentW->
handle();
1945 HWND desktopHwnd = GetDesktopWindow();
1946 if (oldParentHWND == desktopHwnd)
1947 oldParentHWND =
nullptr;
1948 if (newParentHWND == desktopHwnd)
1949 newParentHWND =
nullptr;
1951 if (newParentHWND != oldParentHWND) {
1952 const bool wasTopLevel = oldParentHWND ==
nullptr;
1953 const bool isTopLevel = newParentHWND ==
nullptr;
1956 SetParent(m_data.
hwnd, newParentHWND);
1963 setDropSiteEnabled(
false);
1981 &&
w->format().hasAlpha())
2000 const UINT dpi = UINT(wParam);
2021 const UINT dpi = HIWORD(wParam);
2030 if (!IsZoomed(hwnd))
2049 if (!m_inSetgeometry) {
2051 const auto prcNewWindow =
reinterpret_cast<RECT *
>(lParam);
2052 SetWindowPos(hwnd,
nullptr, prcNewWindow->left, prcNewWindow->top,
2053 prcNewWindow->right - prcNewWindow->left,
2054 prcNewWindow->bottom - prcNewWindow->top, SWP_NOZORDER | SWP_NOACTIVATE);
2059 handleGeometryChange();
2069 const UINT dpi = GetDpiForWindow(hwnd);
2078 QRect scaledGeometry =
QRect(currentGeometry.topLeft() *
scale, currentGeometry.size() *
scale);
2085 wp.length =
sizeof(WINDOWPLACEMENT);
2086 if (GetWindowPlacement(hwnd, &wp)) {
2096 const bool fakeFullScreen =
2099 const QMargins margins = fakeFullScreen
2106 const QRect &requestedRect,
2107 const QRect &obtainedRect,
2116 debug <<
"Unable to set geometry ";
2118 debug <<
" (frame: ";
2120 debug <<
") on " <<
window->metaObject()->className() <<
"/\""
2121 <<
window->objectName() <<
"\" on \"" <<
window->screen()->name()
2122 <<
"\". Resulting geometry: ";
2124 debug <<
" (frame: ";
2126 debug <<
") margins: ";
2128 if (!customMargins.
isNull()) {
2129 debug <<
" custom margin: ";
2132 const auto minimumSize =
window->minimumSize();
2133 const bool hasMinimumSize = !minimumSize.isEmpty();
2135 debug <<
" minimum size: " << minimumSize.width() <<
'x' << minimumSize.height();
2136 const auto maximumSize =
window->maximumSize();
2139 debug <<
" maximum size: " << maximumSize.width() <<
'x' << maximumSize.height();
2140 if (hasMinimumSize || hasMaximumSize) {
2141 MINMAXINFO minmaxInfo;
2142 memset(&minmaxInfo, 0,
sizeof(minmaxInfo));
2144 debug <<
' ' << minmaxInfo;
2189 handleGeometryChange();
2197 && IsZoomed(m_data.
hwnd)) {
2198 const int resizedWidth = LOWORD(lParam);
2199 const int resizedHeight = HIWORD(lParam);
2201 const HMONITOR monitor = MonitorFromWindow(m_data.
hwnd, MONITOR_DEFAULTTOPRIMARY);
2202 MONITORINFO monitorInfo = {};
2203 monitorInfo.cbSize =
sizeof(MONITORINFO);
2204 GetMonitorInfoW(monitor, &monitorInfo);
2206 int correctLeft = monitorInfo.rcMonitor.left;
2207 int correctTop = monitorInfo.rcMonitor.top;
2208 int correctWidth = monitorInfo.rcWork.right - monitorInfo.rcWork.left;
2209 int correctHeight = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top;
2213 correctLeft -= borderWidth;
2214 correctTop -= borderWidth;
2215 correctWidth += borderWidth * 2;
2216 correctHeight += borderWidth * 2;
2219 if (resizedWidth != correctWidth || resizedHeight != correctHeight) {
2220 qCDebug(lcQpaWindow) << __FUNCTION__ <<
"correcting: " << resizedWidth <<
"x"
2221 << resizedHeight <<
" -> " << correctWidth <<
"x" << correctHeight;
2222 SetWindowPos(m_data.
hwnd,
nullptr, correctLeft, correctTop, correctWidth, correctHeight,
2223 SWP_NOZORDER | SWP_NOACTIVATE);
2231 case SIZE_MINIMIZED:
2235 case SIZE_MAXIMIZED:
2236 handleGeometryChange();
2242 handleGeometryChange();
2244 if (isFullScreen_sys())
2245 handleWindowStateChange(
2270 if (newScreen ==
nullptr || newScreen == currentScreen)
2278 qCDebug(lcQpaWindow).noquote().nospace() << __FUNCTION__
2279 <<
' ' <<
window() <<
" \"" << (currentScreen ? currentScreen->name() :
QString())
2280 <<
"\"->\"" << newScreen->name() <<
'"';
2282 QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(
window(), newScreen->screen());
2285void QWindowsWindow::handleGeometryChange()
2298 fireFullExpose(
true);
2322 << margins <<
" to " <<
rect
2326 const HWND hwnd =
handle();
2327 WINDOWPLACEMENT windowPlacement;
2328 windowPlacement.length =
sizeof(WINDOWPLACEMENT);
2329 GetWindowPlacement(hwnd, &windowPlacement);
2332 if ((windowPlacement.showCmd == SW_MAXIMIZE && !IsWindowVisible(hwnd))
2333 || windowPlacement.showCmd == SW_SHOWMINIMIZED) {
2334 windowPlacement.rcNormalPosition =
2336 windowPlacement.showCmd = windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWMINIMIZED : SW_HIDE;
2337 result = SetWindowPlacement(hwnd, &windowPlacement);
2341 const HWND parentHandle = GetParent(hwnd);
2344 GetClientRect(parentHandle, &
rect);
2367 SetLayout(m_hdc, 0);
2382 ReleaseDC(
handle(), m_hdc);
2389#if QT_CONFIG(dynamicgl)
2398 WPARAM, LPARAM, LRESULT *
result)
2400 if (
message == WM_ERASEBKGND) {
2405 if (!
window()->
isVisible() && (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LAYERED) != 0)
2408 if (!GetUpdateRect(m_data.
hwnd, 0, FALSE))
2415 InvalidateRect(hwnd,
nullptr,
false);
2417 BeginPaint(hwnd, &ps);
2426 EndPaint(hwnd, &ps);
2437 qCDebug(lcQpaWindow) <<
'>' << __FUNCTION__ <<
this <<
window() <<
"\n from: "
2443 m_data = setWindowFlags_sys(
flags);
2452 if (oldGeometry != newGeometry)
2453 handleGeometryChange();
2455 qCDebug(lcQpaWindow) <<
'<' << __FUNCTION__ <<
"\n returns: "
2456 << m_data.
flags <<
" geometry " << oldGeometry <<
"->" << newGeometry;
2460 unsigned flags)
const
2464 creationData.applyWindowFlags(m_data.
hwnd);
2465 creationData.initialize(
window(), m_data.
hwnd,
true, m_opacity);
2469 result.embedded = creationData.embedded;
2470 result.hasFrame = (creationData.style & (WS_DLGFRAME | WS_THICKFRAME))
2475void QWindowsWindow::handleWindowStateChange(Qt::WindowStates
state)
2478 <<
"\n from " << m_windowState <<
" to " <<
state;
2479 m_windowState =
state;
2486 WINDOWPLACEMENT windowPlacement{};
2487 windowPlacement.length =
sizeof(WINDOWPLACEMENT);
2488 GetWindowPlacement(m_data.
hwnd, &windowPlacement);
2490 windowPlacement.rcNormalPosition =
geometry;
2491 SetWindowPlacement(m_data.
hwnd, &windowPlacement);
2496 bool exposeEventsSent =
false;
2499 exposeEventsSent =
true;
2505 if (platformWindow && platformWindow->
isLayered()) {
2506 platformWindow->fireFullExpose();
2507 exposeEventsSent =
true;
2524 setWindowState_sys(
state);
2525 m_windowState =
state;
2529bool QWindowsWindow::isFullScreen_sys()
const
2532 if (!
w->isTopLevel())
2552void QWindowsWindow::setWindowState_sys(Qt::WindowStates
newState)
2554 const Qt::WindowStates oldState = m_windowState;
2557 qCDebug(lcQpaWindow) <<
'>' << __FUNCTION__ <<
this <<
window()
2558 <<
" from " << oldState <<
" to " <<
newState;
2561 auto stateChange = oldState ^
newState;
2565 UINT newStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
2569 if (!m_savedStyle) {
2570 m_savedStyle =
style();
2574 m_savedFrameGeometry = nf;
2581 if (m_savedStyle & WS_SYSMENU)
2582 newStyle |= WS_SYSMENU;
2584 newStyle |= WS_VISIBLE;
2586 newStyle |= WS_BORDER;
2588 const HMONITOR monitor = MonitorFromWindow(m_data.
hwnd, MONITOR_DEFAULTTONEAREST);
2589 MONITORINFO monitorInfo = {};
2590 monitorInfo.cbSize =
sizeof(MONITORINFO);
2591 GetMonitorInfoW(monitor, &monitorInfo);
2592 const QRect screenGeometry(monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.top,
2593 monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left,
2594 monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top);
2600 const UINT swpf = SWP_FRAMECHANGED | SWP_NOACTIVATE;
2603 SetWindowPos(m_data.
hwnd, HWND_TOP, screenGeometry.left(), screenGeometry.top(), screenGeometry.width(), screenGeometry.height(), swpf);
2612 unsigned newStyle = m_savedStyle ? m_savedStyle :
style();
2614 newStyle |= WS_VISIBLE;
2621 if (
const auto platformScreen =
screen->handle()) {
2622 if (!platformScreen->geometry().intersects(m_savedFrameGeometry))
2623 m_savedFrameGeometry.
moveTo(platformScreen->geometry().topLeft());
2631 UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
2632 if (!m_savedFrameGeometry.
isValid())
2633 swpf |= SWP_NOSIZE | SWP_NOMOVE;
2639 ShowWindow(m_data.
hwnd, SW_SHOWNOACTIVATE);
2640 SetWindowPos(m_data.
hwnd,
nullptr, m_savedFrameGeometry.
x(), m_savedFrameGeometry.
y(),
2641 m_savedFrameGeometry.
width(), m_savedFrameGeometry.
height(), swpf);
2647 ShowWindow(m_data.
hwnd,
2653 m_savedFrameGeometry =
QRect();
2660 ShowWindow(m_data.
hwnd,
2672 ShowWindow(m_data.
hwnd,
2686 SetWindowLongPtr(m_data.
hwnd, GWL_STYLE,
s);
2693 SetWindowLongPtr(m_data.
hwnd, GWL_EXSTYLE,
s);
2698 switch (
event->type()) {
2726 auto *windowPos =
reinterpret_cast<WINDOWPOS *
>(
message->lParam);
2727 const QRect suggestedFrameGeometry(windowPos->x, windowPos->y,
2728 windowPos->cx, windowPos->cy);
2729 const QRect suggestedGeometry = suggestedFrameGeometry - margins;
2736 if (!(windowPos->flags & SWP_NOSIZE) && suggestedGeometry.size() != qWindow->geometry().size())
2737 windowPos->flags |= SWP_NOCOPYBITS;
2739 if ((windowPos->flags & SWP_NOZORDER) == 0) {
2741 QWindow *parentWindow = qWindow->parent();
2742 HWND parentHWND = GetAncestor(windowPos->hwnd, GA_PARENT);
2743 HWND desktopHWND = GetDesktopWindow();
2744 platformWindow->m_data.
embedded = !parentWindow && parentHWND && (parentHWND != desktopHWND);
2747 windowPos->hwndInsertAfter = HWND_BOTTOM;
2749 if (!qWindow->isTopLevel())
2751 if (windowPos->flags & SWP_NOSIZE)
2754 if (!correctedGeometryF.isValid())
2756 const QRect correctedFrameGeometry = correctedGeometryF.toRect() + margins;
2757 if (correctedFrameGeometry == suggestedFrameGeometry)
2759 windowPos->x = correctedFrameGeometry.
left();
2760 windowPos->y = correctedFrameGeometry.top();
2761 windowPos->cx = correctedFrameGeometry.width();
2762 windowPos->cy = correctedFrameGeometry.height();
2785 if (GetMenu(m_data.
hwnd))
2788 calculateFullFrameMargins();
2791void QWindowsWindow::calculateFullFrameMargins()
2806 GetWindowRect(
handle(), &windowRect);
2807 GetClientRect(
handle(), &clientRect);
2823 const int yDiff = (windowRect.bottom - windowRect.top) - (clientRect.bottom - clientRect.top);
2824 const bool typicalFrame = (actualMargins.left() == actualMargins.right())
2825 && (actualMargins.right() == actualMargins.bottom());
2827 const QMargins adjustedMargins = typicalFrame ?
2828 QMargins(actualMargins.left(), (yDiff - actualMargins.bottom()),
2829 actualMargins.right(), actualMargins.bottom())
2864 return CreateRectRgn(
r.left(),
r.top(),
r.x() +
r.width(),
r.y() +
r.height());
2870 HRGN
result = CreateRectRgn(0, 0, 0, 0);
2871 if (CombineRgn(
result, *winRegion, rectRegion, RGN_OR)) {
2872 DeleteObject(*winRegion);
2875 DeleteObject(rectRegion);
2882 const auto end = region.
end();
2894 SetWindowRgn(m_data.
hwnd,
nullptr,
true);
2902 OffsetRgn(winRegion, margins.
left(), margins.
top());
2906 if (!SetWindowRgn(m_data.
hwnd, winRegion,
true))
2907 DeleteObject(winRegion);
2919 || activationBehavior != QWindowsApplication::AlwaysActivateWindow) {
2920 SetForegroundWindow(m_data.
hwnd);
2921 SetFocus(m_data.
hwnd);
2932 "Windows with Qt::WindowStaysOnBottomHint can't be brought to the foreground.";
2937 "Windows with Qt::WindowStaysOnTopHint will always be on the foreground.";
2941 qCWarning(lcQpaWindow) <<
"ToolTip windows should not be activated.";
2946 if (!IsWindowVisible(m_data.
hwnd))
2947 ShowWindow(m_data.
hwnd, SW_SHOW);
2949 if (IsIconic(m_data.
hwnd)) {
2950 ShowWindow(m_data.
hwnd, SW_RESTORE);
2957 const HWND oldForegroundWindow = GetForegroundWindow();
2958 if (!oldForegroundWindow)
2963 if (SendMessageTimeoutW(oldForegroundWindow, WM_NULL, 0, 0,
2964 SMTO_BLOCK | SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 1000,
nullptr) == 0) {
2965 qCWarning(lcQpaWindow) <<
"The foreground window hangs, can't activate current window.";
2969 const DWORD windowThreadProcessId = GetWindowThreadProcessId(oldForegroundWindow,
nullptr);
2970 const DWORD currentThreadId = GetCurrentThreadId();
2972 AttachThreadInput(windowThreadProcessId, currentThreadId, TRUE);
2973 const auto cleanup =
qScopeGuard([windowThreadProcessId, currentThreadId](){
2974 AttachThreadInput(windowThreadProcessId, currentThreadId, FALSE);
2977 BringWindowToTop(m_data.
hwnd);
2981 SetActiveWindow(m_data.
hwnd);
2987 qWarning(
"%s: No handle", __FUNCTION__);
2990 qCDebug(lcQpaWindow) << __FUNCTION__ <<
this <<
window() << grab;
2997 context->setKeyGrabber(
nullptr);
3006 qWarning(
"%s: No handle", __FUNCTION__);
3010 qWarning(
"%s: Not setting mouse grab for invisible window %s/'%s'",
3019 SetCapture(m_data.
hwnd);
3063 PostMessage(m_data.
hwnd, WM_SYSCOMMAND, 0xF012 , 0);
3086 if (!
w->isTopLevel()
3092 const QSize minimumSize =
w->minimumSize();
3095 const QSize maximumSize =
w->maximumSize();
3096 const bool fixedWidth = minimumSize.
width() == maximumSize.
width();
3097 const bool fixedHeight = minimumSize.
height() == maximumSize.
height();
3098 if (!fixedWidth && !fixedHeight)
3103 if (localPos.
y() >=
size.height()) {
3107 if (localPos.
y() < 0) {
3109 if (localPos.
y() < topResizeBarPos) {
3115 if (fixedWidth && (localPos.
x() < 0 || localPos.
x() >=
size.width())) {
3139 if (underMouse ==
w)
3141 for (
const QWindow *
p = underMouse;
p ;
p =
p->parent()) {
3145 if (platformWindow && !platformWindow->
cursor()->
isNull())
3166 if (m_cursor->
isNull()) {
3174 SetCursor(m_cursor->
handle());
3182 bool changed =
c->handle() != m_cursor->
handle();
3192 <<
c->handle() <<
" doApply=" << apply;
3215 UINT timeOutMs = GetCaretBlinkTime();
3216 if (!timeOutMs || timeOutMs == INFINITE)
3222 info.dwFlags = FLASHW_TRAY;
3223 info.dwTimeout = timeOutMs;
3224 info.uCount = durationMs == 0 ? 10 : UINT(durationMs) / timeOutMs;
3225 FlashWindowEx(&
info);
3233 info.dwFlags = FLASHW_STOP;
3236 FlashWindowEx(&
info);
3241 return (
style() & WS_DISABLED) == 0;
3246 const unsigned oldStyle =
style();
3247 unsigned newStyle = oldStyle;
3249 newStyle &= ~WS_DISABLED;
3251 newStyle |= WS_DISABLED;
3253 if (newStyle != oldStyle)
3273 m_iconSmall =
createHIcon(
icon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
3274 m_iconBig =
createHIcon(
icon, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
3277 SendMessage(m_data.
hwnd, WM_SETICON, 0 , LPARAM(m_iconSmall));
3278 SendMessage(m_data.
hwnd, WM_SETICON, 1 , LPARAM(m_iconBig));
3280 SendMessage(m_data.
hwnd, WM_SETICON, 0 , LPARAM(m_iconSmall));
3281 SendMessage(m_data.
hwnd, WM_SETICON, 1 , LPARAM(m_iconSmall));
3298 const BOOL darkBorder =
d ? TRUE : FALSE;
3303 qCWarning(lcQpaWindow,
"%s: Unable to set %s window border.", __FUNCTION__,
d ?
"dark" :
"light");
3317 return m_menuBar.
data();
3345 qCWarning(lcQpaWindow) <<
"You should not set custom margins for a frameless window.";
3353 const QPoint topLeft = currentFrameGeometry.topLeft();
3355 newFrame.
moveTo(topLeft);
3356 qCDebug(lcQpaWindow) << __FUNCTION__ << oldCustomMargins <<
"->" << newCustomMargins
3357 << currentFrameGeometry <<
"->" << newFrame;
3358 SetWindowPos(m_data.
hwnd,
nullptr, newFrame.
x(), newFrame.
y(), newFrame.
width(), newFrame.
height(), SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE);
3364#if QT_CONFIG(vulkan)
3373 qWarning(
"Attempted to create Vulkan surface without an instance; was QWindow::setVulkanInstance() called?");
3377 return &m_vkSurface;
3379#elif defined(QT_NO_OPENGL)
3387 m_surface = staticOpenGLContext->createWindowSurface(m_data.
hwnd, nativeConfig, err);
3398#if QT_CONFIG(vulkan)
3403 m_vkSurface = VK_NULL_HANDLE;
3409 staticOpenGLContext->destroyWindowSurface(m_surface);
3410 m_surface =
nullptr;
3424 if (currentTouchTypes.has_value() && currentTouchTypes.value() == touchTypes)
3428 ULONG touchFlags = 0;
3429 if (touchTypes.testFlag(TouchWindowTouchType::FineTouch))
3430 touchFlags |= TWF_FINETOUCH;
3431 if (touchTypes.testFlag(TouchWindowTouchType::WantPalmTouch))
3432 touchFlags |= TWF_WANTPALM;
3433 if (RegisterTouchWindow(m_data.
hwnd, touchFlags))
3449 m_borderInFullScreenDefault =
border;
3467 LONG_PTR
style = GetWindowLongPtr(
handle(), GWL_STYLE);
3471 style &= ~WS_BORDER;
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
int lightness() const noexcept
@ ApplicationPaletteChange
static Qt::ApplicationState applicationState()
static QWindowList topLevelWindows()
Returns a list of the top-level windows in the application.
static QWindowList allWindows()
Returns a list of all the windows in the application.
QScreen * primaryScreen
the primary (or default) screen of the application.
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
Qt::LayoutDirection layoutDirection
the default layout direction for this application
static qreal roundScaleFactor(qreal rawFactor)
static qreal factor(C *context)
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
static bool isDebugBuild() noexcept Q_DECL_CONST_FUNCTION
qsizetype size() const noexcept
const T & constFirst() const noexcept
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr bool isNull() const noexcept
Returns true if all margins are is 0; otherwise returns false.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
QObject * parent() const
Returns a pointer to the parent object.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
static OpenGLModuleType openGLModuleType()
Returns the underlying OpenGL implementation type.
static QWindowsOpengl32DLL opengl32
The QPalette class contains color groups for each widget state.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
T * data() const noexcept
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
constexpr QRect marginsRemoved(const QMargins &margins) const noexcept
Removes the margins from the rectangle, shrinking it.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr void setSize(const QSize &s) noexcept
Sets the size of the rectangle to the given size.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void moveTo(int x, int t) noexcept
Moves the rectangle, leaving the top-left corner at the given position (x, y).
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
The QRegion class specifies a clip region for a painter.
const_iterator end() const noexcept
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
const_iterator begin() const noexcept
The QScreen class is used to query screen properties. \inmodule QtGui.
QRect availableGeometry
the screen's available geometry in pixels
QRect geometry
the screen's geometry in pixels
QPlatformScreen * handle() const
Get the platform screen handle.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr int & rheight() noexcept
Returns a reference to the height.
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
constexpr int & rwidth() noexcept
Returns a reference to the width.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
QChar * data()
Returns a pointer to the data stored in the QString.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
static QWindowPrivate * get(QWindow *window)
static bool flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Make Qt Gui process all events on the event queue immediately.
static void handleGeometryChange(QWindow *window, const QRect &newRect)
static bool handleExposeEvent(QWindow *window, const QRegion ®ion)
static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState=-1)
Base class for QWindowsForeignWindow, QWindowsWindow.
virtual bool isTopLevel() const
QMargins frameMargins_sys() const
bool isTopLevel_sys() const
void setHasBorderInFullScreen(bool border) override
QMargins customMargins() const override
bool hasBorderInFullScreen() const override
static QWindowsBaseWindow * baseWindowOf(const QWindow *w)
virtual QMargins fullFrameMargins() const
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.
static bool isRtlLayout(HWND hwnd)
QRect frameGeometry_sys() const
QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes TouchWindowTouchTypes
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
void setWindowTitle_sys(const QString &title)
Singleton container for all relevant information.
static bool shouldHaveNonClientDpiScaling(const QWindow *window)
static void forceNcCalcSize(HWND hwnd)
static QWindowsContext * instance()
Platform cursor implementation.
static bool hasOverrideCursor()
static HCURSOR createCursorFromShape(Qt::CursorShape cursorShape, const QPlatformScreen *screen=nullptr)
static void enforceOverrideCursor()
HWND handle() const override
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.
QWindowsForeignWindow(QWindow *window, HWND hwnd)
static QWindowsStaticOpenGLContext * staticOpenGLContext()
static QWindowsIntegration * instance()
Implementation of IDropTarget.
Manages a list of QWindowsScreen.
const QWindowsScreen * screenAtDp(const QPoint &p) const
const WindowsScreenList & screens() const
static bool isSingleScreen()
static QWindowsTheme * instance()
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)
void checkForScreenChanged(ScreenChangeMode mode=FromGeometryChange)
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)
QPlatformScreen * screenForGeometry(const QRect &newGeometry) const
Helper function for finding the new screen for newGeometry in response to a geometry changed event.
~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)
bool setMouseGrabEnabled(bool grab) override
void propagateSizeHints() override
Reimplement to propagate the size hints of the QWindow.
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)
static void displayChanged()
bool setKeyboardGrabEnabled(bool grab) override
static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity)
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
void handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam)
void registerTouchWindow()
QMargins frameMargins() const override
void setWindowIcon(const QIcon &icon) override
Reimplement to set the window icon to icon.
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 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
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)
void updateFullFrameMargins()
QRect geometry() const override
Returns the current geometry of a window.
@ SynchronousGeometryChangeEvent
@ WithinSetParent
Automatic mouse capture on button press.
@ DisableNonClientScaling
@ FrameStrutEventsEnabled
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 updateRestoreGeometry()
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 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
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 ®ion) 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.
QSet< QString >::iterator it
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
void qErrnoWarning(const char *msg,...)
T fromNativePixels(const T &value, const C *context)
QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *window)
Combined button and popup list for selecting options.
Q_GUI_EXPORT void clearThemeCache(HWND hwnd)
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & showbase(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::ShowBase) on stream and r...
QTextStream & noforcesign(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() & ~QTextStream::ForceSign) on stream and...
QTextStream & uppercasedigits(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::UppercaseDigits) on strea...
QTextStream & noshowbase(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() & ~QTextStream::ShowBase) on stream and ...
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
QTextStream & forcesign(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::ForceSign) on stream and ...
@ WindowContextHelpButtonHint
@ WindowStaysOnBottomHint
@ MSWindowsFixedSizeDialogHint
@ WindowMaximizeButtonHint
@ WindowMinimizeButtonHint
@ WindowMinMaxButtonsHint
@ WindowTransparentForInput
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
int qRound(qfloat16 d) noexcept
QPair< qreal, qreal > QDpi
#define qCWarning(category,...)
#define qCDebug(category,...)
#define SIZE(large, small, mini)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLuint64 GLenum void * handle
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLfloat GLfloat GLfloat GLfloat h
GLfloat GLfloat GLfloat alpha
GLenum GLenum GLenum GLenum GLenum scale
static bool hasAlpha(const QImage &image)
QDebug warning(QAnyStringView fileName, int lineNumber)
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
#define qPrintable(string)
#define QStringLiteral(str)
#define QT_CONFIG(feature)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
QTextStreamManipulator qSetPadChar(QChar ch)
QTextStreamManipulator qSetFieldWidth(int width)
#define Q_UNIMPLEMENTED()
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
QSharedPointer< CursorHandle > CursorHandlePtr
bool testFlag(MaskType mask, FlagType flag)
static const auto windowClassName
static QSize toNativeSizeConstrained(QSize dip, const QScreen *s)
static void fixTopLevelWindowFlags(Qt::WindowFlags &flags)
static QString msgUnableToSetGeometry(const QWindowsWindow *platformWindow, const QRect &requestedRect, const QRect &obtainedRect, const QMargins &fullMargins, const QMargins &customMargins)
static bool shouldOmitFrameAdjustment(const Qt::WindowFlags flags, DWORD style)
static QRect normalFrameGeometry(HWND hwnd)
static void formatBriefRectangle(QDebug &d, const QRect &r)
static bool testShowWithoutActivating(const QWindow *window)
static bool shouldShowMaximizeButton(const QWindow *w, Qt::WindowFlags flags)
Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &)
static void setMinimizedGeometry(HWND hwnd, const QRect &r)
static bool applyNewCursor(const QWindow *w)
static bool isSoftwareGl()
static HICON createHIcon(const QIcon &icon, int xSize, int ySize)
static void updateGLWindowSettings(const QWindow *w, HWND hwnd, Qt::WindowFlags flags, qreal opacity)
@ DwmwaUseImmersiveDarkMode
@ DwmwaUseImmersiveDarkModeBefore20h1
static void addRectToWinRegion(const QRect &rect, HRGN *winRegion)
static QByteArray debugWinSwpPos(UINT flags)
static HRGN createRectRegion(const QRect &r)
static QByteArray debugWinStyle(DWORD style)
static QScreen * screenForDeviceName(const QWindow *w, const QString &name)
static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point)
static bool applyBlurBehindWindow(HWND hwnd)
QDebug operator<<(QDebug d, const RECT &r)
static void setRestoreMaximizedFlag(HWND hwnd, bool set=true)
static RECT RECTfromQRect(const QRect &rect)
static QRect frameGeometry(HWND hwnd, bool topLevel)
static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bool accelerated, qreal level)
static QMargins invisibleMargins(QPoint screenPoint)
Calculates the dimensions of the invisible borders within the window frames which only exist on Windo...
static int getResizeBorderThickness(const UINT dpi)
static bool windowIsAccelerated(const QWindow *w)
static bool equalDpi(const QDpi &d1, const QDpi &d2)
static void formatBriefMargins(QDebug &d, const QMargins &m)
static QByteArray debugWindowPlacementFlags(const UINT flags)
static QSize qSizeOfRect(const RECT &rect)
static DWORD edgesToWinOrientation(Qt::Edges edges)
static bool shouldApplyDarkFrame(const QWindow *w)
static QByteArray debugWinExStyle(DWORD exStyle)
static CursorHandlePtr defaultCursor(const QWindow *w)
static QByteArray debugShowWindowCmd(const UINT cmd)
static HRGN qRegionToWinRegion(const QRegion ®ion)
static QPoint calcPosition(const QWindow *w, const QWindowCreationContextPtr &context, const QMargins &invMargins)
static QRect qrectFromRECT(const RECT &rect)
QSharedPointer< QWindowCreationContext > QWindowCreationContextPtr
static QWindow::Visibility windowVisibility_sys(HWND hwnd)
static void screenToClient(HWND hwnd, POINT *wP)
const char className[16]
[1]
QFuture< QSet< QChar > > set
[10]
if(qFloatDistance(a, b)<(1<< 7))
[0]
obj metaObject() -> className()
static GpuDescription detect()
Active Context for creating windows.
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
QRect requestedGeometryIn
Stores geometry constraints and provides utility functions.
static QMargins frameOnPrimaryScreen(const QWindow *w, DWORD style, DWORD exStyle)
static bool positionIncludesFrame(const QWindow *w)
static void frameSizeConstraints(const QWindow *w, const QScreen *screen, const QMargins &margins, QSize *minimumSize, QSize *maximumSize)
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 void applyToMinMaxInfo(const QWindow *w, const QScreen *screen, const QMargins &margins, MINMAXINFO *mmi)
static bool handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result)
QMargins fullFrameMargins
static QWindowsWindowData create(const QWindow *w, const QWindowsWindowData ¶meters, const QString &title)
void applyWindowFlags(HWND hwnd) const
void initialize(const QWindow *w, HWND h, bool frameChange, qreal opacityLevel) const
QWindowsWindowData WindowData
WindowData create(const QWindow *w, const WindowData &data, QString title) const
void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags=0)