7#include <qpa/qplatformscreen.h>
8#include <qpa/qwindowsysteminterface.h>
10#include <private/qwindow_p.h>
11#include <private/qguiapplication_p.h>
17 , m_positionIncludesFrame(
false)
19 , m_pendingGeometryChangeOnShow(true)
20 , m_frameMarginsRequested(frameMarginsEnabled)
31 m_windowForWinIdHash[m_winId] =
this;
38 m_windowForWinIdHash.
remove(m_winId);
48 setFrameMarginsEnabled(m_frameMarginsRequested);
49 setGeometryImpl(
rect);
54void QOffscreenWindow::setGeometryImpl(
const QRect &
rect)
57 if (adjusted.
width() <= 0)
59 if (adjusted.
height() <= 0)
62 if (m_positionIncludesFrame) {
66 if (adjusted.
left() < m_margins.
left())
68 if (adjusted.
top() < m_margins.
top())
78 m_pendingGeometryChangeOnShow =
true;
84 if (visible == m_visible)
91 if (m_pendingGeometryChangeOnShow) {
92 m_pendingGeometryChangeOnShow =
false;
102 QWindowSystemInterface::handleLeaveEvent<QWindowSystemInterface::SynchronousDelivery>
113 windowUnderMouse->mapFromGlobal(cursorPos),
138void QOffscreenWindow::setFrameMarginsEnabled(
bool enabled)
142 && (
parent() ==
nullptr)) {
152 m_positionIncludesFrame =
false;
159 setGeometryImpl(
screen()->availableGeometry().adjusted(m_margins.
left(), m_margins.
top(), -m_margins.
right(), -m_margins.
bottom()));
161 setGeometryImpl(m_normalGeometry);
168 return m_windowForWinIdHash.
value(
id,
nullptr);
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
static QWindow * currentMouseWindow
static QWindow * topLevelAt(const QPoint &pos)
Returns the top level window at the given position pos, if any.
bool remove(const Key &key)
Removes the item that has the key from the hash.
T value(const Key &key) const noexcept
constexpr int bottom() const noexcept
Returns the bottom margin.
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.
static QPlatformWindow * windowContainingCursor
QOffscreenWindow(QWindow *window, bool frameMarginsEnabled)
void setWindowState(Qt::WindowStates states) override
Requests setting the window state of this surface to type.
static QOffscreenWindow * windowForWinId(WId id)
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
QMargins frameMargins() 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.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setWidth(int w) noexcept
Sets the width of the rectangle to the given width.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr void translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr void setHeight(int h) noexcept
Sets the height of the rectangle to the given height.
The QRegion class specifies a clip region for a painter.
static QWindowPrivate * get(QWindow *window)
PositionPolicy positionPolicy
static void handleGeometryChange(QWindow *window, const QRect &newRect)
static bool handleExposeEvent(QWindow *window, const QRegion ®ion)
static void handleWindowActivated(QWindow *window, Qt::FocusReason r=Qt::OtherFocusReason)
static void handleEnterEvent(QWindow *window, const QPointF &local=QPointF(), const QPointF &global=QPointF())
static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState=-1)
Combined button and popup list for selecting options.
@ ActiveWindowFocusReason
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint GLboolean enabled
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)