void QWaylandWindow::setVisible(bool visible) { if (visible) { if (window()->type() == Qt::Popup && transientParent()) { QWaylandWindow *parent = transientParent(); mMouseDevice = parent->mMouseDevice; mMouseSerial = parent->mMouseSerial; QWaylandWlShellSurface *wlshellSurface = dynamic_cast<QWaylandWlShellSurface*>(mShellSurface); if (mMouseDevice && wlshellSurface) { wlshellSurface->setPopup(transientParent(), mMouseDevice, mMouseSerial); } } setGeometry(window()->geometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). } else { QWindowSystemInterface::handleExposeEvent(window(), QRegion()); // when flushing the event queue, it could contain a close event, in which // case 'this' will be deleted. When that happens, we must abort right away. QPointer<QWaylandWindow> deleteGuard(this); QWindowSystemInterface::flushWindowSystemEvents(); if (!deleteGuard.isNull()) { attach(static_cast<QWaylandBuffer *>(0), 0, 0); commit(); if (mBackingStore) { mBackingStore->hidden(); } } } }
void ClientWindowQuickItem::mousePressEvent(QMouseEvent *event) { Q_D(ClientWindowQuickItem); // Let mouse press go through anyway, if focus on click is enabled this // will give focus to the window before the use can drag it QWaylandQuickShellSurfaceItem::mousePressEvent(event); // If the modifier is pressed we initiate a move operation if (d->isModifierHeld && event->buttons().testFlag(Qt::LeftButton)) { QWaylandWlShellSurface *wlShellSurface = qobject_cast<QWaylandWlShellSurface *>(shellSurface()); if (wlShellSurface) { Q_EMIT wlShellSurface->startMove(compositor()->defaultSeat()); return; } QWaylandXdgSurface *xdgSurface = qobject_cast<QWaylandXdgSurface *>(shellSurface()); if (xdgSurface) { Q_EMIT xdgSurface->startMove(compositor()->defaultSeat()); return; } } }
void QWaylandWindow::setVisible(bool visible) { if (visible) { if (window()->type() == Qt::Popup) { QWaylandWindow *parent = transientParent(); if (!parent) { // Try with the current focus window. It should be the right one and anyway // better than having no parent at all. parent = mDisplay->lastInputWindow(); } if (parent) { QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface); if (wlshellSurface) wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); } } setGeometry(window()->geometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). } else { QWindowSystemInterface::handleExposeEvent(window(), QRegion()); // when flushing the event queue, it could contain a close event, in which // case 'this' will be deleted. When that happens, we must abort right away. QPointer<QWaylandWindow> deleteGuard(this); QWindowSystemInterface::flushWindowSystemEvents(); if (!deleteGuard.isNull()) { attach(static_cast<QWaylandBuffer *>(0), 0, 0); commit(); if (mBackingStore) { mBackingStore->hidden(); } } } }