diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2014-08-20 01:34:13 +0200 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2014-09-18 10:18:36 +0200 |
commit | 7e6de1ded923936c2ba2a2d55d0cba2e7ff14e1e (patch) | |
tree | d3d537e3ec883b24c4eecf2056f2096af7f1bc6e | |
parent | 325915245c0ceaa3e03677032371bc0fb936b040 (diff) |
Add or remove popup grabber when the surface is mapped
When the surface is mapped add or remove the popup grab
as expected.
Change-Id: I807753393ef2753bc96c698f766523186ee88fd2
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
-rw-r--r-- | src/compositor/wayland_wrapper/qwlshellsurface.cpp | 23 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlshellsurface_p.h | 4 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp index baae8b53e..d54a223d6 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp @@ -100,6 +100,7 @@ ShellSurface::ShellSurface(Shell *shell, wl_client *client, uint32_t id, Surface { m_view = surface->compositor()->waylandCompositor()->createView(surface->waylandSurface()); connect(surface->waylandSurface(), &QWaylandSurface::configure, this, &ShellSurface::configure); + connect(surface->waylandSurface(), &QWaylandSurface::mapped, this, &ShellSurface::mapped); } ShellSurface::~ShellSurface() @@ -158,16 +159,6 @@ void ShellSurface::setOffset(const QPointF &offset) m_surface->setTransientOffset(offset.x(), offset.y()); } -void ShellSurface::mapPopup() -{ - if (m_popupGrabber->grabSerial() == m_popupSerial) { - m_popupGrabber->addPopup(this); - } else { - send_popup_done(); - m_popupGrabber->setClient(0); - } -} - void ShellSurface::configure(bool hasBuffer) { m_surface->setMapped(hasBuffer); @@ -188,6 +179,18 @@ bool ShellSurface::runOperation(QWaylandSurfaceOp *op) return false; } +void ShellSurface::mapped() +{ + if (m_surface->waylandSurface()->windowType() == QWaylandSurface::Popup) { + if (m_surface->mapped() && m_popupGrabber->grabSerial() == m_popupSerial) { + m_popupGrabber->addPopup(this); + } else { + send_popup_done(); + m_popupGrabber->setClient(0); + } + } +} + void ShellSurface::requestSize(const QSize &size) { send_configure(WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, size.width(), size.height()); diff --git a/src/compositor/wayland_wrapper/qwlshellsurface_p.h b/src/compositor/wayland_wrapper/qwlshellsurface_p.h index 7c9b5b6e1..f724ef290 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlshellsurface_p.h @@ -97,7 +97,6 @@ public: void setOffset(const QPointF &offset); - void mapPopup(); void configure(bool hasBuffer); void requestSize(const QSize &size); @@ -106,6 +105,9 @@ public: protected: bool runOperation(QWaylandSurfaceOp *op) Q_DECL_OVERRIDE; +private Q_SLOTS: + void mapped(); + private: Shell *m_shell; Surface *m_surface; |