6#include <QtWaylandCompositor/QWaylandCompositor>
7#include <QtWaylandCompositor/QWaylandWlShellSurface>
8#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
9#include <QtWaylandCompositor/QWaylandSeat>
39void WlShellIntegration::handleStartMove(
QWaylandSeat *seat)
41 grabberState = GrabberState::Move;
42 moveState.seat =
seat;
43 moveState.initialized =
false;
48 grabberState = GrabberState::Resize;
49 resizeState.seat =
seat;
50 resizeState.resizeEdges = edges;
52 resizeState.initialized =
false;
55void WlShellIntegration::handleSetDefaultTopLevel()
64 nextState = State::Windowed;
69 nonwindowedState.output =
nullptr;
70 disconnect(nonwindowedState.sizeChangedConnection);
73void WlShellIntegration::handleSetTransient(
QWaylandSurface *parentSurface,
const QPoint &relativeToParent,
bool inactive)
88 if (currentState == State::Maximized)
92 if (!designatedOutput)
95 if (currentState == State::Windowed)
98 nextState = State::Maximized;
102 disconnect(nonwindowedState.sizeChangedConnection);
103 nonwindowedState.output = designatedOutput;
105 handleMaximizedSizeChanged();
108void WlShellIntegration::handleMaximizedSizeChanged()
113 if (nextState == State::Maximized) {
115 auto scaleFactor = designatedOutput->
scaleFactor();
128 if (currentState == State::FullScreen)
132 if (!designatedOutput)
135 if (currentState == State::Windowed)
138 nextState = State::FullScreen;
139 finalPosition = designatedOutput->
position();
142 disconnect(nonwindowedState.sizeChangedConnection);
143 nonwindowedState.output = designatedOutput;
145 handleFullScreenSizeChanged();
148void WlShellIntegration::handleFullScreenSizeChanged()
153 if (nextState == State::FullScreen) {
165 const auto views =
parent->views();
184 m_item->
setPosition(m_item->mapFromSurface(relativeToParent));
189 auto shell = m_shellSurface->
shell();
191 shell->closeAllPopups();
195 this, &WlShellIntegration::handleSurfaceHasContentChanged);
198void WlShellIntegration::handlePopupClosed()
200 handlePopupRemoved();
203 this, &WlShellIntegration::handleSurfaceHasContentChanged);
206void WlShellIntegration::handlePopupRemoved()
213qreal WlShellIntegration::devicePixelRatio()
const
215 return m_item->
window() ? m_item->
window()->devicePixelRatio() : 1;
218void WlShellIntegration::handleShellSurfaceDestroyed()
221 handlePopupRemoved();
224 nonwindowedState.output =
nullptr;
225 disconnect(nonwindowedState.sizeChangedConnection);
227 m_shellSurface =
nullptr;
230void WlShellIntegration::handleSurfaceHasContentChanged()
238void WlShellIntegration::handleRedraw()
240 if (currentState == nextState)
243 m_item->
moveItem()->
setPosition(nextState == State::Windowed ? normalPosition : finalPosition);
244 currentState = nextState;
247void WlShellIntegration::adjustOffsetForNextFrame(
const QPointF &
offset)
260 return filterMouseMoveEvent(mouseEvent);
263 return filterMouseReleaseEvent(mouseEvent);
270 if (grabberState == GrabberState::Resize) {
272 if (!resizeState.initialized) {
273 resizeState.initialMousePos =
event->scenePosition();
274 resizeState.initialized =
true;
278 QPointF delta = (
event->scenePosition() - resizeState.initialMousePos) / scaleFactor * devicePixelRatio();
279 QSize newSize = m_shellSurface->
sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges);
280 m_shellSurface->
sendConfigure(newSize, resizeState.resizeEdges);
281 }
else if (grabberState == GrabberState::Move) {
284 if (!moveState.initialized) {
285 moveState.initialOffset = moveItem->
mapFromItem(
nullptr,
event->scenePosition());
286 moveState.initialized =
true;
292 moveItem->
setPosition(parentPos - moveState.initialOffset);
300 if (grabberState != GrabberState::Default) {
301 grabberState = GrabberState::Default;
311#include "moc_qwaylandwlshellintegration_p.cpp"
bool isEmpty() const noexcept
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Q_INVOKABLE QPointF mapFromItem(const QQuickItem *item, const QPointF &point) const
Maps the given point in item's coordinate system to the equivalent point within this item's coordinat...
void setParentItem(QQuickItem *parent)
QQuickWindow * window() const
Returns the window in which this item is rendered.
QQuickItem * parentItem() const
void setPosition(const QPointF &)
QQmlListProperty< QQuickTransform > transform
\qmlproperty list<Transform> QtQuick::Item::transform This property holds the list of transformations...
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.
\qmltype WaylandOutput \instantiates QWaylandOutput \inqmlmodule QtWayland.Compositor
void availableGeometryChanged()
QPoint position
\qmlproperty point QtWayland.Compositor::WaylandOutput::position
QRect availableGeometry
\qmlproperty rect QtWayland.Compositor::WaylandOutput::availableGeometry
QRect geometry
\qmlproperty rect QtWayland.Compositor::WaylandOutput::geometry
int scaleFactor
\qmlproperty int QtWayland.Compositor::WaylandOutput::scaleFactor
virtual void takeFocus(QWaylandSeat *device=nullptr)
Calling this function causes the item to take the focus of the input device.
QWaylandView * view() const
Returns the view rendered by this QWaylandQuickItem.
void setSurface(QWaylandSurface *surface)
QWaylandCompositor * compositor
\qmlproperty WaylandCompositor QtWayland.Compositor::WaylandQuickItem::compositor
static void startFilter(QWaylandClient *client, CallbackFunction closePopupCallback)
static void cancelFilter()
\inmodule QtWaylandCompositor
\qmltype ShellSurfaceItem \instantiates QWaylandQuickShellSurfaceItem \inherits WaylandQuickItem \inq...
QQuickItem * moveItem
\qmlproperty Item QtWayland.Compositor::ShellSurfaceItem::moveItem
\qmltype WaylandSeat \instantiates QWaylandSeat \inqmlmodule QtWayland.Compositor
FocusPolicy focusPolicy
\qmlproperty enumeration Shell::focusPolicy
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
QSize destinationSize
\qmlproperty size QtWayland.Compositor::WaylandSurface::destinationSize
void offsetForNextFrame(const QPoint &offset)
QWaylandClient * client
\qmlproperty WaylandClient QtWayland.Compositor::WaylandSurface::client
\qmltype WaylandView \instantiates QWaylandView \inqmlmodule QtWayland.Compositor
bool isPrimary() const
Returns true if this QWaylandView is the primary view for the QWaylandSurface.
QWaylandOutput * output
\qmlproperty WaylandOutput QtWayland.Compositor::WaylandView::output
\qmltype WlShellSurface \instantiates QWaylandWlShellSurface \inqmlmodule QtWayland....
void setPopup(QWaylandSeat *seat, QWaylandSurface *parentSurface, const QPoint &relativeToParent)
void setFullScreen(FullScreenMethod method, uint framerate, QWaylandOutput *output)
QWaylandWlShell * shell
\qmlproperty WlShell WlShellSurface::shell
void setMaximized(QWaylandOutput *output)
void startResize(QWaylandSeat *seat, ResizeEdge edges)
Q_INVOKABLE void sendConfigure(const QSize &size, ResizeEdge edges)
\qmlmethod void WlShellSurface::sendConfigure(size s, enum edges)
void startMove(QWaylandSeat *seat)
void setTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, bool inactive)
ResizeEdge
This enum type provides a way to specify an edge or corner of the surface.
Qt::WindowType windowType() const override
\qmlproperty enum WlShellSurface::windowType
QWaylandSurface * surface
\qmlproperty WaylandSurface WlShellSurface::surface
void setDefaultToplevel()
Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, ResizeEdge edges)
QList< QWaylandWlShellSurface * > mappedPopups() const
~WlShellIntegration() override
WlShellIntegration(QWaylandQuickShellSurfaceItem *item)
bool eventFilter(QObject *object, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
T qobject_cast(QObject *object)
\variable QObject::staticMetaObject
GLenum GLuint GLintptr offset
QT_BEGIN_NAMESPACE typedef uchar * output
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent