6#include <QtWaylandClient/private/qwaylanddisplay_p.h>
7#include <QtWaylandClient/private/qwaylandwindow_p.h>
8#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
9#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
10#include <QtWaylandClient/private/qwaylandscreen_p.h>
11#include <QtWaylandClient/private/qwaylandextendedsurface_p.h>
13#include <QtCore/QDebug>
21 ,
QtWayland::wl_shell_surface(shell_surface)
29 if (
type ==
Qt::Popup && transientParent && transientParent->wlSurface())
31 else if (transientParent && transientParent->wlSurface())
32 updateTransientParent(transientParent->window());
39 wl_shell_surface_destroy(
object());
40 delete m_extendedWindow;
45 enum resize resizeEdges = convertToResizeEdges(
edges);
59 return QtWayland::wl_shell_surface::set_title(
title);
64 return QtWayland::wl_shell_surface::set_class(appId);
70 m_extendedWindow->raise();
76 m_extendedWindow->lower();
104 if (m_pending.states != m_applied.states)
107 if (!m_pending.size.isEmpty()) {
110 if (m_pending.edges & resize_left)
111 x = m_applied.size.width() - m_pending.size.width();
112 if (m_pending.edges & resize_top)
113 y = m_applied.size.height() - m_pending.size.height();
116 }
else if (m_pending.size.isValid() && !m_normalSize.
isEmpty()) {
120 m_applied = m_pending;
131 Qt::WindowStates changedStates = m_pending.states ^
states;
132 Qt::WindowStates addedStates = changedStates &
states;
135 qCWarning(lcQpaWayland) <<
"Minimizing is not supported on wl-shell. Consider using xdg-shell instead.";
138 set_maximized(
nullptr);
143 set_fullscreen(WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0,
nullptr);
152 m_pending.size = {0, 0};
153 m_pending.edges = resize_none;
157 m_pending.states =
states &
~Qt::WindowMinimized;
162 return static_cast<enum
resize>(
164 | ((
edges &
Qt::BottomEdge) ? resize_bottom : 0)
165 | ((
edges &
Qt::LeftEdge) ? resize_left : 0)
166 | ((
edges &
Qt::RightEdge) ? resize_right : 0));
169void QWaylandWlShellSurface::setTopLevel()
177 const QVariant showWithoutActivating =
window->property(
"_q_showWithoutActivating");
178 return showWithoutActivating.
isValid() && showWithoutActivating.
toBool();
181void QWaylandWlShellSurface::updateTransientParent(
QWindow *
parent)
184 if (!parent_wayland_window)
189 transientPos -=
parent->geometry().topLeft();
190 if (parent_wayland_window->decoration()) {
191 transientPos.
setX(transientPos.
x() + parent_wayland_window->decoration()->margins().left());
192 transientPos.
setY(transientPos.
y() + parent_wayland_window->decoration()->margins().top());
200 flags |= WL_SHELL_SURFACE_TRANSIENT_INACTIVE;
202 auto *parentSurface = parent_wayland_window->wlSurface();
204 set_transient(parentSurface, transientPos.
x(), transientPos.
y(),
flags);
210 if (!parent_wayland_window) {
211 qCWarning(lcQpaWayland) <<
"setPopup called without a parent window";
215 qCWarning(lcQpaWayland) <<
"setPopup called without an input device";
221 transientPos -= parent_wayland_window->geometry().topLeft();
222 if (parent_wayland_window->decoration()) {
223 transientPos.
setX(transientPos.
x() + parent_wayland_window->decoration()->margins().left());
224 transientPos.
setY(transientPos.
y() + parent_wayland_window->decoration()->margins().top());
227 auto *parentSurface = parent_wayland_window->wlSurface();
230 set_popup(
device->wl_seat(), serial, parentSurface, transientPos.
x(), transientPos.
y(),
flags);
242 if (m_pending.edges && !m_pending.size.isEmpty())
243 m_normalSize = m_pending.size;
256#include "moc_qwaylandwlshellsurface_p.cpp"
IOBluetoothDevice * device
The QCloseEvent class contains parameters that describe a close event.
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
QObject * parent() const
Returns a pointer to the parent object.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr void setY(int y) noexcept
Sets the y coordinate of this point to the given y coordinate.
constexpr int y() const noexcept
Returns the y coordinate of this point.
constexpr void setX(int x) noexcept
Sets the x coordinate of this point to the given x coordinate.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
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.
void setPopup(QWaylandSeat *seat, QWaylandSurface *parentSurface, const QPoint &relativeToParent)
QWaylandWlShellSurface()
Constructs a QWaylandWlShellSurface.
Qt::WindowFlags flags
the window flags of the window
QtWayland::qt_surface_extension * windowExtension() const
uint32_t lastInputSerial() const
QWaylandInputDevice * lastInputDevice() const
void setContentOrientationMask(Qt::ScreenOrientations mask)
Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags)
void updateGenericProperty(const QString &name, const QVariant &value)
QWaylandWindow * window()
void handleWindowStatesChanged(Qt::WindowStates states)
QWaylandWindow * transientParent() const
void applyConfigureWhenPossible()
QWaylandDisplay * display() const
void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset={0, 0})
void shell_surface_configure(uint32_t edges, int32_t width, int32_t height) override
bool resize(QWaylandInputDevice *inputDevice, Qt::Edges edges) override
void applyConfigure() override
void setAppId(const QString &appId) override
void shell_surface_popup_done() override
void shell_surface_ping(uint32_t serial) override
void sendProperty(const QString &name, const QVariant &value) override
void setWindowFlags(Qt::WindowFlags flags) override
bool wantsDecorations() const override
void setTitle(const QString &title) override
bool move(QWaylandInputDevice *inputDevice) override
~QWaylandWlShellSurface() override
friend class QWaylandWindow
void setContentOrientationMask(Qt::ScreenOrientations orientation) override
void requestWindowStates(Qt::WindowStates states) override
Combined button and popup list for selecting options.
static bool testShowWithoutActivating(const QWindow *window)
@ WindowTransparentForInput
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qCWarning(category,...)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr offset
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent