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
qwindowswindow.cpp File Reference

(11a1dad7d8a01d3d0ad4d2b0b8203745b21bc0ef)

#include <QtCore/qt_windows.h>
#include <QtGui/qpainter.h>
#include <QtGui/qpen.h>
#include <QtGui/qstylehints.h>
#include <QtGui/qtextoption.h>
#include "qwindowswindow.h"
#include "qwindowscontext.h"
#include "qwindowstheme.h"
#include "qwindowsscreen.h"
#include "qwindowsintegration.h"
#include "qwindowsmenu.h"
#include "qwindowsnativeinterface.h"
#include "qwindowsopenglcontext.h"
#include "qwindowsopengltester.h"
#include "qwindowswindowclassdescription.h"
#include "qwindowswindowclassregistry.h"
#include <QtGui/qguiapplication.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
#include <QtGui/qregion.h>
#include <QtGui/qopenglcontext.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/private/qwindowsthemecache_p.h>
#include <private/qwindow_p.h>
#include <private/qguiapplication_p.h>
#include <private/qhighdpiscaling_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <private/qsystemlibrary_p.h>
#include <private/qwinregistry_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qoperatingsystemversion.h>
#include <dwmapi.h>
#include <shellscalingapi.h>
#include <private/qdxgivsyncservice_p.h>
Include dependency graph for qwindowswindow.cpp:

Go to the source code of this file.

Classes

class  WindowCreationData
 Window creation code. More...

Macros

#define GWL_HWNDPARENT   (-8)

Typedefs

using QWindowCreationContextPtr = QSharedPointer<QWindowCreationContext>

Enumerations

enum  { defaultWindowWidth = 160 , defaultWindowHeight = 160 , defaultWindowWidth = 160 , defaultWindowHeight = 160 }
enum  : WORD { DwmwaUseImmersiveDarkMode = 20 , DwmwaUseImmersiveDarkModeBefore20h1 = 19 , DwmwaUseImmersiveDarkMode = 20 , DwmwaUseImmersiveDarkModeBefore20h1 = 19 }
enum  { defaultWindowWidth = 160 , defaultWindowHeight = 160 , defaultWindowWidth = 160 , defaultWindowHeight = 160 }
enum  : WORD { DwmwaUseImmersiveDarkMode = 20 , DwmwaUseImmersiveDarkModeBefore20h1 = 19 , DwmwaUseImmersiveDarkMode = 20 , DwmwaUseImmersiveDarkModeBefore20h1 = 19 }

Functions

Q_GUI_EXPORT HICON qt_pixmapToWinHICON (const QPixmap &)
static QByteArray debugWinStyle (DWORD style)
static QByteArray debugWinExStyle (DWORD exStyle)
static QByteArray debugWinSwpPos (UINT flagsflags)
static QByteArray debugWindowPlacementFlags (const UINT flagsflags)
static QByteArray debugShowWindowCmd (const UINT cmd)
static QSize qSizeOfRect (const RECT &rect)
static QRect qrectFromRECT (const RECT &rect)
static RECT RECTfromQRect (const QRect &rect)
QDebug operator<< (QDebug d, const RECT &rr)
QDebug operator<< (QDebug d, const POINT &pp)
QDebug operator<< (QDebug d, const WINDOWPOS &wp)
QDebug operator<< (QDebug d, const NCCALCSIZE_PARAMS &pp)
QDebug operator<< (QDebug d, const MINMAXINFO &i)
QDebug operator<< (QDebug d, const WINDOWPLACEMENT &wp)
QDebug operator<< (QDebug d, const GUID &guid)
static void formatBriefRectangle (QDebug &d, const QRect &rr)
static void formatBriefMargins (QDebug &d, const QMargins &mm)
static QPoint windowPlacementOffset (HWND hwnd, const QPoint &point)
static QRect frameGeometry (HWND hwnd, bool topLevel)
static QWindow::Visibility windowVisibility_sys (HWND hwnd)
static bool windowIsAccelerated (const QWindow *ww)
static bool applyBlurBehindWindow (HWND hwnd)
static bool shouldShowMaximizeButton (const QWindow *ww, Qt::WindowFlags flagsflags)
static void setWindowOpacity (HWND hwnd, Qt::WindowFlags flagsflags, bool hasAlpha, bool accelerated, qreal levellevel)
static int getResizeBorderThickness (const UINT dpi)
static QMargins invisibleMargins (QPoint screenPoint)
 Calculates the dimensions of the invisible borders within the window frames which only exist on Windows 10 and onwards.
