react to and send expose events
authorGunnar Sletta <gunnar.sletta@nokia.com>
Wed, 22 Feb 2012 15:33:19 +0000 (16:33 +0100)
committerJørgen Lind <jorgen.lind@nokia.com>
Mon, 12 Mar 2012 14:15:07 +0000 (15:15 +0100)
Change-Id: I55d52717e62feb4010895d55fe5b82e0eb7acc1b
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
src/plugins/platforms/wayland/qwaylandextendedsurface.cpp
src/plugins/platforms/wayland/qwaylandextendedsurface.h
src/plugins/platforms/wayland/qwaylandwindow.cpp
src/plugins/platforms/wayland/qwaylandwindow.h

index 41ccdec..1e565f4 100644 (file)
@@ -52,6 +52,7 @@
 
 #include <QtGui/QGuiApplication>
 #include <QtGui/QPlatformNativeInterface>
+#include <QtGui/QWindowSystemInterface>
 
 QWaylandSurfaceExtension::QWaylandSurfaceExtension(QWaylandDisplay *display, uint32_t id)
 {
@@ -73,6 +74,7 @@ QWaylandExtendedSurface *QWaylandSurfaceExtension::getExtendedWindow(QWaylandWin
 QWaylandExtendedSurface::QWaylandExtendedSurface(QWaylandWindow *window, struct wl_extended_surface *extended_surface)
     : m_window(window)
     , m_extended_surface(extended_surface)
+    , m_exposed(true)
 {
     wl_extended_surface_add_listener(m_extended_surface,&QWaylandExtendedSurface::extended_surface_listener,this);
 }
@@ -141,6 +143,13 @@ void QWaylandExtendedSurface::onscreen_visibility(void *data, wl_extended_surfac
 
     QEvent evt(visible != 0 ? QEvent::ApplicationActivate : QEvent::ApplicationDeactivate);
     QCoreApplication::sendEvent(QCoreApplication::instance(), &evt);
+
+    extendedWindow->m_exposed = visible;
+    QWaylandWindow *w = extendedWindow->m_window;
+    QWindowSystemInterface::handleSynchronousExposeEvent(w->window(),
+                                                         visible
+                                                         ? QRegion(w->geometry())
+                                                         : QRegion());
 }
 
 void QWaylandExtendedSurface::set_generic_property(void *data, wl_extended_surface *wl_extended_surface, const char *name, wl_array *value)
index 9efb638..9d4534b 100644 (file)
@@ -76,6 +76,8 @@ public:
 
     Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
 
+    bool isExposed() const { return m_exposed; }
+
 private:
     QWaylandWindow *m_window;
     struct wl_extended_surface *m_extended_surface;
@@ -93,6 +95,7 @@ private:
 
     static const struct wl_extended_surface_listener extended_surface_listener;
 
+    bool m_exposed;
 };
 
 #endif // QWAYLANDEXTENDEDSURFACE_H
index b70860d..2fb65aa 100644 (file)
@@ -130,6 +130,17 @@ void QWaylandWindow::setVisible(bool visible)
     }
 }
 
+
+bool QWaylandWindow::isExposed() const
+{
+    if (!window()->isVisible())
+        return false;
+    if (mExtendedWindow)
+        return mExtendedWindow->isExposed();
+    return true;
+}
+
+
 void QWaylandWindow::configure(uint32_t time, uint32_t edges,
                                int32_t x, int32_t y,
                                int32_t width, int32_t height)
index ad36181..1f31097 100644 (file)
@@ -91,6 +91,8 @@ public:
     Qt::WindowState setWindowState(Qt::WindowState state);
     Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
 
+    bool isExposed() const;
+
 protected:
     QWaylandDisplay *mDisplay;
     struct wl_surface *mSurface;