diff options
-rw-r--r-- | examples/qml-compositor/main.cpp | 4 | ||||
-rw-r--r-- | examples/qwindow-compositor/qwindowcompositor.cpp | 14 | ||||
-rw-r--r-- | examples/qwindow-compositor/qwindowcompositor.h | 2 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquicksurface.cpp | 2 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.cpp | 9 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.h | 3 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurfaceitem.cpp | 4 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurfaceitem.h | 2 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlshellsurface.cpp | 6 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlshellsurface_p.h | 3 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlsurface.cpp | 26 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlsurface_p.h | 2 |
12 files changed, 36 insertions, 41 deletions
diff --git a/examples/qml-compositor/main.cpp b/examples/qml-compositor/main.cpp index 7ebcb6c29..dbabc9d04 100644 --- a/examples/qml-compositor/main.cpp +++ b/examples/qml-compositor/main.cpp @@ -95,10 +95,6 @@ public slots: private slots: void surfaceMapped() { QWaylandQuickSurface *surface = qobject_cast<QWaylandQuickSurface *>(sender()); - //Ignore surface if it's not a window surface - if (!surface->hasShellSurface()) - return; - emit windowAdded(QVariant::fromValue(surface)); } void surfaceUnmapped() { diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp index aa6afd7aa..b485064f1 100644 --- a/examples/qwindow-compositor/qwindowcompositor.cpp +++ b/examples/qwindow-compositor/qwindowcompositor.cpp @@ -191,11 +191,10 @@ void QWindowCompositor::surfaceMapped() } else { m_surfaces.removeOne(surface); } - //Sometimes surfaces dont have shell_surfaces, so don't render them - if (surface->hasShellSurface()) { - m_surfaces.append(surface); - defaultInputDevice()->setKeyboardFocus(surface); - } + + m_surfaces.append(surface); + defaultInputDevice()->setKeyboardFocus(surface); + m_renderScheduler.start(0); } @@ -245,8 +244,9 @@ void QWindowCompositor::sendExpose() surface->sendOnScreenVisibilityChange(true); } -void QWindowCompositor::updateCursor() +void QWindowCompositor::updateCursor(bool hasBuffer) { + Q_UNUSED(hasBuffer) if (!m_cursorSurface) return; @@ -270,7 +270,7 @@ QPointF QWindowCompositor::toSurface(QWaylandSurface *surface, const QPointF &po void QWindowCompositor::setCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY) { if ((m_cursorSurface != surface) && surface) - connect(surface, SIGNAL(configure()), this, SLOT(updateCursor())); + connect(surface, SIGNAL(configure(bool)), this, SLOT(updateCursor(bool))); m_cursorSurface = surface; m_cursorHotspotX = hotspotX; diff --git a/examples/qwindow-compositor/qwindowcompositor.h b/examples/qwindow-compositor/qwindowcompositor.h index 3ecbdbc1a..c84bb9145 100644 --- a/examples/qwindow-compositor/qwindowcompositor.h +++ b/examples/qwindow-compositor/qwindowcompositor.h @@ -85,7 +85,7 @@ protected: private slots: void sendExpose(); - void updateCursor(); + void updateCursor(bool hasBuffer); private: QOpenGLWindow *m_window; diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp index e4a5f7732..1ce229d21 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.cpp +++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp @@ -196,7 +196,7 @@ void QWaylandQuickSurface::setUseTextureAlpha(bool useTextureAlpha) if (d->useTextureAlpha != useTextureAlpha) { d->useTextureAlpha = useTextureAlpha; emit useTextureAlphaChanged(); - emit configure(); + emit configure(d->buffer->bufferRef); } } diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index 5fd7fabe9..80b37e419 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -288,15 +288,6 @@ QString QWaylandSurface::title() const return d->title(); } -bool QWaylandSurface::hasShellSurface() const -{ - Q_D(const QWaylandSurface); - if (d->shellSurface()) - return true; - - return false; -} - bool QWaylandSurface::hasInputPanelSurface() const { Q_D(const QWaylandSurface); diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h index 22deee5ae..d5a30551c 100644 --- a/src/compositor/compositor_api/qwaylandsurface.h +++ b/src/compositor/compositor_api/qwaylandsurface.h @@ -161,7 +161,6 @@ public: QString title() const; - bool hasShellSurface() const; bool hasInputPanelSurface() const; bool transientInactive() const; @@ -203,7 +202,7 @@ signals: void pong(); void surfaceDestroyed(); - void configure(); + void configure(bool hasBuffer); void redraw(); }; diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index 1a1dc7cdb..f000e7f8b 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp @@ -309,8 +309,10 @@ void QWaylandSurfaceItem::setPaintEnabled(bool enabled) update(); } -void QWaylandSurfaceItem::updateBuffer() +void QWaylandSurfaceItem::updateBuffer(bool hasBuffer) { + Q_UNUSED(hasBuffer) + bool inv = m_yInverted; m_yInverted = surface()->isYInverted(); if (inv != m_yInverted) diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h index f1da27995..1e6363305 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.h +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h @@ -108,7 +108,7 @@ private slots: void updateSize(); void updateSurfaceSize(); void updatePosition(); - void updateBuffer(); + void updateBuffer(bool hasBuffer); signals: void touchEventsEnabledChanged(); diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp index 8762d365f..ce8e84757 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp @@ -103,6 +103,7 @@ ShellSurface::ShellSurface(Shell *shell, wl_client *client, uint32_t id, Surface , m_popupSerial() { surface->setShellSurface(this); + connect(surface->waylandSurface(), &QWaylandSurface::configure, this, &ShellSurface::configure); } void ShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height) @@ -186,6 +187,11 @@ void ShellSurface::mapPopup() } } +void ShellSurface::configure(bool hasBuffer) +{ + m_surface->setMapped(hasBuffer); +} + void ShellSurface::shell_surface_destroy_resource(Resource *) { if (m_popupGrabber) diff --git a/src/compositor/wayland_wrapper/qwlshellsurface_p.h b/src/compositor/wayland_wrapper/qwlshellsurface_p.h index 18ecdabb5..c9b21aba9 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlshellsurface_p.h @@ -82,7 +82,7 @@ private: QHash<InputDevice*, ShellSurfacePopupGrabber*> m_popupGrabber; }; -class Q_COMPOSITOR_EXPORT ShellSurface : public QtWaylandServer::wl_shell_surface +class Q_COMPOSITOR_EXPORT ShellSurface : public QObject, public QtWaylandServer::wl_shell_surface { public: ShellSurface(Shell *shell, struct wl_client *client, uint32_t id, Surface *surface); @@ -102,6 +102,7 @@ public: QWaylandSurface::WindowType windowType() const; void mapPopup(); + void configure(bool hasBuffer); private: Shell *m_shell; diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp index 98d494ac8..5767bf20c 100644 --- a/src/compositor/wayland_wrapper/qwlsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlsurface.cpp @@ -311,14 +311,6 @@ void Surface::setBackBuffer(SurfaceBuffer *buffer) bool valid = m_buffer->waylandBufferHandle() != 0; setSize(valid ? m_buffer->size() : QSize()); - if ((!m_subSurface || !m_subSurface->parent()) && !m_surfaceMapped) { - m_surfaceMapped = true; - emit m_waylandSurface->mapped(); - } else if (!valid && m_surfaceMapped) { - m_surfaceMapped = false; - emit m_waylandSurface->unmapped(); - } - m_damage = m_damage.intersected(QRect(QPoint(), m_size)); emit m_waylandSurface->damaged(m_damage); } else { @@ -331,6 +323,17 @@ void Surface::setBackBuffer(SurfaceBuffer *buffer) m_damage = QRegion(); } +void Surface::setMapped(bool mapped) +{ + if (!m_surfaceMapped && mapped) { + m_surfaceMapped = true; + emit m_waylandSurface->mapped(); + } else if (!mapped && m_surfaceMapped) { + m_surfaceMapped = false; + emit m_waylandSurface->unmapped(); + } +} + SurfaceBuffer *Surface::createSurfaceBuffer(struct ::wl_resource *buffer) { SurfaceBuffer *newBuffer = 0; @@ -407,16 +410,11 @@ void Surface::surface_commit(Resource *) if (m_pending.buffer || m_pending.newlyAttached) { setBackBuffer(m_pending.buffer); - if (!m_buffer && m_surfaceMapped) { - m_surfaceMapped = false; - emit m_waylandSurface->unmapped(); - } - m_bufferRef = QWaylandBufferRef(m_buffer); if (m_attacher) m_attacher->attach(m_bufferRef); - emit m_waylandSurface->configure(); + emit m_waylandSurface->configure(m_bufferRef); } m_pending.buffer = 0; diff --git a/src/compositor/wayland_wrapper/qwlsurface_p.h b/src/compositor/wayland_wrapper/qwlsurface_p.h index 12984a1f2..b88a78030 100644 --- a/src/compositor/wayland_wrapper/qwlsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlsurface_p.h @@ -134,6 +134,8 @@ public: void releaseSurfaces(); void frameStarted(); + void setMapped(bool mapped); + inline bool isDestroyed() const { return m_destroyed; } protected: |