4#ifndef QWINDOWSWINDOW_H
5#define QWINDOWSWINDOW_H
7#include <QtCore/qt_windows.h>
8#include <QtCore/qpointer.h>
12#include <qpa/qplatformwindow.h>
13#include <qpa/qplatformwindow_p.h>
35 DWORD style, DWORD exStyle);
38 const QMargins &margins, MINMAXINFO *mmi);
55 const QRect &geometryIn,
const QRect &geometry,
57 DWORD style, DWORD exStyle);
122 unsigned style()
const {
return GetWindowLongPtr(
handle(), GWL_STYLE); }
123 unsigned exStyle()
const {
return GetWindowLongPtr(
handle(), GWL_EXSTYLE); }
153 HWND
handle()
const override {
return m_hwnd; }
173 HWND
handle()
const override {
return m_hwnd; }
177 DWORD m_topLevelStyle;
322 inline bool testFlag(
unsigned f)
const {
return (m_flags &
f) != 0; }
330 void *
surface(
void *nativeConfig,
int *err);
357 inline void show_sys()
const;
359 inline bool isFullScreen_sys()
const;
360 inline void setWindowState_sys(Qt::WindowStates
newState);
362 inline void updateTransientParent()
const;
363 void destroyWindow();
364 inline bool isDropSiteEnabled()
const {
return m_dropTarget !=
nullptr; }
365 void setDropSiteEnabled(
bool enabled);
366 void updateDropSite(
bool topLevel);
367 void handleGeometryChange();
368 void handleWindowStateChange(Qt::WindowStates
state);
369 inline void destroyIcon();
370 void fireExpose(
const QRegion ®ion,
bool force=
false);
371 void fireFullExpose(
bool force=
false);
372 void calculateFullFrameMargins();
384 unsigned m_savedStyle = 0;
385 QRect m_savedFrameGeometry;
386 HICON m_iconSmall =
nullptr;
387 HICON m_iconBig =
nullptr;
388 void *m_surface =
nullptr;
391 static bool m_screenForGLInitialized;
395 VkSurfaceKHR m_vkSurface = VK_NULL_HANDLE;
397 static bool m_borderInFullScreenDefault;
398 static bool m_inSetgeometry;
401#ifndef QT_NO_DEBUG_STREAM
415 GetClientRect(hwnd, &clientArea);
416 wP->x = clientArea.right - wP->x;
418 ClientToScreen(hwnd, wP);
423 ScreenToClient(hwnd, wP);
426 GetClientRect(hwnd, &clientArea);
427 wP->x = clientArea.right - wP->x;
434 POINT
p = { qp.
x(), qp.
y() };
441 POINT
p = { qp.
x(), qp.
y() };
457 if (!
w || !
w->handle())
469 return reinterpret_cast<void *
>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
474 SetWindowLongPtr(hwnd, GWLP_USERDATA, LONG_PTR(ud));
477inline void QWindowsWindow::destroyIcon()
480 DestroyIcon(m_iconBig);
484 DestroyIcon(m_iconSmall);
485 m_iconSmall =
nullptr;
491 return GetWindowLongPtr(m_data.
hwnd, GWL_EXSTYLE) & WS_EX_LAYERED;
The QIcon class provides scalable icons in different modes and states.
Native interface to QPlatformWindow. \inmodule QtGui.
\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.
\inmodule QtCore\reentrant
The QRegion class specifies a clip region for a painter.
The QScreen class is used to query screen properties. \inmodule QtGui.
\macro QT_RESTRICTED_CAST_FROM_ASCII
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
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)
static bool isRtlLayout(HWND hwnd)
QRect frameGeometry_sys() const
QNativeInterface::Private::QWindowsApplication::TouchWindowTouchTypes TouchWindowTouchTypes
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
QRect geometry_sys() const
virtual HWND handle() const =0
QNativeInterface::Private::QWindowsApplication::TouchWindowTouchType TouchWindowTouchType
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)
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.
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
Implementation of IDropTarget.
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 ...
void setPreMoveRect(const QRect &rect)
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 aboutToMakeCurrent()
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.
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)
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.
QRect preMoveRect() const
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.
bool frameStrutEventsEnabled() const override
Reimplement this method to return whether frame strut events are enabled.
@ SynchronousGeometryChangeEvent
@ OpenGlPixelFormatInitialized
@ 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...
static QWindow * topTransientOf(QWindow *w)
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void updateRestoreGeometry()
void setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
void moveTransientChildren()
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)
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.
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static bool hasAlpha(const QImage &image)
static void clientToScreen(HWND hwnd, POINT *wP)
QDebug operator<<(QDebug d, const RECT &r)
static void screenToClient(HWND hwnd, POINT *wP)
Active Context for creating windows.
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 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