summaryrefslogtreecommitdiffstats
path: root/src/plugins/graphicssystems
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-18 16:05:13 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-18 16:05:13 (GMT)
commitf9815142befe5fb312a6fea1dac43c33a3189145 (patch)
tree54f3229cb2c7c6694d558d68c2d53c40211f1126 /src/plugins/graphicssystems
parent9d63852e31674eb5de2da5cb57a09aff31aabb31 (diff)
parent1811da78fc63371e2639a230e0aa81ed7f47695a (diff)
downloadQt-f9815142befe5fb312a6fea1dac43c33a3189145.zip
Qt-f9815142befe5fb312a6fea1dac43c33a3189145.tar.gz
Qt-f9815142befe5fb312a6fea1dac43c33a3189145.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'src/plugins/graphicssystems')
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 18a0944..cb66695 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -59,6 +59,8 @@
#include "qmeegographicssystem.h"
#include "qmeegoextensions.h"
+#include <QTimer>
+
bool QMeeGoGraphicsSystem::surfaceWasCreated = false;
QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps;
@@ -85,8 +87,12 @@ public:
void addWidget(QWidget *widget);
bool eventFilter(QObject *, QEvent *);
+ void handleMapNotify();
+
private slots:
void removeWidget(QObject *object);
+ void switchToRaster();
+ void switchToMeeGo();
private:
int visibleWidgets() const;
@@ -95,22 +101,46 @@ private:
QList<QWidget *> m_widgets;
};
+typedef bool(*QX11FilterFunction)(XEvent *event);
+Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func);
+
+static bool x11EventFilter(XEvent *event);
+
QMeeGoGraphicsSystemSwitchHandler::QMeeGoGraphicsSystemSwitchHandler()
{
+ qt_installX11EventFilter(x11EventFilter);
}
void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget)
{
- if (!m_widgets.contains(widget)) {
+ if (widget != qt_gl_share_widget() && !m_widgets.contains(widget)) {
widget->installEventFilter(this);
connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(removeWidget(QObject *)));
m_widgets << widget;
}
}
+void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify()
+{
+ if (m_widgets.isEmpty())
+ QTimer::singleShot(0, this, SLOT(switchToMeeGo()));
+}
+
void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object)
{
m_widgets.removeOne(static_cast<QWidget *>(object));
+ if (m_widgets.isEmpty())
+ QTimer::singleShot(0, this, SLOT(switchToRaster()));
+}
+
+void QMeeGoGraphicsSystemSwitchHandler::switchToRaster()
+{
+ QMeeGoGraphicsSystem::switchToRaster();
+}
+
+void QMeeGoGraphicsSystemSwitchHandler::switchToMeeGo()
+{
+ QMeeGoGraphicsSystem::switchToMeeGo();
}
int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const
@@ -148,6 +178,13 @@ bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *eve
Q_GLOBAL_STATIC(QMeeGoGraphicsSystemSwitchHandler, switch_handler)
+bool x11EventFilter(XEvent *event)
+{
+ if (event->type == MapNotify)
+ switch_handler()->handleMapNotify();
+ return false;
+}
+
QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
{
QGLWidget *shareWidget = qt_gl_share_widget();