static QMargins invisibleMargins (const HWND hwnd)
QDebug operator<< (QDebug debug, const WindowCreationData &d)
static void fixTopLevelWindowFlags (Qt::WindowFlags &flagsflags)
static QScreen * screenForDeviceName (const QWindow *ww, const QString &namename)
static QPoint calcPosition (const QWindow *ww, const QWindowCreationContextPtr &context, const QMargins &invMargins)
static bool shouldApplyDarkFrame (const QWindow *ww)
static int getTitleBarHeight_sys (const UINT dpi)
static QSize toNativeSizeConstrained (QSize dip, const QScreen *ss)
static bool shouldOmitFrameAdjustment (const Qt::WindowFlags flagsflags, DWORD style)
static bool shouldOmitFrameAdjustment (const Qt::WindowFlags flagsflags, HWND hwnd)
static bool testShowWithoutActivating (const QWindow *window)
static void setMinimizedGeometry (HWND hwnd, const QRect &rr)
static void setRestoreMaximizedFlag (HWND hwnd, bool set=true)
static QRect normalFrameGeometry (HWND hwnd)
static QString msgUnableToSetGeometry (const QWindowsWindow *platformWindow, const QRect &requestedRect, const QRect &obtainedRect, const QMargins &fullMargins, const QMargins &customMargins)
static bool equalDpi (const QDpi &d1, const QDpi &d2)
static bool isSoftwareGl ()
static bool isResize (const WINDOWPOS *windowPos)
static HRGN createRectRegion (const QRect &rr)
static void addRectToWinRegion (const QRect &rect, HRGN *winRegion)
static HRGN qRegionToWinRegion (const QRegion &region)
static DWORD edgesToWinOrientation (Qt::Edges edges)
static CursorHandlePtr defaultCursor (const QWindow *ww)
static bool applyNewCursor (const QWindow *ww)
static UINT primaryScreenDpi ()
static HICON createHIcon (const QIcon &icon, UINT dpi, int xSizeMetric, int ySizeMetric)

Macro Definition Documentation

◆ GWL_HWNDPARENT

#define GWL_HWNDPARENT   (-8)

Definition at line 66 of file qwindowswindow.cpp.

Typedef Documentation

◆ QWindowCreationContextPtr

Enumeration Type Documentation

◆ anonymous enum [1/2]

anonymous enum
Enumerator
defaultWindowWidth 
defaultWindowHeight 
defaultWindowWidth 
defaultWindowHeight 

Definition at line 75 of file qwindowswindow.cpp.

◆ anonymous enum [2/2]

anonymous enum
Enumerator
defaultWindowWidth 
defaultWindowHeight 
defaultWindowWidth 
defaultWindowHeight 

Definition at line 75 of file qwindowswindow.cpp.

◆ anonymous enum [1/2]

anonymous enum : WORD
Enumerator
DwmwaUseImmersiveDarkMode 
DwmwaUseImmersiveDarkModeBefore20h1 
DwmwaUseImmersiveDarkMode 
DwmwaUseImmersiveDarkModeBefore20h1 

Definition at line 3943 of file qwindowswindow.cpp.

◆ anonymous enum [2/2]

anonymous enum : WORD
Enumerator
DwmwaUseImmersiveDarkMode 
DwmwaUseImmersiveDarkModeBefore20h1 
DwmwaUseImmersiveDarkMode 
DwmwaUseImmersiveDarkModeBefore20h1 

Definition at line 3943 of file qwindowswindow.cpp.

Function Documentation

◆ addRectToWinRegion()

void addRectToWinRegion ( const QRect & rect,
HRGN * winRegion )
inlinestatic

Definition at line 3145 of file qwindowswindow.cpp.

◆ applyBlurBehindWindow()

bool applyBlurBehindWindow ( HWND hwnd)
static

Definition at line 464 of file qwindowswindow.cpp.

◆ applyNewCursor()

bool applyNewCursor ( const QWindow * w)
inlinestatic

Definition at line 3755 of file qwindowswindow.cpp.

References QWindowsContext::instance().

Here is the call graph for this function:

◆ calcPosition()

QPoint calcPosition ( const QWindow * w,
const QWindowCreationContextPtr & context,
const QMargins & invMargins )
static

Definition at line 681 of file qwindowswindow.cpp.

◆ createHIcon()

HICON createHIcon ( const QIcon & icon,
UINT dpi,
int xSizeMetric,
int ySizeMetric )
static

Definition at line 3889 of file qwindowswindow.cpp.

