6#include <QtWaylandCompositor/QWaylandXdgSurface>
7#include <QtWaylandCompositor/QWaylandCompositor>
8#include <QtWaylandCompositor/QWaylandSeat>
24 , m_toplevel(m_xdgSurface->toplevel())
25 , grabberState(GrabberState::
Default)
41 handlePopupCreated(item, popup);
43 connect(m_xdgSurface->
surface(), &QWaylandSurface::destinationSizeChanged,
this, &XdgToplevelIntegration::handleSurfaceSizeChanged);
51 return filterMouseMoveEvent(mouseEvent);
53 return filterPointerReleaseEvent();
56 return filterTouchUpdateEvent(touchEvent);
61bool XdgToplevelIntegration::filterPointerMoveEvent(
const QPointF &scenePosition)
63 if (grabberState == GrabberState::Resize) {
64 if (!resizeState.initialized) {
65 resizeState.initialMousePos = scenePosition;
66 resizeState.initialized =
true;
70 QSize newSize = m_toplevel->
sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges);
72 }
else if (grabberState == GrabberState::Move) {
74 if (!moveState.initialized) {
75 moveState.initialOffset = moveItem->
mapFromItem(
nullptr, scenePosition);
76 moveState.initialized =
true;
82 moveItem->
setPosition(parentPos - moveState.initialOffset);
89 if (
event->pointCount() == 0)
104 return filterPointerMoveEvent(
event->scenePosition());
107bool XdgToplevelIntegration::filterPointerReleaseEvent()
109 if (grabberState != GrabberState::Default) {
110 grabberState = GrabberState::Default;
116void XdgToplevelIntegration::handleStartMove(
QWaylandSeat *seat)
118 grabberState = GrabberState::Move;
119 moveState.seat =
seat;
120 moveState.initialized =
false;
123void XdgToplevelIntegration::handleStartResize(
QWaylandSeat *seat, Qt::Edges edges)
125 grabberState = GrabberState::Resize;
126 resizeState.seat =
seat;
127 resizeState.resizeEdges = edges;
131 resizeState.initialized =
false;
134void XdgToplevelIntegration::handleSetMaximized()
147 disconnect(nonwindowedState.sizeChangedConnection);
148 nonwindowedState.output = m_item->
view()->
output();
150 handleMaximizedSizeChanged();
153void XdgToplevelIntegration::handleMaximizedSizeChanged()
157 if (m_toplevel ==
nullptr)
160 m_toplevel->
sendMaximized(nonwindowedState.output->availableGeometry().size() / nonwindowedState.output->scaleFactor());
163void XdgToplevelIntegration::handleUnsetMaximized()
170 if (windowedGeometry.initialWindowSize.isValid())
176void XdgToplevelIntegration::handleMaximizedChanged()
182 qCWarning(qLcWaylandCompositor) <<
"The view does not have a corresponding output,"
183 <<
"ignoring maximized state";
190void XdgToplevelIntegration::handleSetFullscreen()
203 disconnect(nonwindowedState.sizeChangedConnection);
204 nonwindowedState.output = m_item->
view()->
output();
206 handleFullscreenSizeChanged();
209void XdgToplevelIntegration::handleFullscreenSizeChanged()
213 if (m_toplevel ==
nullptr)
216 m_toplevel->
sendFullscreen(nonwindowedState.output->geometry().size() / nonwindowedState.output->scaleFactor());
219void XdgToplevelIntegration::handleUnsetFullscreen()
226 if (windowedGeometry.initialWindowSize.isValid())
232void XdgToplevelIntegration::handleFullscreenChanged()
238 qCWarning(qLcWaylandCompositor) <<
"The view does not have a corresponding output,"
239 <<
"ignoring fullscreen state";
246void XdgToplevelIntegration::handleActivatedChanged()
252void XdgToplevelIntegration::handleSurfaceSizeChanged()
254 if (grabberState == GrabberState::Resize) {
266void XdgToplevelIntegration::handleToplevelDestroyed()
269 nonwindowedState.output =
nullptr;
270 disconnect(nonwindowedState.sizeChangedConnection);
276 , m_popup(m_xdgSurface->popup())
281 handleGeometryChanged();
285 handlePopupCreated(item, popup);
289void XdgPopupIntegration::handleGeometryChanged()
294 const QPoint itemPosition = m_item->mapFromSurface(surfacePosition).toPoint();
299 qWarning() <<
"XdgPopupIntegration popup item without output" << m_item;
307#include "moc_qwaylandxdgshellintegration_p.cpp"
The QEventPoint class provides information about a point in a QPointerEvent.
QPointF scenePosition
the scene position of this point.
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.
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 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...
QQuickItem * parentItem() const
void setPosition(const QPointF &)
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 int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
The QTouchEvent class contains parameters that describe a touch event.
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
Q_INVOKABLE QPointF mapToSurface(const QPointF &point) const
\qmlmethod point WaylandQuickItem::mapToSurface(point point)
QWaylandView * view() const
Returns the view rendered by this QWaylandQuickItem.
void setSurface(QWaylandSurface *surface)
QWaylandCompositor * compositor
\qmlproperty WaylandCompositor QtWayland.Compositor::WaylandQuickItem::compositor
QWaylandSurface * surface
\qmlproperty WaylandSurface QtWayland.Compositor::WaylandQuickItem::surface
\inmodule QtWaylandCompositor
QWaylandQuickShellSurfaceItem * maybeCreateAutoPopup(QWaylandShellSurface *shellSurface)
static QWaylandQuickShellSurfaceItemPrivate * get(QWaylandQuickShellSurfaceItem *item)
\qmltype ShellSurfaceItem \instantiates QWaylandQuickShellSurfaceItem \inherits WaylandQuickItem \inq...
QQuickItem * moveItem
\qmlproperty Item QtWayland.Compositor::ShellSurfaceItem::moveItem
QWaylandShellSurface * shellSurface
\qmlproperty ShellSurface QtWayland.Compositor::ShellSurfaceItem::shellSurface
\qmltype WaylandSeat \instantiates QWaylandSeat \inqmlmodule QtWayland.Compositor
QSize destinationSize
\qmlproperty size QtWayland.Compositor::WaylandSurface::destinationSize
bool isPrimary() const
Returns true if this QWaylandView is the primary view for the QWaylandSurface.
QWaylandOutput * output
\qmlproperty WaylandOutput QtWayland.Compositor::WaylandView::output
\qmltype XdgPopup \instantiates QWaylandXdgPopup \inqmlmodule QtWayland.Compositor....
void configuredGeometryChanged()
QWaylandXdgSurface * parentXdgSurface
\qmlproperty XdgSurface XdgPopup::parentXdgSurface
QPoint unconstrainedPosition
\qmlproperty point XdgPopup::unconstrainedPosition
QWaylandXdgSurface * xdgSurface
\qmlproperty XdgSurface XdgPopup::xdgSurface
void popupCreated(QWaylandXdgPopup *popup, QWaylandXdgSurface *xdgSurface)
\qmlsignal XdgShell::popupCreated(XdgPopup popup, XdgSurface xdgSurface)
\qmltype XdgSurface \instantiates QWaylandXdgSurface \inqmlmodule QtWayland.Compositor....
QWaylandSurface * surface
\qmlproperty WaylandSurface XdgSurface::surface
QRect windowGeometry
\qmlproperty rect XdgSurface::windowGeometry
QWaylandXdgShell * shell
\qmlproperty XdgShell XdgSurface::shell
Q_INVOKABLE uint sendMaximized(const QSize &size)
\qmlmethod void XdgToplevel::sendMaximized(size size)
void setFullscreen(QWaylandOutput *output)
Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const
\qmlmethod size XdgToplevel::sizeForResize(size size, point delta, uint edges)
Q_INVOKABLE uint sendResizing(const QSize &maxSize)
\qmlmethod void XdgToplevel::sendResizing(size maxSize)
Q_INVOKABLE uint sendUnmaximized(const QSize &size=QSize(0, 0))
\qmlmethod void XdgToplevel::sendUnmaximized(size size)
bool maximized
\qmlproperty bool XdgToplevel::maximized
void startMove(QWaylandSeat *seat)
QList< int > states
This property holds the last states the client acknowledged for this QWaylandToplevel.
void startResize(QWaylandSeat *seat, Qt::Edges edges)
Q_INVOKABLE uint sendFullscreen(const QSize &size)
\qmlmethod void XdgToplevel::sendFullscreen(size size)
bool activated
\qmlproperty bool XdgToplevel::activated
bool fullscreen
\qmlproperty bool XdgToplevel::fullscreen
XdgPopupIntegration(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.
XdgToplevelIntegration(QWaylandQuickShellSurfaceItem *item)
Combined button and popup list for selecting options.
static void handlePopupCreated(QWaylandQuickShellSurfaceItem *parentItem, QWaylandXdgPopup *popup)
#define qCWarning(category,...)
T qobject_cast(QObject *object)
\variable QObject::staticMetaObject
GLenum GLuint GLintptr offset
static QT_BEGIN_NAMESPACE const uint Default
myObject disconnect()
[26]