References QWindowsScreen::baseDpi.

◆ createRectRegion()

HRGN createRectRegion ( const QRect & r)
inlinestatic

Definition at line 3140 of file qwindowswindow.cpp.

◆ debugShowWindowCmd()

QByteArray debugShowWindowCmd ( const UINT cmd)
inlinestaticnodiscard

Definition at line 244 of file qwindowswindow.cpp.

◆ debugWindowPlacementFlags()

QByteArray debugWindowPlacementFlags ( const UINT flags)
inlinestaticnodiscard

Definition at line 231 of file qwindowswindow.cpp.

◆ debugWinExStyle()

QByteArray debugWinExStyle ( DWORD exStyle)
static

Definition at line 137 of file qwindowswindow.cpp.

◆ debugWinStyle()

QByteArray debugWinStyle ( DWORD style)
static

Definition at line 82 of file qwindowswindow.cpp.

◆ debugWinSwpPos()

QByteArray debugWinSwpPos ( UINT flags)
static

Definition at line 194 of file qwindowswindow.cpp.

◆ defaultCursor()

CursorHandlePtr defaultCursor ( const QWindow * w)
inlinestatic

Definition at line 3743 of file qwindowswindow.cpp.

◆ edgesToWinOrientation()

DWORD edgesToWinOrientation ( Qt::Edges edges)
inlinestatic

Definition at line 3311 of file qwindowswindow.cpp.

◆ equalDpi()

bool equalDpi ( const QDpi & d1,
const QDpi & d2 )
inlinestatic

Definition at line 2428 of file qwindowswindow.cpp.

◆ fixTopLevelWindowFlags()

void fixTopLevelWindowFlags ( Qt::WindowFlags & flags)
inlinestatic

Definition at line 637 of file qwindowswindow.cpp.

◆ formatBriefMargins()

void formatBriefMargins ( QDebug & d,
const QMargins & m )
static

Definition at line 382 of file qwindowswindow.cpp.

◆ formatBriefRectangle()

void formatBriefRectangle ( QDebug & d,
const QRect & r )
static

Definition at line 377 of file qwindowswindow.cpp.

◆ frameGeometry()

QRect frameGeometry ( HWND hwnd,
bool topLevel )
inlinestatic

Definition at line 403 of file qwindowswindow.cpp.

◆ getResizeBorderThickness()

int getResizeBorderThickness ( const UINT dpi)
inlinestaticnodiscard

Definition at line 533 of file qwindowswindow.cpp.

◆ getTitleBarHeight_sys()

int getTitleBarHeight_sys ( const UINT dpi)
inlinestatic

Definition at line 886 of file qwindowswindow.cpp.

◆ invisibleMargins() [1/2]

QMargins invisibleMargins ( const HWND hwnd)
inlinestaticnodiscard

Definition at line 561 of file qwindowswindow.cpp.

◆ invisibleMargins() [2/2]

QMargins invisibleMargins ( QPoint screenPoint)
static

Calculates the dimensions of the invisible borders within the window frames which only exist on Windows 10 and onwards.

Definition at line 547 of file qwindowswindow.cpp.

◆ isResize()

bool isResize ( const WINDOWPOS * windowPos)
static

Definition at line 2990 of file qwindowswindow.cpp.

◆ isSoftwareGl()

bool isSoftwareGl ( )
inlinestatic

Definition at line 2570 of file qwindowswindow.cpp.

Referenced by QWindowsWindow::handleWmPaint().

Here is the caller graph for this function:

◆ msgUnableToSetGeometry()

QString msgUnableToSetGeometry ( const QWindowsWindow * platformWindow,
const QRect & requestedRect,
const QRect & obtainedRect,
const QMargins & fullMargins,
const QMargins & customMargins )
static

Definition at line 2281 of file qwindowswindow.cpp.

◆ normalFrameGeometry()

QRect normalFrameGeometry ( HWND hwnd)
static

Definition at line 2248 of file qwindowswindow.cpp.

◆ operator<<() [1/8]

QDebug operator<< ( QDebug d,
const GUID & guid )

Definition at line 359 of file qwindowswindow.cpp.

◆ operator<<() [2/8]

QDebug operator<< ( QDebug d,
const MINMAXINFO & i )

Definition at line 336 of file qwindowswindow.cpp.

◆ operator<<() [3/8]

QDebug operator<< ( QDebug d,
const NCCALCSIZE_PARAMS & p )

Definition at line 327 of file qwindowswindow.cpp.

◆ operator<<() [4/8]

QDebug operator<< ( QDebug d,
const POINT & p )

Definition at line 308 of file qwindowswindow.cpp.

◆ operator<<() [5/8]

QDebug operator<< ( QDebug d,
const RECT & r )

Definition at line 298 of file qwindowswindow.cpp.

◆ operator<<() [6/8]

QDebug operator<< ( QDebug d,
const WINDOWPLACEMENT & wp )

Definition at line 347 of file qwindowswindow.cpp.

◆ operator<<() [7/8]

QDebug operator<< ( QDebug d,
const WINDOWPOS & wp )

Definition at line 316 of file qwindowswindow.cpp.

◆ operator<<() [8/8]

◆ primaryScreenDpi()

UINT primaryScreenDpi ( )
static

Definition at line 3876 of file qwindowswindow.cpp.

◆ qrectFromRECT()

QRect qrectFromRECT ( const RECT & rect)
inlinestatic

Definition at line 284 of file qwindowswindow.cpp.

◆ qRegionToWinRegion()

HRGN qRegionToWinRegion ( const QRegion & region)
static

Definition at line 3157 of file qwindowswindow.cpp.

◆ qSizeOfRect()

QSize qSizeOfRect ( const RECT & rect)
inlinestatic

Definition at line 279 of file qwindowswindow.cpp.

◆ qt_pixmapToWinHICON()

Q_GUI_EXPORT HICON qt_pixmapToWinHICON ( const QPixmap & p)

Definition at line 539 of file qpixmap_win.cpp.

◆ RECTfromQRect()

RECT RECTfromQRect ( const QRect & rect)
inlinestatic

Definition at line 289 of file qwindowswindow.cpp.

◆ screenForDeviceName()

QScreen * screenForDeviceName ( const QWindow * w,
const QString & name )
static

Definition at line 663 of file qwindowswindow.cpp.

◆ setMinimizedGeometry()

void setMinimizedGeometry ( HWND hwnd,
const QRect & r )
static

Definition at line 1989 of file qwindowswindow.cpp.

◆ setRestoreMaximizedFlag()

void setRestoreMaximizedFlag ( HWND hwnd,
bool set = true )
static

Definition at line 2000 of file qwindowswindow.cpp.

◆ setWindowOpacity()

void setWindowOpacity ( HWND hwnd,
Qt::WindowFlags flags,
bool hasAlpha,
bool accelerated,
qreal level )
static

Definition at line 517 of file qwindowswindow.cpp.

◆ shouldApplyDarkFrame()

bool shouldApplyDarkFrame ( const QWindow * w)
inlinestatic

Definition at line 869 of file qwindowswindow.cpp.

References QWindowsIntegration::instance().

Here is the call graph for this function:

◆ shouldOmitFrameAdjustment() [1/2]

bool shouldOmitFrameAdjustment ( const Qt::WindowFlags flags,
DWORD style )
static

Definition at line 1077 of file qwindowswindow.cpp.

◆ shouldOmitFrameAdjustment() [2/2]

bool shouldOmitFrameAdjustment ( const Qt::WindowFlags flags,
HWND hwnd )
static

Definition at line 1084 of file qwindowswindow.cpp.

◆ shouldShowMaximizeButton()

bool shouldShowMaximizeButton ( const QWindow * w,
Qt::WindowFlags flags )
static

Definition at line 481 of file qwindowswindow.cpp.

◆ testShowWithoutActivating()

bool testShowWithoutActivating ( const QWindow * window)
inlinestatic

Definition at line 1982 of file qwindowswindow.cpp.

◆ toNativeSizeConstrained()

QSize toNativeSizeConstrained ( QSize dip,
const QScreen * s )
static

Definition at line 1061 of file qwindowswindow.cpp.

◆ windowIsAccelerated()

bool windowIsAccelerated ( const QWindow * w)
inlinestatic

Definition at line 452 of file qwindowswindow.cpp.

Referenced by QWindowsWindow::handleCompositionSettingsChanged(), and WindowCreationData::initialize().

Here is the caller graph for this function:

◆ windowPlacementOffset()

QPoint windowPlacementOffset ( HWND hwnd,
const QPoint & point )
static

Definition at line 389 of file qwindowswindow.cpp.

References QWindowsContext::instance(), QWindowsScreenManager::screenAtDp(), and QWindowsContext::screenManager().

Here is the call graph for this function:

◆ windowVisibility_sys()

QWindow::Visibility windowVisibility_sys ( HWND hwnd)
static

Definition at line 431 of file qwindowswindow.cpp.