summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp2
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp4
-rw-r--r--src/plugins/accessible/widgets/qaccessiblemenu.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp68
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h20
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux.cpp274
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux_p.h32
-rw-r--r--src/plugins/generic/evdevmouse/qevdevmousehandler.cpp24
-rw-r--r--src/plugins/generic/evdevmouse/qevdevmousehandler.h3
-rw-r--r--src/plugins/generic/evdevtouch/qevdevtouch.cpp3
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm14
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.h11
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm154
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm14
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintersupport.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm123
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h5
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm95
-rw-r--r--src/plugins/platforms/directfb/qdirectfbinput.h4
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.cpp144
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.h17
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp4
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_x11.cpp3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp14
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp11
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h1
-rw-r--r--src/plugins/platforms/openkode/openkode.pro42
-rw-r--r--src/plugins/platforms/openkode/openkodekeytranslator.h244
-rw-r--r--src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp128
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.cpp247
-rw-r--r--src/plugins/platforms/openkode/qopenkodeintegration.h120
-rw-r--r--src/plugins/platforms/openkode/qopenkodewindow.cpp315
-rw-r--r--src/plugins/platforms/openkode/qopenkodewindow.h89
-rw-r--r--src/plugins/platforms/openkode/resources.qrc6
-rw-r--r--src/plugins/platforms/openvglite/openvglite.pro12
-rw-r--r--src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp193
-rw-r--r--src/plugins/platforms/openvglite/qgraphicssystem_vglite.h93
-rw-r--r--src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp131
-rw-r--r--src/plugins/platforms/openvglite/qwindowsurface_vglite.h91
-rw-r--r--src/plugins/platforms/platforms.pro2
-rw-r--r--src/plugins/platforms/qnx/main.cpp11
-rw-r--r--src/plugins/platforms/qnx/main.h (renamed from src/plugins/platforms/openkode/shaders/vert.glslv)26
-rw-r--r--src/plugins/platforms/qnx/qnx.json3
-rw-r--r--src/plugins/platforms/qnx/qnx.pro107
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractnavigator.cpp74
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractnavigator.h66
-rw-r--r--src/plugins/platforms/qnx/qqnxbpseventfilter.cpp204
-rw-r--r--src/plugins/platforms/qnx/qqnxbpseventfilter.h (renamed from src/plugins/platforms/qvfb/qvfbwindowsurface.h)53
-rw-r--r--src/plugins/platforms/qnx/qqnxclipboard.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp (renamed from src/plugins/platforms/qvfb/main.cpp)47
-rw-r--r--src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.h66
-rw-r--r--src/plugins/platforms/qnx/qqnxglcontext.cpp1
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp152
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.h45
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorbps.cpp (renamed from src/plugins/platforms/openvglite/main.cpp)41
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorbps.h (renamed from src/plugins/platforms/openkode/shaders/frag.glslf)27
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.cpp192
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.h (renamed from src/plugins/platforms/openkode/main.cpp)45
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventthread.cpp (renamed from src/plugins/platforms/qnx/qqnxeventthread.cpp)45
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventthread.h (renamed from src/plugins/platforms/qnx/qqnxeventthread.h)12
-rw-r--r--src/plugins/platforms/qnx/qqnxservices.cpp17
-rw-r--r--src/plugins/platforms/qnx/qqnxservices.h7
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp209
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.h (renamed from src/plugins/platforms/openkode/qopenkodeeventloopintegration.h)39
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp (renamed from src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp)65
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h (renamed from src/plugins/platforms/qnx/qqnxvirtualkeyboard.h)13
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp16
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.h10
-rw-r--r--src/plugins/platforms/qvfb/qvfb.pro14
-rw-r--r--src/plugins/platforms/qvfb/qvfbintegration.cpp454
-rw-r--r--src/plugins/platforms/qvfb/qvfbintegration.h102
-rw-r--r--src/plugins/platforms/qvfb/qvfbwindowsurface.cpp108
-rw-r--r--src/plugins/platforms/windows/accessible/comutils.cpp4
-rw-r--r--src/plugins/platforms/windows/accessible/comutils.h4
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp27
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp12
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.h2
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp10
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h5
-rw-r--r--src/plugins/platforms/windows/main.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp608
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.h9
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp17
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.h6
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.h1
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp4
-rw-r--r--src/plugins/platforms/windows/windows.pro3
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h2
107 files changed, 2770 insertions, 3087 deletions
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index e4b10670ae..8da65791f8 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -319,7 +319,7 @@ QString QAccessibleComboBox::text(QAccessible::Text t) const
break;
#ifndef QT_NO_SHORTCUT
case QAccessible::Accelerator:
- str = (QString)QKeySequence(Qt::Key_Down);
+ str = QKeySequence(Qt::Key_Down).toString(QKeySequence::NativeText);
break;
#endif
default:
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
index c0a8ec4286..92e8f9fcac 100644
--- a/src/plugins/accessible/widgets/itemviews.cpp
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -401,6 +401,10 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
return QModelIndex();
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
+ if (treeView->d_func()->viewItems.count() <= row) {
+ qWarning() << "QAccessibleTree::indexFromLogical: invalid index: " << row << column << " for " << treeView;
+ return QModelIndex();
+ }
QModelIndex modelIndex = treeView->d_func()->viewItems.at(row).index;
if (modelIndex.isValid() && column > 0) {
diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.cpp b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
index 6009d25977..bb809df584 100644
--- a/src/plugins/accessible/widgets/qaccessiblemenu.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
@@ -249,7 +249,7 @@ QAccessible::State QAccessibleMenuItem::state() const
QAccessible::State s;
QWidget *own = owner();
- if (own && own->testAttribute(Qt::WA_WState_Visible) == false || m_action->isVisible() == false) {
+ if (own && (own->testAttribute(Qt::WA_WState_Visible) == false || m_action->isVisible() == false)) {
s.invisible = true;
}
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 3ee67ed38f..83f9ff1903 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -72,9 +72,10 @@ QConnmanManagerInterface::~QConnmanManagerInterface()
{
}
-void QConnmanManagerInterface::connectNotify(const char *signal)
+void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal)
{
-if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
if(!connection().connect(QLatin1String(CONNMAN_SERVICE),
QLatin1String(CONNMAN_MANAGER_PATH),
QLatin1String(CONNMAN_MANAGER_INTERFACE),
@@ -84,7 +85,8 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
}
}
- if (QLatin1String(signal) == SIGNAL(stateChanged(QString))) {
+ static const QMetaMethod stateChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::stateChanged);
+ if (signal == stateChangedSignal) {
if (!connection().connect(QLatin1String(CONNMAN_SERVICE),
QLatin1String(CONNMAN_MANAGER_PATH),
QLatin1String(CONNMAN_MANAGER_INTERFACE),
@@ -94,7 +96,8 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
}
}
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChangedContext);
+ if (signal == propertyChangedContextSignal) {
QConnmanDBusHelper *helper;
helper = new QConnmanDBusHelper(this);
@@ -110,9 +113,10 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
}
}
-void QConnmanManagerInterface::disconnectNotify(const char *signal)
+void QConnmanManagerInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
@@ -331,9 +335,10 @@ QConnmanProfileInterface::~QConnmanProfileInterface()
{
}
-void QConnmanProfileInterface::connectNotify(const char *signal)
+void QConnmanProfileInterface::connectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanProfileInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
this->path(),
QLatin1String(CONNMAN_PROFILE_INTERFACE),
@@ -342,9 +347,10 @@ void QConnmanProfileInterface::connectNotify(const char *signal)
}
}
-void QConnmanProfileInterface::disconnectNotify(const char *signal)
+void QConnmanProfileInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString, QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanProfileInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
@@ -399,16 +405,18 @@ QConnmanServiceInterface::~QConnmanServiceInterface()
{
}
-void QConnmanServiceInterface::connectNotify(const char *signal)
+void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
this->path(),
QLatin1String(CONNMAN_SERVICE_INTERFACE),
QLatin1String("PropertyChanged"),
this,SIGNAL(propertyChanged(QString,QDBusVariant)));
}
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChangedContext);
+ if (signal == propertyChangedContextSignal) {
QConnmanDBusHelper *helper;
helper = new QConnmanDBusHelper(this);
@@ -423,9 +431,10 @@ void QConnmanServiceInterface::connectNotify(const char *signal)
}
}
-void QConnmanServiceInterface::disconnectNotify(const char *signal)
+void QConnmanServiceInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
@@ -726,16 +735,18 @@ QConnmanTechnologyInterface::~QConnmanTechnologyInterface()
{
}
-void QConnmanTechnologyInterface::connectNotify(const char *signal)
+void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
this->path(),
QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE),
QLatin1String("PropertyChanged"),
this,SIGNAL(propertyChanged(QString,QDBusVariant)));
}
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChangedContext);
+ if (signal == propertyChangedContextSignal) {
QConnmanDBusHelper *helper;
helper = new QConnmanDBusHelper(this);
@@ -750,9 +761,10 @@ void QConnmanTechnologyInterface::connectNotify(const char *signal)
}
}
-void QConnmanTechnologyInterface::disconnectNotify(const char *signal)
+void QConnmanTechnologyInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
@@ -806,22 +818,26 @@ QConnmanAgentInterface::~QConnmanAgentInterface()
{
}
-void QConnmanAgentInterface::connectNotify(const char *signal)
+void QConnmanAgentInterface::connectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
// dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
// this->path(),
// QLatin1String(CONNMAN_NETWORK_INTERFACE),
// QLatin1String("PropertyChanged"),
// this,SIGNAL(propertyChanged(const QString &, QVariant &)));
- }
+// }
}
-void QConnmanAgentInterface::disconnectNotify(const char *signal)
+void QConnmanAgentInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString, QDBusVariant))) {
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
- }
+// }
}
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
index 5a1778605e..3e5915c8f4 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
@@ -144,8 +144,8 @@ Q_SIGNALS:
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -171,8 +171,8 @@ private:
QConnmanProfileInterfacePrivate *d;
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -233,8 +233,8 @@ Q_SIGNALS:
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -257,8 +257,8 @@ Q_SIGNALS:
void propertyChanged(const QString &, const QDBusVariant &value);
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -277,8 +277,8 @@ public:
// dict requestInput(QDBusObjectPath &path, dict fields);
void cancel();
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
};
class QConnmanCounterInterfacePrivate;
diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp
index 5fe6ae0f88..6e01029d13 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux.cpp
+++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp
@@ -88,9 +88,10 @@ QDBusObjectPath QOfonoManagerInterface::currentModem()
}
-void QOfonoManagerInterface::connectNotify(const char *signal)
+void QOfonoManagerInterface::connectNotify(const QMetaMethod &signal)
{
-if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoManagerInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
if(!connection().connect(QLatin1String(OFONO_SERVICE),
QLatin1String(OFONO_MANAGER_PATH),
QLatin1String(OFONO_MANAGER_INTERFACE),
@@ -100,7 +101,8 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
}
}
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoManagerInterface::propertyChangedContext);
+ if (signal == propertyChangedContextSignal) {
QOfonoDBusHelper *helper;
helper = new QOfonoDBusHelper(this);
@@ -116,9 +118,10 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
}
}
-void QOfonoManagerInterface::disconnectNotify(const char *signal)
+void QOfonoManagerInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoManagerInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
@@ -238,9 +241,10 @@ QString QOfonoModemInterface::defaultInterface()
}
-void QOfonoModemInterface::connectNotify(const char *signal)
+void QOfonoModemInterface::connectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoModemInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
if(!connection().connect(QLatin1String(OFONO_SERVICE),
this->path(),
QLatin1String(OFONO_MODEM_INTERFACE),
@@ -250,7 +254,8 @@ void QOfonoModemInterface::connectNotify(const char *signal)
}
}
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoModemInterface::propertyChangedContext);
+ if (signal == propertyChangedContextSignal) {
QOfonoDBusHelper *helper;
helper = new QOfonoDBusHelper(this);
@@ -265,9 +270,10 @@ void QOfonoModemInterface::connectNotify(const char *signal)
this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
}}
-void QOfonoModemInterface::disconnectNotify(const char *signal)
+void QOfonoModemInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoModemInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
@@ -361,9 +367,10 @@ QList <QDBusObjectPath> QOfonoNetworkRegistrationInterface::getOperators()
return qdbus_cast<QList <QDBusObjectPath> >(var);
}
-void QOfonoNetworkRegistrationInterface::connectNotify(const char *signal)
+void QOfonoNetworkRegistrationInterface::connectNotify(const QMetaMethod &signal)
{
-if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkRegistrationInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
if(!connection().connect(QLatin1String(OFONO_SERVICE),
this->path(),
QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE),
@@ -373,7 +380,8 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
}
}
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoNetworkRegistrationInterface::propertyChangedContext);
+ if (signal == propertyChangedContextSignal) {
QOfonoDBusHelper *helper;
helper = new QOfonoDBusHelper(this);
@@ -389,9 +397,10 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
}
}
-void QOfonoNetworkRegistrationInterface::disconnectNotify(const char *signal)
+void QOfonoNetworkRegistrationInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkRegistrationInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
@@ -459,39 +468,44 @@ QStringList QOfonoNetworkOperatorInterface::getTechnologies()
return qdbus_cast<QStringList>(var);
}
-void QOfonoNetworkOperatorInterface::connectNotify(const char *signal)
+void QOfonoNetworkOperatorInterface::connectNotify(const QMetaMethod &signal)
{
-if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
- if(!connection().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
- qWarning() << "PropertyCHanged not connected";
- }
- }
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkOperatorInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
+// if(!connection().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+// qWarning() << "PropertyCHanged not connected";
+// }
+// }
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
- QOfonoDBusHelper *helper;
- helper = new QOfonoDBusHelper(this);
+// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoNetworkOperatorInterface::propertyChangedContext);
+// if (signal == propertyChangedContextSignal) {
+// QOfonoDBusHelper *helper;
+// helper = new QOfonoDBusHelper(this);
- QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
- QLatin1String("PropertyChanged"),
- helper,SLOT(propertyChanged(QString,QDBusVariant)));
+// QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// helper,SLOT(propertyChanged(QString,QDBusVariant)));
- QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
- this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
- }
+// QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+// this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
+// }
}
-void QOfonoNetworkOperatorInterface::disconnectNotify(const char *signal)
+void QOfonoNetworkOperatorInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkOperatorInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
- }
+// }
}
QVariant QOfonoNetworkOperatorInterface::getProperty(const QString &property)
@@ -562,39 +576,44 @@ QString QOfonoSimInterface::cardIdentifier()
return qdbus_cast<QString>(var);
}
-void QOfonoSimInterface::connectNotify(const char *signal)
+void QOfonoSimInterface::connectNotify(const QMetaMethod &signal)
{
-if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
- if(!connection().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
- qWarning() << "PropertyCHanged not connected";
- }
- }
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSimInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
+// if(!connection().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+// qWarning() << "PropertyCHanged not connected";
+// }
+// }
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
- QOfonoDBusHelper *helper;
- helper = new QOfonoDBusHelper(this);
+// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoSimInterface::propertyChangedContext);
+// if (signal == propertyChangedContextSignal) {
+// QOfonoDBusHelper *helper;
+// helper = new QOfonoDBusHelper(this);
- QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
- QLatin1String("PropertyChanged"),
- helper,SLOT(propertyChanged(QString,QDBusVariant)));
+// QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// helper,SLOT(propertyChanged(QString,QDBusVariant)));
- QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
- this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
- }
+// QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+// this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
+// }
}
-void QOfonoSimInterface::disconnectNotify(const char *signal)
+void QOfonoSimInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSimInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
- }
+// }
}
QVariant QOfonoSimInterface::getProperty(const QString &property)
@@ -651,39 +670,44 @@ bool QOfonoDataConnectionManagerInterface::isPowered()
return qdbus_cast<bool>(var);
}
-void QOfonoDataConnectionManagerInterface::connectNotify(const char *signal)
+void QOfonoDataConnectionManagerInterface::connectNotify(const QMetaMethod &signal)
{
-if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
- if(!connection().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
- qWarning() << "PropertyCHanged not connected";
- }
- }
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoDataConnectionManagerInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
+// if(!connection().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+// qWarning() << "PropertyCHanged not connected";
+// }
+// }
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
- QOfonoDBusHelper *helper;
- helper = new QOfonoDBusHelper(this);
+// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoDataConnectionManagerInterface::propertyChangedContext);
+// if (signal == propertyChangedContextSignal) {
+// QOfonoDBusHelper *helper;
+// helper = new QOfonoDBusHelper(this);
- QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
- QLatin1String("PropertyChanged"),
- helper,SLOT(propertyChanged(QString,QDBusVariant)));
+// QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// helper,SLOT(propertyChanged(QString,QDBusVariant)));
- QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
- this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
- }
+// QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+// this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
+// }
}
-void QOfonoDataConnectionManagerInterface::disconnectNotify(const char *signal)
+void QOfonoDataConnectionManagerInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoDataConnectionManagerInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
- }
+// }
}
QVariant QOfonoDataConnectionManagerInterface::getProperty(const QString &property)
@@ -762,7 +786,7 @@ bool QOfonoPrimaryDataContextInterface::setActive(bool on)
{
// this->setProperty("Active", QVariant(on));
- return setProp("Active", qVariantFromValue(on));
+ return setProp("Active", QVariant::fromValue(on));
}
bool QOfonoPrimaryDataContextInterface::setApn(const QString &name)
@@ -770,39 +794,44 @@ bool QOfonoPrimaryDataContextInterface::setApn(const QString &name)
return setProp("AccessPointName", QVariant::fromValue(name));
}
-void QOfonoPrimaryDataContextInterface::connectNotify(const char *signal)
+void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal)
{
-if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
- if(!connection().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
- qWarning() << "PropertyCHanged not connected";
- }
- }
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
+// if(!connection().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+// qWarning() << "PropertyCHanged not connected";
+// }
+// }
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
- QOfonoDBusHelper *helper;
- helper = new QOfonoDBusHelper(this);
+// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChangedContext);
+// if (signal == propertyChangedContextSignal) {
+// QOfonoDBusHelper *helper;
+// helper = new QOfonoDBusHelper(this);
- QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
- this->path(),
- QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
- QLatin1String("PropertyChanged"),
- helper,SLOT(propertyChanged(QString,QDBusVariant)));
+// QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
+// this->path(),
+// QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// helper,SLOT(propertyChanged(QString,QDBusVariant)));
- QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
- this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
- }
+// QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+// this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection);
+// }
}
-void QOfonoPrimaryDataContextInterface::disconnectNotify(const char *signal)
+void QOfonoPrimaryDataContextInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ Q_UNUSED(signal);
+// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged);
+// if (signal == propertyChangedSignal) {
- }
+// }
}
QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property)
@@ -826,7 +855,7 @@ QVariantMap QOfonoPrimaryDataContextInterface::getProperties()
bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const QVariant &var)
{
QList<QVariant> args;
- args << qVariantFromValue(property) << qVariantFromValue(QDBusVariant(var));
+ args << QVariant::fromValue(property) << QVariant::fromValue(QDBusVariant(var));
QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,
QLatin1String("SetProperty"),
@@ -852,9 +881,10 @@ QOfonoSmsInterface::~QOfonoSmsInterface()
{
}
-void QOfonoSmsInterface::connectNotify(const char *signal)
+void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
if(!connection().connect(QLatin1String(OFONO_SERVICE),
this->path(),
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
@@ -864,7 +894,8 @@ void QOfonoSmsInterface::connectNotify(const char *signal)
}
}
- if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::propertyChangedContext);
+ if (signal == propertyChangedContextSignal) {
QOfonoDBusHelper *helper;
helper = new QOfonoDBusHelper(this);
@@ -879,7 +910,8 @@ void QOfonoSmsInterface::connectNotify(const char *signal)
this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)));
}
- if (QLatin1String(signal) == SIGNAL(immediateMessage(QString,QVariantMap))) {
+ static const QMetaMethod immediateMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::immediateMessage);
+ if (signal == immediateMessageSignal) {
if(!connection().connect(QLatin1String(OFONO_SERVICE),
this->path(),
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
@@ -889,7 +921,8 @@ void QOfonoSmsInterface::connectNotify(const char *signal)
}
}
- if (QLatin1String(signal) == SIGNAL(incomingMessage(QString,QVariantMap))) {
+ static const QMetaMethod incomingMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::incomingMessage);
+ if (signal == incomingMessageSignal) {
if(!connection().connect(QLatin1String(OFONO_SERVICE),
this->path(),
QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
@@ -900,9 +933,10 @@ void QOfonoSmsInterface::connectNotify(const char *signal)
}
}
-void QOfonoSmsInterface::disconnectNotify(const char *signal)
+void QOfonoSmsInterface::disconnectNotify(const QMetaMethod &signal)
{
- if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+ static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::propertyChanged);
+ if (signal == propertyChangedSignal) {
}
}
diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h
index c92804dd3a..141f709d3d 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux_p.h
+++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h
@@ -111,8 +111,8 @@ Q_SIGNALS:
void propertyChanged(const QString &, const QDBusVariant &value);
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -155,8 +155,8 @@ public:
QString defaultInterface();
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
Q_SIGNALS:
void propertyChanged(const QString &, const QDBusVariant &value);
@@ -186,8 +186,8 @@ public:
QList <QDBusObjectPath> getOperators();
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
Q_SIGNALS:
void propertyChanged(const QString &, const QDBusVariant &value);
@@ -214,8 +214,8 @@ public:
QStringList getTechnologies();
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -241,8 +241,8 @@ public:
QString cardIdentifier();
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -267,8 +267,8 @@ public:
bool setPower(bool on);
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
};
@@ -297,8 +297,8 @@ public:
bool setApn(const QString &name);
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
bool setProp(const QString &, const QVariant &var);
};
@@ -321,8 +321,8 @@ public:
QString bearer();
protected:
- void connectNotify(const char *signal);
- void disconnectNotify(const char *signal);
+ void connectNotify(const QMetaMethod &signal);
+ void disconnectNotify(const QMetaMethod &signal);
QVariant getProperty(const QString &);
Q_SIGNALS:
diff --git a/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp b/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp
index 5e2911a806..6edd470874 100644
--- a/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp
+++ b/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp
@@ -44,6 +44,8 @@
#include <QSocketNotifier>
#include <QStringList>
#include <QPoint>
+#include <QGuiApplication>
+#include <QScreen>
#include <QWindowSystemInterface>
#include <qplatformdefs.h>
@@ -70,6 +72,7 @@ QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QStri
QString device = "/dev/input/event0";
bool compression = true;
+ bool clamp = true;
bool smooth = false;
int jitterLimit = 0;
int xoffset = 0;
@@ -79,6 +82,8 @@ QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QStri
foreach (const QString &arg, args) {
if (arg == "nocompress")
compression = false;
+ else if (arg == "noclamp")
+ clamp = false;
else if (arg.startsWith("dejitter="))
jitterLimit = arg.mid(9).toInt();
else if (arg.startsWith("xoffset="))
@@ -96,16 +101,16 @@ QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QStri
int fd;
fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
if (fd >= 0) {
- return new QEvdevMouseHandler(fd, compression, smooth, jitterLimit, xoffset, yoffset);
+ return new QEvdevMouseHandler(fd, compression, clamp, smooth, jitterLimit, xoffset, yoffset);
} else {
qWarning("Cannot open mouse input device '%s': %s", qPrintable(device), strerror(errno));
return 0;
}
}
-QEvdevMouseHandler::QEvdevMouseHandler(int deviceDescriptor, bool compression, bool smooth, int jitterLimit, int xoffset, int yoffset)
+QEvdevMouseHandler::QEvdevMouseHandler(int deviceDescriptor, bool compression, bool clamp, bool smooth, int jitterLimit, int xoffset, int yoffset)
: m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0),
- m_fd(deviceDescriptor), m_compression(compression), m_smooth(smooth),
+ m_fd(deviceDescriptor), m_compression(compression), m_clamp(clamp), m_smooth(smooth),
m_xoffset(xoffset), m_yoffset(yoffset), m_buttons(0)
{
setObjectName(QLatin1String("Evdev Mouse Handler"));
@@ -126,6 +131,19 @@ QEvdevMouseHandler::~QEvdevMouseHandler()
void QEvdevMouseHandler::sendMouseEvent()
{
+ if (m_clamp) {
+ QRect g = QGuiApplication::primaryScreen()->virtualGeometry();
+ if (m_x + m_xoffset < g.left())
+ m_x = g.left() - m_xoffset;
+ else if (m_x + m_xoffset > g.right())
+ m_x = g.right() - m_xoffset;
+
+ if (m_y + m_yoffset < g.top())
+ m_y = g.top() - m_yoffset;
+ else if (m_y + m_yoffset > g.bottom())
+ m_y = g.bottom() - m_yoffset;
+ }
+
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);
#ifdef QT_QPA_MOUSE_HANDLER_DEBUG
diff --git a/src/plugins/generic/evdevmouse/qevdevmousehandler.h b/src/plugins/generic/evdevmouse/qevdevmousehandler.h
index 7a74eaa701..fc65c6a414 100644
--- a/src/plugins/generic/evdevmouse/qevdevmousehandler.h
+++ b/src/plugins/generic/evdevmouse/qevdevmousehandler.h
@@ -62,7 +62,7 @@ private slots:
void readMouseData();
private:
- QEvdevMouseHandler(int deviceDescriptor, bool compression, bool smooth, int jitterLimit, int xoffset, int yoffset);
+ QEvdevMouseHandler(int deviceDescriptor, bool compression, bool clamp, bool smooth, int jitterLimit, int xoffset, int yoffset);
void sendMouseEvent();
@@ -71,6 +71,7 @@ private:
int m_prevx, m_prevy;
int m_fd;
bool m_compression;
+ bool m_clamp;
bool m_smooth;
int m_xoffset, m_yoffset;
Qt::MouseButtons m_buttons;
diff --git a/src/plugins/generic/evdevtouch/qevdevtouch.cpp b/src/plugins/generic/evdevtouch/qevdevtouch.cpp
index 1c3e8952e9..327f64412a 100644
--- a/src/plugins/generic/evdevtouch/qevdevtouch.cpp
+++ b/src/plugins/generic/evdevtouch/qevdevtouch.cpp
@@ -114,7 +114,8 @@ QTouchScreenData::QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList
m_currentSlot(0),
hw_range_x_min(0), hw_range_x_max(0),
hw_range_y_min(0), hw_range_y_max(0),
- hw_pressure_min(0), hw_pressure_max(0)
+ hw_pressure_min(0), hw_pressure_max(0),
+ m_device(0), m_typeB(false)
{
m_forceToActiveWindow = args.contains(QLatin1String("force_window"));
}
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index 489938c4b3..72bb5936c0 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -63,7 +63,6 @@ public:
bool scroll(const QRegion &area, int dx, int dy);
private:
- QCocoaWindow *m_cocoaWindow;
QImage *m_image;
};
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index f0ff7ba0d6..660c2b651f 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE
QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
: QPlatformBackingStore(window)
{
- m_cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
m_image = new QImage(window->geometry().size(),QImage::Format_ARGB32_Premultiplied);
}
@@ -72,14 +71,19 @@ void QCocoaBackingStore::flush(QWindow *widget, const QRegion &region, const QPo
QRect geo = region.boundingRect();
NSRect rect = NSMakeRect(geo.x(), geo.y(), geo.width(), geo.height());
- [m_cocoaWindow->m_contentView displayRect:rect];
+ QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
+ if (cocoaWindow)
+ [cocoaWindow->m_contentView displayRect:rect];
}
void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
{
delete m_image;
m_image = new QImage(size, QImage::Format_ARGB32_Premultiplied);
- [static_cast<QNSView *>(m_cocoaWindow->m_contentView) setImage:m_image];
+
+ QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
+ if (cocoaWindow)
+ [static_cast<QNSView *>(cocoaWindow->m_contentView) setImage:m_image];
}
bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
index 505fd4f111..4b901f3ef3 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
@@ -56,7 +56,7 @@ public:
void platformNativeDialogModalHelp();
void _q_platformRunNativeAppModalPanel();
void deleteNativeDialog_sys();
- bool show_sys(QFlags<QPlatformDialogHelper::ShowFlag>, Qt::WindowFlags, QWindow*);
+ bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
void hide_sys();
DialogCode dialogResultCode_sys();
@@ -64,7 +64,7 @@ public:
QColor currentColor_sys() const;
public:
- bool showCocoaColorPanel(QWindow *parent);
+ bool showCocoaColorPanel(Qt::WindowModality windowModality, QWindow *parent);
bool hideCocoaColorPanel();
void createNSColorPanelDelegate();
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 405cacee01..9f4446b32e 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -381,9 +381,13 @@ void QCocoaColorDialogHelper::deleteNativeDialog_sys()
mDelegate = 0;
}
-bool QCocoaColorDialogHelper::show_sys(QFlags<QPlatformDialogHelper::ShowFlag>, Qt::WindowFlags, QWindow *parent)
+bool QCocoaColorDialogHelper::show_sys(Qt::WindowFlags, Qt::WindowModality windowModality, QWindow *parent)
{
- return showCocoaColorPanel(parent);
+ if (windowModality == Qt::WindowModal) {
+ // Cocoa's shared color panel cannot be shown as a sheet
+ return false;
+ }
+ return showCocoaColorPanel(windowModality, parent);
}
void QCocoaColorDialogHelper::hide_sys()
@@ -447,13 +451,15 @@ void QCocoaColorDialogHelper::createNSColorPanelDelegate()
mDelegate = delegate;
}
-bool QCocoaColorDialogHelper::showCocoaColorPanel(QWindow *parent)
+bool QCocoaColorDialogHelper::showCocoaColorPanel(Qt::WindowModality windowModality, QWindow *parent)
{
Q_UNUSED(parent);
createNSColorPanelDelegate();
QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate);
[delegate->mColorPanel setShowsAlpha:options()->testOption(QColorDialogOptions::ShowAlphaChannel)];
- [delegate showModelessPanel];
+ if (windowModality == Qt::NonModal)
+ [delegate showModelessPanel];
+ // no need to show a Qt::ApplicationModal dialog here, since it will be done in _q_platformRunNativeAppModalPanel()
return true;
}
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
index 7fa1f0971f..4be30c44ed 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h
@@ -116,7 +116,6 @@ public:
explicit QCocoaEventDispatcher(QObject *parent = 0);
~QCocoaEventDispatcher();
-
bool processEvents(QEventLoop::ProcessEventsFlags flags);
bool hasPendingEvents();
@@ -156,9 +155,11 @@ public:
// timer handling
QTimerInfoList timerInfoList;
CFRunLoopTimerRef runLoopTimerRef;
+ CFRunLoopSourceRef activateTimersSourceRef;
void maybeStartCFRunLoopTimer();
void maybeStopCFRunLoopTimer();
- static void activateTimer(CFRunLoopTimerRef, void *info);
+ static void runLoopTimerCallback(CFRunLoopTimerRef, void *info);
+ static void activateTimersSourceCallback(void *info);
// Set 'blockSendPostedEvents' to true if you _really_ need
// to make sure that qt events are not posted while calling
@@ -176,9 +177,10 @@ public:
void temporarilyStopAllModalSessions();
void beginModalSession(QWindow *widget);
void endModalSession(QWindow *widget);
+ void cleanupModalSessions();
+
void cancelWaitForMoreEvents();
void maybeCancelWaitForMoreEvents();
- void cleanupModalSessions();
void ensureNSAppInitialized();
MacSocketHash macSockets;
@@ -190,8 +192,7 @@ public:
int lastSerial;
bool interrupt;
- static Boolean postedEventSourceEqualCallback(const void *info1, const void *info2);
- static void postedEventsSourcePerformCallback(void *info);
+ static void postedEventsSourceCallback(void *info);
static void waitingObserverCallback(CFRunLoopObserverRef observer,
CFRunLoopActivity activity, void *info);
static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 02722ce5bf..a3bd4a95ca 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -82,6 +82,7 @@
#include "qmutex.h"
#include "qsocketnotifier.h"
#include <qplatformwindow_qpa.h>
+#include <qplatformnativeinterface_qpa.h>
#include "private/qthread_p.h"
#include "private/qguiapplication_p.h"
#include <qdebug.h>
@@ -104,12 +105,28 @@ static inline CFRunLoopRef mainRunLoop()
return CFRunLoopGetMain();
}
+static Boolean runLoopSourceEqualCallback(const void *info1, const void *info2)
+{
+ return info1 == info2;
+}
+
/*****************************************************************************
Timers stuff
*****************************************************************************/
/* timer call back */
-void QCocoaEventDispatcherPrivate::activateTimer(CFRunLoopTimerRef, void *info)
+void QCocoaEventDispatcherPrivate::runLoopTimerCallback(CFRunLoopTimerRef, void *info)
+{
+ QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
+ if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {
+ // processEvents() was called "manually," ignore this source for now
+ d->maybeCancelWaitForMoreEvents();
+ return;
+ }
+ CFRunLoopSourceSignal(d->activateTimersSourceRef);
+}
+
+void QCocoaEventDispatcherPrivate::activateTimersSourceCallback(void *info)
{
QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
(void) d->timerInfoList.activateTimers();
@@ -145,7 +162,7 @@ void QCocoaEventDispatcherPrivate::maybeStartCFRunLoopTimer()
CFRunLoopTimerContext info = { 0, this, 0, 0, 0 };
// create the timer with a large interval, as recommended by the CFRunLoopTimerSetNextFireDate()
// documentation, since we will adjust the timer's time-to-fire as needed to keep Qt timers working
- runLoopTimerRef = CFRunLoopTimerCreate(0, ttf, oneyear, 0, 0, QCocoaEventDispatcherPrivate::activateTimer, &info);
+ runLoopTimerRef = CFRunLoopTimerCreate(0, ttf, oneyear, 0, 0, QCocoaEventDispatcherPrivate::runLoopTimerCallback, &info);
Q_ASSERT(runLoopTimerRef != 0);
CFRunLoopAddTimer(mainRunLoop(), runLoopTimerRef, kCFRunLoopCommonModes);
@@ -513,10 +530,10 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
emit awake();
- bool excludeUserEvents = flags & QEventLoop::ExcludeUserInputEvents;
- bool retVal = false;
uint oldflags = d->processEventsFlags;
d->processEventsFlags = flags;
+ bool excludeUserEvents = d->processEventsFlags & QEventLoop::ExcludeUserInputEvents;
+ bool retVal = false;
forever {
if (d->interrupt)
break;
@@ -544,8 +561,9 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
// Finally, if we are to exclude user input events, we cannot call [NSApp run]
// as we then loose control over which events gets dispatched:
const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning];
- const bool canExec_Qt = !excludeUserEvents &&
- (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ;
+ const bool canExec_Qt = (!excludeUserEvents
+ && ((d->processEventsFlags & QEventLoop::DialogExec)
+ || (d->processEventsFlags & QEventLoop::EventLoopExec)));
if (canExec_Qt && canExec_3rdParty) {
// We can use exec-mode, meaning that we can stay in a tight loop until
@@ -632,9 +650,11 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
}
} while (!d->interrupt && event != nil);
- if ((flags & QEventLoop::WaitForMoreEvents) == 0) {
- // when called "manually", always send posted events
+ if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {
+ // when called "manually", always send posted events and timers
d->processPostedEvents();
+ retVal = d->timerInfoList.activateTimers() > 0 || retVal;
+ d->maybeStartCFRunLoopTimer();
}
// be sure to return true if the posted event source fired
@@ -651,12 +671,12 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
bool canWait = (d->threadData->canWait
&& !retVal
&& !d->interrupt
- && (flags & QEventLoop::WaitForMoreEvents));
+ && (d->processEventsFlags & QEventLoop::WaitForMoreEvents));
if (canWait) {
// INVARIANT: We haven't processed any events yet. And we're told
// to stay inside this function until at least one event is processed.
qt_mac_waitForMoreEvents();
- flags &= ~QEventLoop::WaitForMoreEvents;
+ d->processEventsFlags &= ~QEventLoop::WaitForMoreEvents;
} else {
// Done with event processing for now.
// Leave the function:
@@ -762,26 +782,18 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
if (!info.window)
continue;
-// ### port
-// if (info.window->testAttribute(Qt::WA_DontShowOnScreen))
-// continue;
if (!info.session) {
QCocoaAutoReleasePool pool;
- NSWindow *window = reinterpret_cast<NSWindow *>(info.window->handle()->winId());
- if (!window)
+ NSWindow *nswindow = static_cast<NSWindow *>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow("nswindow", info.window));
+ if (!nswindow)
continue;
ensureNSAppInitialized();
QBoolBlocker block1(blockSendPostedEvents, true);
- info.nswindow = window;
+ info.nswindow = nswindow;
[(NSWindow*) info.nswindow retain];
- int levelBeforeEnterModal = [window level];
- info.session = [NSApp beginModalSessionForWindow:window];
- // Make sure we don't stack the window lower that it was before
- // entering modal, in case it e.g. had the stays-on-top flag set:
- if (levelBeforeEnterModal > [window level])
- [window setLevel:levelBeforeEnterModal];
+ info.session = [NSApp beginModalSessionForWindow:nswindow];
}
currentModalSessionCached = info.session;
cleanupModalSessionsNeeded = false;
@@ -850,12 +862,14 @@ void QCocoaEventDispatcherPrivate::cleanupModalSessions()
currentModalSessionCached = info.session;
break;
}
- cocoaModalSessionStack.remove(i);
currentModalSessionCached = 0;
if (info.session) {
+ Q_ASSERT(info.nswindow != 0);
[NSApp endModalSession:info.session];
[(NSWindow *)info.nswindow release];
}
+ // remove the info now that we are finished with it
+ cocoaModalSessionStack.remove(i);
}
updateChildrenWorksWhenModal();
@@ -864,6 +878,14 @@ void QCocoaEventDispatcherPrivate::cleanupModalSessions()
void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
{
+ // We need to start spinning the modal session. Usually this is done with
+ // QDialog::exec() for QtWidgets based applications, but for others that
+ // just call show(), we need to interrupt(). We call this here, before
+ // setting currentModalSessionCached to zero, so that interrupt() calls
+ // [NSApp abortModal] if another modal session is currently running
+ Q_Q(QCocoaEventDispatcher);
+ q->interrupt();
+
// Add a new, empty (null), NSModalSession to the stack.
// It will become active the next time QEventDispatcher::processEvents is called.
// A QCocoaModalSessionInfo is considered pending to become active if the window pointer
@@ -879,6 +901,8 @@ void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
{
+ Q_Q(QCocoaEventDispatcher);
+
// Mark all sessions attached to window as pending to be stopped. We do this
// by setting the window pointer to zero, but leave the session pointer.
// We don't tell cocoa to stop any sessions just yet, because cocoa only understands
@@ -890,11 +914,14 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
if (info.window == window) {
info.window = 0;
if (i == stackSize-1) {
- // The top sessions ended. Interrupt the event dispatcher
- // to start spinning the correct session immidiatly:
+ // The top sessions ended. Interrupt the event dispatcher to
+ // start spinning the correct session immediately. Like in
+ // beginModalSession(), we call interrupt() before clearing
+ // currentModalSessionCached to make sure we stop any currently
+ // running modal session with [NSApp abortModal]
+ q->interrupt();
currentModalSessionCached = 0;
cleanupModalSessionsNeeded = true;
- QCocoaEventDispatcher::instance()->interrupt();
}
}
}
@@ -917,15 +944,28 @@ QCocoaEventDispatcher::QCocoaEventDispatcher(QObject *parent)
: QAbstractEventDispatcher(*new QCocoaEventDispatcherPrivate, parent)
{
Q_D(QCocoaEventDispatcher);
+
+ // keep our sources running when modal loops are running
+ CFRunLoopAddCommonMode(mainRunLoop(), (CFStringRef) NSModalPanelRunLoopMode);
+
CFRunLoopSourceContext context;
bzero(&context, sizeof(CFRunLoopSourceContext));
context.info = d;
- context.equal = QCocoaEventDispatcherPrivate::postedEventSourceEqualCallback;
- context.perform = QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback;
- d->postedEventsSource = CFRunLoopSourceCreate(0, 0, &context);
+ context.equal = runLoopSourceEqualCallback;
+
+ // source used to activate timers
+ context.perform = QCocoaEventDispatcherPrivate::activateTimersSourceCallback;
+ d->activateTimersSourceRef = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
+ Q_ASSERT(d->activateTimersSourceRef);
+ CFRunLoopAddSource(mainRunLoop(), d->activateTimersSourceRef, kCFRunLoopCommonModes);
+
+ // source used to send posted events
+ context.perform = QCocoaEventDispatcherPrivate::postedEventsSourceCallback;
+ d->postedEventsSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
Q_ASSERT(d->postedEventsSource);
CFRunLoopAddSource(mainRunLoop(), d->postedEventsSource, kCFRunLoopCommonModes);
+ // observer to emit aboutToBlock() and awake()
CFRunLoopObserverContext observerContext;
bzero(&observerContext, sizeof(CFRunLoopObserverContext));
observerContext.info = this;
@@ -961,11 +1001,6 @@ void QCocoaEventDispatcherPrivate::waitingObserverCallback(CFRunLoopObserverRef,
emit static_cast<QCocoaEventDispatcher*>(info)->awake();
}
-Boolean QCocoaEventDispatcherPrivate::postedEventSourceEqualCallback(const void *info1, const void *info2)
-{
- return info1 == info2;
-}
-
void QCocoaEventDispatcherPrivate::processPostedEvents()
{
if (blockSendPostedEvents) {
@@ -1030,9 +1065,14 @@ void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
static_cast<QCocoaEventDispatcherPrivate *>(info)->processPostedEvents();
}
-void QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback(void *info)
+void QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void *info)
{
QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
+ if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {
+ // processEvents() was called "manually," ignore this source for now
+ d->maybeCancelWaitForMoreEvents();
+ return;
+ }
d->processPostedEvents();
d->maybeCancelWaitForMoreEvents();
}
@@ -1061,16 +1101,23 @@ void QCocoaEventDispatcher::interrupt()
{
Q_D(QCocoaEventDispatcher);
d->interrupt = true;
- wakeUp();
-
- // We do nothing more here than setting d->interrupt = true, and
- // poke the event loop if it is sleeping. Actually stopping
- // NSApp, or the current modal session, is done inside the send
- // posted events callback. We do this to ensure that all current pending
- // cocoa events gets delivered before we stop. Otherwise, if we now stop
- // the last event loop recursion, cocoa will just drop pending posted
- // events on the floor before we get a chance to reestablish a new session.
- d->cancelWaitForMoreEvents();
+ if (d->currentModalSessionCached) {
+ // If a modal session is active, abort it so that we can clean it up
+ // later. We can't use [NSApp stopModal] here, because we do not know
+ // where the interrupt() came from.
+ [NSApp abortModal];
+ } else {
+ wakeUp();
+
+ // We do nothing more here than setting d->interrupt = true, and
+ // poke the event loop if it is sleeping. Actually stopping
+ // NSApp, or the current modal session, is done inside the send
+ // posted events callback. We do this to ensure that all current pending
+ // cocoa events gets delivered before we stop. Otherwise, if we now stop
+ // the last event loop recursion, cocoa will just drop pending posted
+ // events on the floor before we get a chance to reestablish a new session.
+ d->cancelWaitForMoreEvents();
+ }
}
void QCocoaEventDispatcher::flush()
@@ -1082,6 +1129,23 @@ QCocoaEventDispatcher::~QCocoaEventDispatcher()
qDeleteAll(d->timerInfoList);
d->maybeStopCFRunLoopTimer();
+ CFRunLoopRemoveSource(mainRunLoop(), d->activateTimersSourceRef, kCFRunLoopCommonModes);
+ CFRelease(d->activateTimersSourceRef);
+
+ // end all modal sessions
+ for (int i = 0; i < d->cocoaModalSessionStack.count(); ++i) {
+ QCocoaModalSessionInfo &info = d->cocoaModalSessionStack[i];
+ if (info.session) {
+ [NSApp endModalSession:info.session];
+ [(NSWindow *)info.nswindow release];
+ }
+ }
+
+ // release all queued user input events
+ for (int i = 0; i < d->queuedUserInputEvents.count(); ++i) {
+ NSEvent *nsevent = static_cast<NSEvent *>(d->queuedUserInputEvents.at(i));
+ [nsevent release];
+ }
// Remove CFSockets from the runloop.
for (MacSocketHash::ConstIterator it = d->macSockets.constBegin(); it != d->macSockets.constEnd(); ++it) {
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
index 7d4da019c2..9768d3e6f9 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
@@ -62,7 +62,7 @@ public:
bool defaultNameFilterDisables() const;
void deleteNativeDialog_sys();
- bool show_sys(ShowFlags flags, Qt::WindowFlags windowFlags, QWindow *parent);
+ bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
void hide_sys();
QPlatformFileDialogHelper::DialogCode dialogResultCode_sys();
void setDirectory_sys(const QString &directory);
@@ -74,7 +74,7 @@ public:
QString selectedNameFilter_sys() const;
public:
- bool showCocoaFilePanel(QWindow *parent);
+ bool showCocoaFilePanel(Qt::WindowModality windowModality, QWindow *parent);
bool hideCocoaFilePanel();
void createNSOpenSavePanelDelegate();
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index c333e3ac1f..9bc7df02fb 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -244,18 +244,18 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
return (mReturnCode == NSOKButton) ? QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Accepted) : QT_PREPEND_NAMESPACE(QPlatformDialogHelper::Rejected);
}
-- (void)showWindowModalSheet:(QWindow *)docWidget
+- (void)showWindowModalSheet:(QWindow *)parent
{
- Q_UNUSED(docWidget);
QFileInfo info(*mCurrentSelection);
NSString *filename = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName());
NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
+ NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent));
[mSavePanel
beginSheetForDirectory:mCurrentDir
file:selectable ? filename : nil
- modalForWindow:nil
+ modalForWindow:nsparent
modalDelegate:self
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
contextInfo:nil];
@@ -613,7 +613,7 @@ void QCocoaFileDialogHelper::hide_sys()
hideCocoaFilePanel();
}
-bool QCocoaFileDialogHelper::show_sys(ShowFlags /* flags */, Qt::WindowFlags windowFlags, QWindow *parent)
+bool QCocoaFileDialogHelper::show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
{
// Q_Q(QFileDialog);
if (windowFlags & Qt::WindowStaysOnTopHint) {
@@ -624,7 +624,7 @@ bool QCocoaFileDialogHelper::show_sys(ShowFlags /* flags */, Qt::WindowFlags win
return false;
}
- return showCocoaFilePanel(parent);
+ return showCocoaFilePanel(windowModality, parent);
}
void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate()
@@ -645,15 +645,15 @@ void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate()
mDelegate = delegate;
}
-bool QCocoaFileDialogHelper::showCocoaFilePanel(QWindow *parent)
+bool QCocoaFileDialogHelper::showCocoaFilePanel(Qt::WindowModality windowModality, QWindow *parent)
{
-// Q_Q(QFileDialog);
createNSOpenSavePanelDelegate();
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
- if (0 /*qt_mac_is_macsheet(qtFileDialog)*/) // ### sheet support.
- [delegate showWindowModalSheet:parent];
- else
+ if (windowModality == Qt::NonModal)
[delegate showModelessPanel];
+ else if (windowModality == Qt::WindowModal && parent)
+ [delegate showWindowModalSheet:parent];
+ // no need to show a Qt::ApplicationModal dialog here, since it will be done in _q_platformRunNativeAppModalPanel()
return true;
}
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
index 8a914bf632..f9dd4357a5 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
@@ -60,7 +60,7 @@ public:
void _q_platformRunNativeAppModalPanel();
void deleteNativeDialog_sys();
- bool show_sys(ShowFlags showFlags, Qt::WindowFlags windowFlags, QWindow *parent);
+ bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
void hide_sys();
QPlatformDialogHelper::DialogCode dialogResultCode_sys();
@@ -70,7 +70,7 @@ public:
protected:
void createNSFontPanelDelegate();
- bool showCocoaFontPanel(QWindow *parent);
+ bool showCocoaFontPanel(Qt::WindowModality windowModality, QWindow *parent);
bool hideCocoaFontPanel();
private:
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index 1e89270775..515bc2a6ee 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -400,9 +400,13 @@ void QCocoaFontDialogHelper::deleteNativeDialog_sys()
mDelegate = 0;
}
-bool QCocoaFontDialogHelper::show_sys(QFlags<QPlatformDialogHelper::ShowFlag>, Qt::WindowFlags, QWindow *parent)
+bool QCocoaFontDialogHelper::show_sys(Qt::WindowFlags, Qt::WindowModality windowModality, QWindow *parent)
{
- return showCocoaFontPanel(parent);
+ if (windowModality == Qt::WindowModal) {
+ // Cocoa's shared font panel cannot be shown as a sheet
+ return false;
+ }
+ return showCocoaFontPanel(windowModality, parent);
}
void QCocoaFontDialogHelper::hide_sys()
@@ -466,12 +470,14 @@ void QCocoaFontDialogHelper::createNSFontPanelDelegate()
mDelegate = delegate;
}
-bool QCocoaFontDialogHelper::showCocoaFontPanel(QWindow *parent)
+bool QCocoaFontDialogHelper::showCocoaFontPanel(Qt::WindowModality windowModality, QWindow *parent)
{
Q_UNUSED(parent);
createNSFontPanelDelegate();
QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate);
- [delegate showModelessPanel];
+ if (windowModality == Qt::NonModal)
+ [delegate showModelessPanel];
+ // no need to show a Qt::ApplicationModal dialog here, since it will be done in _q_platformRunNativeAppModalPanel()
return true;
}
diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.h b/src/plugins/platforms/cocoa/qcocoaprintersupport.h
index db473dfabb..2309025bb3 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintersupport.h
+++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.h
@@ -50,11 +50,11 @@ public:
QCocoaPrinterSupport();
~QCocoaPrinterSupport();
- Q_DECL_OVERRIDE QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode);
- Q_DECL_OVERRIDE QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode);
- Q_DECL_OVERRIDE QList<QPrinter::PaperSize> supportedPaperSizes(const QPrinterInfo &) const;
+ QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE;
+ QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE;
+ QList<QPrinter::PaperSize> supportedPaperSizes(const QPrinterInfo &) const Q_DECL_OVERRIDE;
- Q_DECL_OVERRIDE QList<QPrinterInfo> availablePrinters();
+ QList<QPrinterInfo> availablePrinters() Q_DECL_OVERRIDE;
};
#endif // QCOCOAPRINTERSUPPORT_H
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 184422a04a..d08bbe79ce 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -95,6 +95,7 @@ public:
void setCocoaGeometry(const QRect &rect);
void setVisible(bool visible);
Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags);
+ Qt::WindowState setWindowState(Qt::WindowState state);
void setWindowTitle(const QString &title);
void raise();
void lower();
@@ -117,6 +118,8 @@ public:
void setCurrentContext(QCocoaGLContext *context);
QCocoaGLContext *currentContext() const;
+ bool setWindowModified(bool modified) Q_DECL_OVERRIDE;
+
protected:
// NSWindow handling. The QCocoaWindow/QNSView can either be displayed
// in an existing NSWindow or in one created by Qt.
@@ -127,6 +130,7 @@ protected:
QRect windowGeometry() const;
QCocoaWindow *parentCocoaWindow() const;
+ void syncWindowState(Qt::WindowState newState);
// private:
public: // for QNSView
@@ -136,10 +140,13 @@ public: // for QNSView
QNSView *m_contentView;
NSWindow *m_nsWindow;
Qt::WindowFlags m_windowFlags;
+ Qt::WindowState m_synchedWindowState;
QPointer<QWindow> m_activePopupWindow;
bool m_inConstructor;
QCocoaGLContext *m_glContext;
+
+ bool m_hasModalSession;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index de58842772..83b6534b7c 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -41,6 +41,7 @@
#include "qcocoawindow.h"
#include "qnswindowdelegate.h"
#include "qcocoaautoreleasepool.h"
+#include "qcocoaeventdispatcher.h"
#include "qcocoaglcontext.h"
#include "qcocoahelpers.h"
#include "qnsview.h"
@@ -96,8 +97,10 @@
QCocoaWindow::QCocoaWindow(QWindow *tlw)
: QPlatformWindow(tlw)
, m_nsWindow(0)
+ , m_synchedWindowState(Qt::WindowActive)
, m_inConstructor(true)
, m_glContext(0)
+ , m_hasModalSession(false)
{
QCocoaAutoReleasePool pool;
@@ -145,7 +148,10 @@ void QCocoaWindow::setVisible(bool visible)
qDebug() << "QCocoaWindow::setVisible" << window() << visible;
#endif
if (visible) {
+ QCocoaWindow *parentCocoaWindow = 0;
if (window()->transientParent()) {
+ parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle());
+
// The parent window might have moved while this window was hidden,
// update the window geometry if there is a parent.
setGeometry(window()->geometry());
@@ -154,8 +160,6 @@ void QCocoaWindow::setVisible(bool visible)
// close them when needed.
if (window()->windowType() == Qt::Popup) {
// qDebug() << "transientParent and popup" << window()->windowType() << Qt::Popup << (window()->windowType() & Qt::Popup);
-
- QCocoaWindow *parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle());
parentCocoaWindow->m_activePopupWindow = window();
}
@@ -165,15 +169,47 @@ void QCocoaWindow::setVisible(bool visible)
QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size()));
if (m_nsWindow) {
- if ([m_nsWindow canBecomeKeyWindow])
- [m_nsWindow makeKeyAndOrderFront:nil];
- else
- [m_nsWindow orderFront: nil];
+ // setWindowState might have been called while the window was hidden and
+ // will not change the NSWindow state in that case. Sync up here:
+ syncWindowState(window()->windowState());
+
+ if (window()->windowState() != Qt::WindowMinimized) {
+ if ((window()->windowModality() == Qt::WindowModal
+ || window()->windowType() == Qt::Sheet)
+ && parentCocoaWindow) {
+ // show the window as a sheet
+ [NSApp beginSheet:m_nsWindow modalForWindow:parentCocoaWindow->m_nsWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
+ } else if (window()->windowModality() != Qt::NonModal) {
+ // show the window as application modal
+ QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
+ Q_ASSERT(cocoaEventDispatcher != 0);
+ QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
+ cocoaEventDispatcherPrivate->beginModalSession(window());
+ m_hasModalSession = true;
+ } else if ([m_nsWindow canBecomeKeyWindow]) {
+ [m_nsWindow makeKeyAndOrderFront:nil];
+ } else {
+ [m_nsWindow orderFront: nil];
+ }
+ }
}
} else {
// qDebug() << "close" << this;
- if (m_nsWindow)
+ if (m_nsWindow) {
+ if (m_hasModalSession) {
+ QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
+ Q_ASSERT(cocoaEventDispatcher != 0);
+ QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
+ cocoaEventDispatcherPrivate->endModalSession(window());
+ m_hasModalSession = false;
+ } else {
+ if ([m_nsWindow isSheet])
+ [NSApp endSheet:m_nsWindow];
+ }
[m_nsWindow orderOut:m_nsWindow];
+ }
+ if (!QCoreApplication::closingDown())
+ QWindowSystemInterface::handleExposeEvent(window(), QRegion());
}
}
@@ -183,6 +219,14 @@ Qt::WindowFlags QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
return m_windowFlags;
}
+Qt::WindowState QCocoaWindow::setWindowState(Qt::WindowState state)
+{
+ if ([m_nsWindow isVisible])
+ syncWindowState(state); // Window state set for hidden windows take effect when show() is called.
+
+ return state;
+}
+
void QCocoaWindow::setWindowTitle(const QString &title)
{
QCocoaAutoReleasePool pool;
@@ -347,6 +391,12 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
// Create a new NSWindow if this is a top-level window.
m_nsWindow = createNSWindow();
setNSWindow(m_nsWindow);
+
+ if (window()->transientParent()) {
+ // keep this window on the same level as its transient parent (which may be a modal dialog, for example)
+ QCocoaWindow *parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle());
+ [m_nsWindow setLevel:[parentCocoaWindow->m_nsWindow level]];
+ }
} else {
// Child windows have no NSWindow, link the NSViews instead.
const QCocoaWindow *parentCococaWindow = static_cast<const QCocoaWindow *>(parentWindow);
@@ -446,27 +496,12 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
// QCocoaWindow is deleted by Qt.
[window setReleasedWhenClosed : NO];
- [[NSNotificationCenter defaultCenter] addObserver:m_contentView
- selector:@selector(windowDidBecomeKey)
- name:NSWindowDidBecomeKeyNotification
- object:m_nsWindow];
[[NSNotificationCenter defaultCenter] addObserver:m_contentView
- selector:@selector(windowDidResignKey)
- name:NSWindowDidResignKeyNotification
+ selector:@selector(windowNotification:)
+ name:nil // Get all notifications
object:m_nsWindow];
- [[NSNotificationCenter defaultCenter] addObserver:m_contentView
- selector:@selector(windowDidBecomeMain)
- name:NSWindowDidBecomeMainNotification
- object:m_nsWindow];
-
- [[NSNotificationCenter defaultCenter] addObserver:m_contentView
- selector:@selector(windowDidResignMain)
- name:NSWindowDidResignMainNotification
- object:m_nsWindow];
-
-
// ### Accept touch events by default.
// Beware that enabling touch events has a negative impact on the overall performance.
// We probably need a QWindowSystemInterface API to enable/disable touch events.
@@ -479,7 +514,6 @@ void QCocoaWindow::clearNSWindow(NSWindow *window)
{
[window setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:m_contentView];
- [m_contentView removeFromSuperviewWithoutNeedingDisplay];
}
// Returns the current global screen geometry for the nswindow associated with this window.
@@ -504,3 +538,42 @@ QCocoaWindow *QCocoaWindow::parentCocoaWindow() const
return 0;
}
+// Syncs the NSWindow minimize/maximize/fullscreen state with the current QWindow state
+void QCocoaWindow::syncWindowState(Qt::WindowState newState)
+{
+ if (!m_nsWindow)
+ return;
+
+ if ((m_synchedWindowState & Qt::WindowMaximized) != (newState & Qt::WindowMaximized)) {
+ [m_nsWindow performZoom : m_nsWindow]; // toggles
+ }
+
+ if ((m_synchedWindowState & Qt::WindowMinimized) != (newState & Qt::WindowMinimized)) {
+ if (newState & Qt::WindowMinimized) {
+ [m_nsWindow performMiniaturize : m_nsWindow];
+ } else {
+ [m_nsWindow deminiaturize : m_nsWindow];
+ }
+ }
+
+ if ((m_synchedWindowState & Qt::WindowFullScreen) != (newState & Qt::WindowFullScreen)) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+ [m_nsWindow toggleFullScreen : m_nsWindow];
+ } else {
+ // TODO: "normal" fullscreen
+ }
+#endif
+ }
+
+ // New state is now the current synched state
+ m_synchedWindowState = newState;
+}
+
+bool QCocoaWindow::setWindowModified(bool modified)
+{
+ if (!m_nsWindow)
+ return false;
+ [m_nsWindow setDocumentEdited:(modified?YES:NO)];
+ return true;
+}
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 2b7caae688..16775621bf 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
class QCocoaWindow;
QT_END_NAMESPACE
-@interface QNSView : NSView <NSTextInput> {
+@interface QNSView : NSView <NSTextInputClient> {
CGImageRef m_cgImage;
QWindow *m_window;
QCocoaWindow *m_platformWindow;
@@ -70,8 +70,7 @@ QT_END_NAMESPACE
- (void)setImage:(QImage *)image;
- (void)drawRect:(NSRect)dirtyRect;
- (void)updateGeometry;
-- (void)windowDidBecomeKey;
-- (void)windowDidResignKey;
+- (void)windowNotification : (NSNotification *) windowNotification;
- (BOOL)isFlipped;
- (BOOL)acceptsFirstResponder;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index e76c02704f..a8372f754f 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -144,29 +144,40 @@ static QTouchDevice *touchDevice = 0;
QWindowSystemInterface::handleSynchronousGeometryChange(m_window, geo);
}
-- (void)windowDidBecomeKey
-{
- if (!m_platformWindow->windowIsPopupType())
- QWindowSystemInterface::handleWindowActivated(m_window);
-}
-
-- (void)windowDidResignKey
-{
- if (!m_platformWindow->windowIsPopupType())
- QWindowSystemInterface::handleWindowActivated(0);
-}
+- (void)windowNotification : (NSNotification *) windowNotification
+{
+ //qDebug() << "windowNotification" << QCFString::toQString([windowNotification name]);
+
+ NSString *notificationName = [windowNotification name];
+ if (notificationName == NSWindowDidBecomeKeyNotification) {
+ if (!m_platformWindow->windowIsPopupType())
+ QWindowSystemInterface::handleWindowActivated(m_window);
+ } else if (notificationName == NSWindowDidResignKeyNotification) {
+ if (!m_platformWindow->windowIsPopupType())
+ QWindowSystemInterface::handleWindowActivated(0);
+ } else if (notificationName == NSWindowDidMiniaturizeNotification) {
+ QWindowSystemInterface::handleWindowStateChanged(m_window, Qt::WindowMinimized);
+ } else if (notificationName == NSWindowDidDeminiaturizeNotification) {
+ QWindowSystemInterface::handleWindowStateChanged(m_window, Qt::WindowNoState);
+ // Qt expects an expose event after restore/deminiaturize. This also needs
+ // to be a non-synchronous event to make sure it gets processed after
+ // the state change event sent above.
+ QWindowSystemInterface::handleExposeEvent(m_window, QRegion(m_window->geometry()));
+ } else {
-- (void)windowDidBecomeMain
-{
-// qDebug() << "window did become main" << m_window;
-}
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+ if (notificationName == NSWindowDidEnterFullScreenNotification) {
+ QWindowSystemInterface::handleWindowStateChanged(m_window, Qt::WindowFullScreen);
+ } else if (notificationName == NSWindowDidExitFullScreenNotification) {
+ QWindowSystemInterface::handleWindowStateChanged(m_window, Qt::WindowNoState);
+ }
+ }
+#endif
-- (void)windowDidResignMain
-{
-// qDebug() << "window did resign main" << m_window;
+ }
}
-
- (void) setImage:(QImage *)image
{
CGImageRelease(m_cgImage);
@@ -681,8 +692,9 @@ static QTouchDevice *touchDevice = 0;
[self tryToPerform:aSelector with:self];
}
-- (void) insertText:(id)aString
+- (void) insertText:(id)aString replacementRange:(NSRange)replacementRange
{
+ Q_UNUSED(replacementRange)
QString commitString;
if ([aString length]) {
if ([aString isKindOfClass:[NSAttributedString class]]) {
@@ -707,12 +719,13 @@ static QTouchDevice *touchDevice = 0;
m_composingText.clear();
}
-- (void) setMarkedText:(id)aString selectedRange:(NSRange)selRange
+- (void) setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
{
+ Q_UNUSED(replacementRange)
QString preeditString;
QList<QInputMethodEvent::Attribute> attrs;
- attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, selRange.location + selRange.length, 1, QVariant());
+ attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, selectedRange.location + selectedRange.length, 1, QVariant());
if ([aString isKindOfClass:[NSAttributedString class]]) {
// Preedit string has attribution
@@ -793,13 +806,9 @@ static QTouchDevice *touchDevice = 0;
return (m_composingText.isEmpty() ? NO: YES);
}
-- (NSInteger) conversationIdentifier
-{
- return (NSInteger)self;
-}
-
-- (NSAttributedString *) attributedSubstringFromRange:(NSRange)theRange
+- (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{
+ Q_UNUSED(actualRange)
QObject *fo = QGuiApplication::focusObject();
if (!fo)
return nil;
@@ -813,7 +822,7 @@ static QTouchDevice *touchDevice = 0;
if (selectedText.isEmpty())
return nil;
- QCFString string(selectedText.mid(theRange.location, theRange.length));
+ QCFString string(selectedText.mid(aRange.location, aRange.length));
const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
return [[[NSAttributedString alloc] initWithString:const_cast<NSString *>(tmpString)] autorelease];
}
@@ -831,34 +840,34 @@ static QTouchDevice *touchDevice = 0;
return range;
}
-
- (NSRange) selectedRange
{
- NSRange selRange = {NSNotFound, 0};
- selRange.location = NSNotFound;
- selRange.length = 0;
+ NSRange selectedRange = {NSNotFound, 0};
+ selectedRange.location = NSNotFound;
+ selectedRange.length = 0;
QObject *fo = QGuiApplication::focusObject();
if (!fo)
- return selRange;
+ return selectedRange;
QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection);
if (!QCoreApplication::sendEvent(fo, &queryEvent))
- return selRange;
+ return selectedRange;
if (!queryEvent.value(Qt::ImEnabled).toBool())
- return selRange;
+ return selectedRange;
QString selectedText = queryEvent.value(Qt::ImCurrentSelection).toString();
if (!selectedText.isEmpty()) {
- selRange.location = 0;
- selRange.length = selectedText.length();
+ selectedRange.location = 0;
+ selectedRange.length = selectedText.length();
}
- return selRange;
+ return selectedRange;
}
-- (NSRect) firstRectForCharacterRange:(NSRange)theRange
+- (NSRect) firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{
- Q_UNUSED(theRange);
+ Q_UNUSED(aRange)
+ Q_UNUSED(actualRange)
QObject *fo = QGuiApplication::focusObject();
if (!fo)
return NSZeroRect;
@@ -884,10 +893,10 @@ static QTouchDevice *touchDevice = 0;
return rect;
}
-- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint
+- (NSUInteger)characterIndexForPoint:(NSPoint)aPoint
{
// We dont support cursor movements using mouse while composing.
- Q_UNUSED(thePoint);
+ Q_UNUSED(aPoint);
return NSNotFound;
}
diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h
index 0d2081bef3..12e596d50b 100644
--- a/src/plugins/platforms/directfb/qdirectfbinput.h
+++ b/src/plugins/platforms/directfb/qdirectfbinput.h
@@ -51,6 +51,8 @@
#include "qdirectfbconvenience.h"
+QT_BEGIN_NAMESPACE
+
class QDirectFbInput : public QThread
{
Q_OBJECT
@@ -81,4 +83,6 @@ private:
QHash<DFBWindowID,QWindow *>m_tlwMap;
};
+QT_END_NAMESPACE
+
#endif // QDIRECTFBINPUT_H
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index 421bbd5561..b3bbc4e3e4 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -7,8 +7,6 @@ DESTDIR = $$QT.gui.plugins/platforms
#DEFINES += QEGL_EXTRA_DEBUG
-#DEFINES += Q_OPENKODE
-
#Avoid X11 header collision
DEFINES += MESA_EGL_NO_X11_HEADERS
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
index 8e9e5f76e0..5c1919a4f3 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
@@ -43,12 +43,19 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLPaintDevice>
+#include <QtGui/QOpenGLShaderProgram>
+
+#include <QtGui/QScreen>
QT_BEGIN_NAMESPACE
QEglFSBackingStore::QEglFSBackingStore(QWindow *window)
: QPlatformBackingStore(window)
, m_context(new QOpenGLContext)
+#ifdef EGLFS_BACKINGSTORE_USE_IMAGE
+ , m_texture(0)
+ , m_program(0)
+#endif
{
m_context->setFormat(window->requestedFormat());
m_context->setScreen(window->screen());
@@ -62,7 +69,11 @@ QEglFSBackingStore::~QEglFSBackingStore()
QPaintDevice *QEglFSBackingStore::paintDevice()
{
+#ifdef EGLFS_BACKINGSTORE_USE_IMAGE
+ return &m_image;
+#else
return m_device;
+#endif
}
void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
@@ -74,27 +85,156 @@ void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPo
qWarning("QEglBackingStore::flush %p", window);
#endif
+#ifdef EGLFS_BACKINGSTORE_USE_IMAGE
+ if (!m_program) {
+ static const char *textureVertexProgram =
+ "attribute highp vec2 vertexCoordEntry;\n"
+ "attribute highp vec2 textureCoordEntry;\n"
+ "varying highp vec2 textureCoord;\n"
+ "void main() {\n"
+ " textureCoord = textureCoordEntry;\n"
+ " gl_Position = vec4(vertexCoordEntry, 0.0, 1.0);\n"
+ "}\n";
+
+ static const char *textureFragmentProgram =
+ "uniform sampler2D texture;\n"
+ "varying highp vec2 textureCoord;\n"
+ "void main() {\n"
+ " gl_FragColor = texture2D(texture, textureCoord).bgra;\n"
+ "}\n";
+
+ m_program = new QOpenGLShaderProgram;
+
+ m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
+ m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
+ m_program->link();
+
+ m_vertexCoordEntry = m_program->attributeLocation("vertexCoordEntry");
+ m_textureCoordEntry = m_program->attributeLocation("textureCoordEntry");
+ }
+
+ m_program->bind();
+
+ const GLfloat textureCoordinates[] = {
+ 0, 1,
+ 1, 1,
+ 1, 0,
+ 0, 0
+ };
+
+ QRectF r = window->geometry();
+ QRectF sr = window->screen()->geometry();
+
+ GLfloat x1 = (r.left() / sr.width()) * 2 - 1;
+ GLfloat x2 = (r.right() / sr.width()) * 2 - 1;
+ GLfloat y1 = (r.top() / sr.height()) * 2 - 1;
+ GLfloat y2 = (r.bottom() / sr.height()) * 2 - 1;
+
+ const GLfloat vertexCoordinates[] = {
+ x1, y1,
+ x2, y1,
+ x2, y2,
+ x1, y2
+ };
+
+ glEnableVertexAttribArray(m_vertexCoordEntry);
+ glEnableVertexAttribArray(m_textureCoordEntry);
+
+ glVertexAttribPointer(m_vertexCoordEntry, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinates);
+ glVertexAttribPointer(m_textureCoordEntry, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinates);
+
+ glBindTexture(GL_TEXTURE_2D, m_texture);
+
+ if (!m_dirty.isNull()) {
+ QRect imageRect = m_image.rect();
+
+ QRegion fixed;
+ foreach (const QRect &rect, m_dirty.rects()) {
+ // intersect with image rect to be sure
+ QRect r = imageRect & rect;
+
+ // if the rect is wide enough it's cheaper to just
+ // extend it instead of doing an image copy
+ if (r.width() >= imageRect.width() / 2) {
+ r.setX(0);
+ r.setWidth(imageRect.width());
+ }
+
+ fixed |= r;
+ }
+
+ foreach (const QRect &rect, fixed.rects()) {
+ // if the sub-rect is full-width we can pass the image data directly to
+ // OpenGL instead of copying, since there's no gap between scanlines
+ if (rect.width() == imageRect.width()) {
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE, m_image.constScanLine(rect.y()));
+ } else {
+ glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ m_image.copy(rect).constBits());
+ }
+ }
+
+ m_dirty = QRegion();
+ }
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ glDisableVertexAttribArray(m_vertexCoordEntry);
+ glDisableVertexAttribArray(m_textureCoordEntry);
+#endif
+
m_context->swapBuffers(window);
}
-void QEglFSBackingStore::beginPaint(const QRegion &)
+void QEglFSBackingStore::makeCurrent()
{
// needed to prevent QOpenGLContext::makeCurrent() from failing
window()->setSurfaceType(QSurface::OpenGLSurface);
m_context->makeCurrent(window());
+}
+
+void QEglFSBackingStore::beginPaint(const QRegion &rgn)
+{
+ makeCurrent();
+
+#ifdef EGLFS_BACKINGSTORE_USE_IMAGE
+ m_dirty = m_dirty | rgn;
+#else
+ Q_UNUSED(rgn);
m_device = new QOpenGLPaintDevice(window()->size());
+#endif
}
void QEglFSBackingStore::endPaint()
{
+#ifndef EGLFS_BACKINGSTORE_USE_IMAGE
delete m_device;
+#endif
}
void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents)
{
- Q_UNUSED(size);
Q_UNUSED(staticContents);
+
+#ifdef EGLFS_BACKINGSTORE_USE_IMAGE
+ m_image = QImage(size, QImage::Format_RGB32);
+ makeCurrent();
+ if (m_texture)
+ glDeleteTextures(1, &m_texture);
+ glGenTextures(1, &m_texture);
+ glBindTexture(GL_TEXTURE_2D, m_texture);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+#else
+ Q_UNUSED(size);
+#endif
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.h b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
index 97ea322420..f723bca685 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.h
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
@@ -44,10 +44,16 @@
#include <QtGui/qplatformbackingstore_qpa.h>
+#include <QImage>
+#include <QRegion>
+
+#define EGLFS_BACKINGSTORE_USE_IMAGE
+
QT_BEGIN_NAMESPACE
class QOpenGLContext;
class QOpenGLPaintDevice;
+class QOpenGLShaderProgram;
class QEglFSBackingStore : public QPlatformBackingStore
{
@@ -64,8 +70,19 @@ public:
void resize(const QSize &size, const QRegion &staticContents);
private:
+ void makeCurrent();
+
QOpenGLContext *m_context;
+#ifdef EGLFS_BACKINGSTORE_USE_IMAGE
+ QImage m_image;
+ uint m_texture;
+ QRegion m_dirty;
+ QOpenGLShaderProgram *m_program;
+ int m_vertexCoordEntry;
+ int m_textureCoordEntry;
+#else
QOpenGLPaintDevice *m_device;
+#endif
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
index 7cc3527a0c..c0e202fb70 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -41,6 +41,8 @@
#include "qeglfshooks.h"
+QT_BEGIN_NAMESPACE
+
void QEglFSHooks::platformInit()
{
}
@@ -79,3 +81,5 @@ bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
#ifndef EGLFS_PLATFORM_HOOKS
QEglFSHooks stubHooks;
#endif
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp
index cb788c52f2..af750a73f1 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp
@@ -43,6 +43,8 @@
#include <X11/Xlib.h>
+QT_BEGIN_NAMESPACE
+
class QEglFSX11Hooks : public QEglFSHooks
{
public:
@@ -108,3 +110,4 @@ bool QEglFSX11Hooks::hasCapability(QPlatformIntegration::Capability cap) const
static QEglFSX11Hooks eglFSX11Hooks;
QEglFSHooks *platformHooks = &eglFSX11Hooks;
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index ea939a9821..78f9e13150 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -46,11 +46,6 @@
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
-#ifdef Q_OPENKODE
-#include <KD/kd.h>
-#include <KD/NV_initialize.h>
-#endif //Q_OPENKODE
-
QT_BEGIN_NAMESPACE
// #define QEGL_EXTRA_DEBUG
@@ -196,17 +191,8 @@ void QEglFSScreen::createAndSetPlatformContext()
EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat);
-#ifdef Q_OPENKODE
- if (kdInitializeNV() == KD_ENOTINITIALIZED) {
- qFatal("Did not manage to initialize openkode");
- }
- KDWindow *window = kdCreateWindow(m_dpy,config,0);
-
- kdRealizeWindow(window, &m_window);
-#else
if (hooks)
m_window = hooks->createNativeWindow(hooks->screenSize());
-#endif
#ifdef QEGL_EXTRA_DEBUG
qWarning("Configuration %d matches requirements\n", (int)config);
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index f380542559..e9430eae40 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -54,10 +54,7 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid));
#endif
- QRect screenGeometry(screen()->availableGeometry());
- if (w->geometry() != screenGeometry) {
- QWindowSystemInterface::handleGeometryChange(w, screenGeometry);
- }
+ setWindowState(Qt::WindowFullScreen);
}
void QEglFSWindow::setGeometry(const QRect &)
@@ -69,6 +66,12 @@ void QEglFSWindow::setGeometry(const QRect &)
QPlatformWindow::setGeometry(rect);
}
+Qt::WindowState QEglFSWindow::setWindowState(Qt::WindowState state)
+{
+ setGeometry(QRect());
+ return Qt::WindowFullScreen;
+}
+
WId QEglFSWindow::winId() const
{
return m_winid;
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index 1376708ad6..7f40c78550 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -56,6 +56,7 @@ public:
QEglFSWindow(QWindow *w);
void setGeometry(const QRect &);
+ Qt::WindowState setWindowState(Qt::WindowState state);
WId winId() const;
private:
diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro
deleted file mode 100644
index 0fcf7b1488..0000000000
--- a/src/plugins/platforms/openkode/openkode.pro
+++ /dev/null
@@ -1,42 +0,0 @@
-TARGET = qopenkodeintegration
-load(qt_plugin)
-
-QT += opengl
-
-DESTDIR = $$QT.gui.plugins/platforms
-
-SOURCES = main.cpp \
- qopenkodeintegration.cpp \
- qopenkodewindow.cpp \
- ../eglconvenience/qeglplatformcontext.cpp \
- ../eglconvenience/qeglconvenience.cpp \
- qopenkodeeventloopintegration.cpp
-
-HEADERS = qopenkodeintegration.h \
- qopenkodewindow.h \
- ../eglconvenience/qeglplatformcontext.h \
- ../eglconvenience/qeglconvenience.h \
- qopenkodeeventloopintegration.h \
- openkodekeytranslator.h
-
-CONFIG += qpa/genericunixfontdatabase
-
-RESOURCES = resources.qrc
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
-
-LIBS += -lKD -lEGL
-!isEmpty(QMAKE_INCDIR_OPENGL_ES2){
- INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
-}
-!isEmpty(QMAKE_LIBDIR_OPENGL_ES2){
- for(p, QMAKE_LIBDIR_OPENGL_ES2) {
- exists($$p):LIBS += -L$$p
- }
-}
-!isEmpty(QMAKE_LIBS_OPENGL_ES2){
- LIBS += $$QMAKE_LIBS_OPENGL_ES2
-} else {
- LIBS += -lGLESv2
-}
diff --git a/src/plugins/platforms/openkode/openkodekeytranslator.h b/src/plugins/platforms/openkode/openkodekeytranslator.h
deleted file mode 100644
index 63f4e4e3ac..0000000000
--- a/src/plugins/platforms/openkode/openkodekeytranslator.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef OPENKODEKEYTRANSLATOR_H
-#define OPENKODEKEYTRANSLATOR_H
-
-#ifdef KD_ATX_keyboard
-
-#include <KD/ATX_keyboard.h>
-
-QT_BEGIN_NAMESPACE
-
-Qt::Key keyTranslator( int key )
-{
- switch (key) {
-// KD_KEY_ACCEPT_ATX:
-// KD_KEY_AGAIN_ATX:
-// KD_KEY_ALLCANDIDATES_ATX
-// KD_KEY_ALPHANUMERIC_ATX
- case KD_KEY_ALT_ATX:
- return Qt::Key_Alt;
- case KD_KEY_ALTGRAPH_ATX:
- return Qt::Key_AltGr;
-// KD_KEY_APPS_ATX
-// KD_KEY_ATTN_ATX
-// KD_KEY_BROWSERBACK_ATX
-// KD_KEY_BROWSERFAVORITES_ATX
-// KD_KEY_BROWSERFORWARD_ATX
-// KD_KEY_BROWSERHOME_ATX
-// KD_KEY_BROWSERREFRESH_ATX
-// KD_KEY_BROWSERSEARCH_ATX
-// KD_KEY_BROWSERSTOP_ATX
- case KD_KEY_CAPSLOCK_ATX:
- return Qt::Key_CapsLock;
- case KD_KEY_CLEAR_ATX:
- return Qt::Key_Clear;
- case KD_KEY_CODEINPUT_ATX:
- return Qt::Key_Codeinput;
-// KD_KEY_COMPOSE_ATX
- case KD_KEY_CONTROL_ATX:
- return Qt::Key_Control;
-// KD_KEY_CRSEL_ATX
-// KD_KEY_CONVERT_ATX
- case KD_KEY_COPY_ATX:
- return Qt::Key_Copy;
- case KD_KEY_CUT_ATX:
- return Qt::Key_Cut;
- case KD_KEY_DOWN_ATX:
- return Qt::Key_Down;
- case KD_KEY_END_ATX:
- return Qt::Key_End;
- case KD_KEY_ENTER_ATX:
- return Qt::Key_Enter;
-// KD_KEY_ERASEEOF_ATX
-// KD_KEY_EXECUTE_ATX
-// KD_KEY_EXSEL_ATX
- case KD_KEY_F1_ATX:
- return Qt::Key_F1;
- case KD_KEY_F2_ATX:
- return Qt::Key_F2;
- case KD_KEY_F3_ATX:
- return Qt::Key_F3;
- case KD_KEY_F4_ATX:
- return Qt::Key_F4;
- case KD_KEY_F5_ATX:
- return Qt::Key_F5;
- case KD_KEY_F6_ATX:
- return Qt::Key_F6;
- case KD_KEY_F7_ATX:
- return Qt::Key_F7;
- case KD_KEY_F8_ATX:
- return Qt::Key_F8;
- case KD_KEY_F9_ATX:
- return Qt::Key_F9;
- case KD_KEY_F10_ATX:
- return Qt::Key_F10;
- case KD_KEY_F11_ATX:
- return Qt::Key_F11;
- case KD_KEY_F12_ATX:
- return Qt::Key_F12;
- case KD_KEY_F13_ATX:
- return Qt::Key_F13;
- case KD_KEY_F14_ATX:
- return Qt::Key_F14;
- case KD_KEY_F15_ATX:
- return Qt::Key_F15;
- case KD_KEY_F16_ATX:
- return Qt::Key_F16;
- case KD_KEY_F17_ATX:
- return Qt::Key_F17;
- case KD_KEY_F18_ATX:
- return Qt::Key_F18;
- case KD_KEY_F19_ATX:
- return Qt::Key_F19;
- case KD_KEY_F20_ATX:
- return Qt::Key_F20;
- case KD_KEY_F21_ATX:
- return Qt::Key_F21;
- case KD_KEY_F22_ATX:
- return Qt::Key_F22;
- case KD_KEY_F23_ATX:
- return Qt::Key_F23;
- case KD_KEY_F24_ATX:
- return Qt::Key_F24;
-// KD_KEY_FINALMODE_ATX
-// KD_KEY_FIND_ATX
-// KD_KEY_FULLWIDTH_ATX
-// KD_KEY_HALFWIDTH_ATX
- case KD_KEY_HANGULMODE_ATX:
- return Qt::Key_Hangul;
-// KD_KEY_HANJAMODE_ATX
- case KD_KEY_HELP_ATX:
- return Qt::Key_Help;
- case KD_KEY_HIRAGANA_ATX:
- return Qt::Key_Hiragana;
- case KD_KEY_HOME_ATX:
- return Qt::Key_Home;
- case KD_KEY_INSERT_ATX:
- return Qt::Key_Insert;
-// KD_KEY_JAPANESEHIRAGANA_ATX:
-// KD_KEY_JAPANESEKATAKANA_ATX
-// KD_KEY_JAPANESEROMAJI_ATX
-// KD_KEY_JUNJAMODE_ATX
- case KD_KEY_KANAMODE_ATX:
- return Qt::Key_Kana_Lock; //?
- case KD_KEY_KANJIMODE_ATX:
- return Qt::Key_Kanji;
-// KD_KEY_KATAKANA_ATX
-// KD_KEY_LAUNCHAPPLICATION1_ATX
-// KD_KEY_LAUNCHAPPLICATION2_ATX
- case KD_KEY_LAUNCHMAIL_ATX:
- return Qt::Key_MailForward;
- case KD_KEY_LEFT_ATX:
- return Qt::Key_Left;
- case KD_KEY_META_ATX:
- return Qt::Key_Meta;
- case KD_KEY_MEDIANEXTTRACK_ATX:
- return Qt::Key_MediaNext;
- case KD_KEY_MEDIAPLAYPAUSE_ATX:
- return Qt::Key_MediaPause;
- case KD_KEY_MEDIAPREVIOUSTRACK_ATX:
- return Qt::Key_MediaPrevious;
- case KD_KEY_MEDIASTOP_ATX:
- return Qt::Key_MediaStop;
- case KD_KEY_MODECHANGE_ATX:
- return Qt::Key_Mode_switch;
-// KD_KEY_NONCONVERT_ATX
- case KD_KEY_NUMLOCK_ATX:
- return Qt::Key_NumLock;
- case KD_KEY_PAGEDOWN_ATX:
- return Qt::Key_PageDown;
- case KD_KEY_PAGEUP_ATX:
- return Qt::Key_PageUp;
- case KD_KEY_PASTE_ATX:
- return Qt::Key_Paste;
- case KD_KEY_PAUSE_ATX:
- return Qt::Key_Pause;
- case KD_KEY_PLAY_ATX:
- return Qt::Key_Play;
-// KD_KEY_PREVIOUSCANDIDATE_ATX
- case KD_KEY_PRINTSCREEN_ATX:
- return Qt::Key_Print;
-// case KD_KEY_PROCESS_ATX
-// case KD_KEY_PROPS_ATX
- case KD_KEY_RIGHT_ATX:
- return Qt::Key_Right;
-// KD_KEY_ROMANCHARACTERS_ATX
- case KD_KEY_SCROLL_ATX:
- return Qt::Key_ScrollLock;
- case KD_KEY_SELECT_ATX:
- return Qt::Key_Select;
-// KD_KEY_SELECTMEDIA_ATX
- case KD_KEY_SHIFT_ATX:
- return Qt::Key_Shift;
- case KD_KEY_STOP_ATX:
- return Qt::Key_Stop;
- case KD_KEY_UP_ATX:
- return Qt::Key_Up;
-// KD_KEY_UNDO_ATX
- case KD_KEY_VOLUMEDOWN_ATX:
- return Qt::Key_VolumeDown;
- case KD_KEY_VOLUMEMUTE_ATX:
- return Qt::Key_VolumeMute;
- case KD_KEY_VOLUMEUP_ATX:
- return Qt::Key_VolumeUp;
- case KD_KEY_WIN_ATX:
- return Qt::Key_Meta;
- case KD_KEY_ZOOM_ATX:
- return Qt::Key_Zoom;
- case 0x8:
- return Qt::Key_Backspace;
- case 0x1b:
- return Qt::Key_Escape;
- case 0x9:
- return Qt::Key_Tab;
-
- default:
- break;
- }
-
- return Qt::Key_Escape;
-}
-
-QT_END_NAMESPACE
-#endif //KD_ATX_keyboard
-#endif // OPENKODEKEYTRANSLATOR_H
diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp
deleted file mode 100644
index b0890ccbae..0000000000
--- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenkodeeventloopintegration.h"
-
-#include <QDebug>
-
-#include <KD/kd.h>
-#include <KD/ATX_keyboard.h>
-
-QT_BEGIN_NAMESPACE
-
-static const int QT_EVENT_WAKEUP_EVENTLOOP = KD_EVENT_USER + 1;
-
-void kdprocessevent( const KDEvent *event)
-{
- switch (event->type) {
- case KD_EVENT_INPUT:
- qDebug() << "KD_EVENT_INPUT";
- break;
- case KD_EVENT_INPUT_POINTER:
- qDebug() << "KD_EVENT_INPUT_POINTER";
- break;
- case KD_EVENT_WINDOW_CLOSE:
- qDebug() << "KD_EVENT_WINDOW_CLOSE";
- break;
- case KD_EVENT_WINDOWPROPERTY_CHANGE:
- qDebug() << "KD_EVENT_WINDOWPROPERTY_CHANGE";
- qDebug() << event->data.windowproperty.pname;
- break;
- case KD_EVENT_WINDOW_FOCUS:
- qDebug() << "KD_EVENT_WINDOW_FOCUS";
- break;
- case KD_EVENT_WINDOW_REDRAW:
- qDebug() << "KD_EVENT_WINDOW_REDRAW";
- break;
- case KD_EVENT_USER:
- qDebug() << "KD_EVENT_USER";
- break;
- case KD_EVENT_INPUT_KEY_ATX:
- qDebug() << "KD_EVENT_INPUT_KEY_ATX";
- break;
- case QT_EVENT_WAKEUP_EVENTLOOP:
- QPlatformEventLoopIntegration::processEvents();
- break;
- default:
- break;
- }
-
- kdDefaultEvent(event);
-
-}
-
-QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration()
- : m_quit(false)
-{
- m_kdThread = kdThreadSelf();
- kdInstallCallback(&kdprocessevent,QT_EVENT_WAKEUP_EVENTLOOP,this);
-}
-
-void QOpenKODEEventLoopIntegration::startEventLoop()
-{
-
- while(!m_quit) {
- qint64 msec = nextTimerEvent();
- const KDEvent *event = kdWaitEvent(msec);
- if (event) {
- kdDefaultEvent(event);
- while ((event = kdWaitEvent(0)) != 0) {
- kdDefaultEvent(event);
- }
- }
- QPlatformEventLoopIntegration::processEvents();
- }
-}
-
-void QOpenKODEEventLoopIntegration::quitEventLoop()
-{
- m_quit = true;
-}
-
-void QOpenKODEEventLoopIntegration::qtNeedsToProcessEvents()
-{
- KDEvent *event = kdCreateEvent();
- event->type = QT_EVENT_WAKEUP_EVENTLOOP;
- event->userptr = this;
- kdPostThreadEvent(event,m_kdThread);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp
deleted file mode 100644
index 705f332826..0000000000
--- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenkodeintegration.h"
-#include "qopenkodewindow.h"
-#include "qopenkodeeventloopintegration.h"
-
-#include <QtOpenGL/qplatformpixmap_gl_p.h>
-#include <QtOpenGL/private/qwindowsurface_gl_p.h>
-
-#include <QtGui/private/qpixmap_raster_p.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qthread.h>
-#include <QtCore/qfile.h>
-
-#include "qgenericunixfontdatabase.h"
-
-#include <KD/kd.h>
-#include <KD/NV_display.h>
-#include <KD/NV_initialize.h>
-
-#include <EGL/egl.h>
-
-#include "GLES2/gl2ext.h"
-
-QT_BEGIN_NAMESPACE
-
-QOpenKODEScreen::QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop)
- : mIsFullScreen(false)
-{
- qDebug() << "QOpenKODEScreen::QOpenKODEIntegrationScreen()";
-
- KDboolean enabled = KD_TRUE;
- kdSetDisplayPropertybvNV(kdDisplay,
- KD_DISPLAYPROPERTY_ENABLED_NV,
- &enabled);
- KDboolean power = KD_DISPLAY_POWER_ON;
- kdSetDisplayPropertyivNV(kdDisplay,
- KD_DISPLAYPROPERTY_POWER_NV,
- &power);
-
- kdSetDisplayPropertycvNV(kdDisplay,
- KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,
- KD_DEFAULT_DESKTOP_NV);
-
- KDDisplayModeNV mode;
- if (kdGetDisplayModeNV(kdDisplay, &mode)) {
- qErrnoWarning(kdGetError(), "Could not get display mode");
- return;
- }
-
- qDebug() << " - display mode " << mode.width << "x" << mode.height << " refresh " << mode.refresh;
-
- KDint desktopSize[] = { mode.width, mode.height };
-
- if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) {
- qErrnoWarning(kdGetError(), "Could not set desktop size");
- return;
- }
-
- // Once we've set up the desktop and display we don't need them anymore
- kdReleaseDisplayNV(kdDisplay);
- kdReleaseDesktopNV(kdDesktop);
-
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (mEglDisplay == EGL_NO_DISPLAY) {
- qErrnoWarning("EGL failed to obtain display");
- }
-
- /* Initialize EGL display */
- EGLBoolean rvbool = eglInitialize(mEglDisplay, 0, 0);
- if (!rvbool) {
- qErrnoWarning("EGL failed to initialize display");
- }
-
-// cursor = new QOpenKODECursor(this);
-
- mGeometry = QRect(0, 0, mode.width, mode.height);
- mDepth = 24;
- mFormat = QImage::Format_RGB32;
-
-
-}
-
-QOpenKODEIntegration::QOpenKODEIntegration()
- : mEventLoopIntegration(0)
- , mFontDb(new QGenericUnixFontDatabase())
- , mMainGlContext(0)
-{
- if (kdInitializeNV() == KD_ENOTINITIALIZED) {
- qFatal("Did not manage to initialize openkode");
- }
-
- KDDisplaySystemNV *kdDisplaySystem = kdCreateDisplaySystemSnapshotNV(this);
- KDint32 displayCount = 0;
- kdGetDisplaySystemPropertyivNV(kdDisplaySystem, KD_DISPLAYPROPERTY_COUNT_NV, 0, &displayCount);
-
- for (int i = 0; i < displayCount; i++) {
- KDchar *displayName = 0;
- KDsize displayNameLength = 0;
- kdGetDisplaySystemPropertycvNV(kdDisplaySystem,KD_DISPLAYPROPERTY_NAME_NV,i,0,&displayNameLength);
- if (!displayNameLength)
- continue;
- displayName = new KDchar[displayNameLength];
- kdGetDisplaySystemPropertycvNV(kdDisplaySystem,KD_DISPLAYPROPERTY_NAME_NV,i,displayName,&displayNameLength);
-
- KDDisplayNV *display = kdGetDisplayNV(displayName,this);
- if (!display || display == (void*)-1) {
- qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer");
- return;
- }
- if (displayNameLength)
- delete[] displayName;
-
- KDchar *desktopName = 0;
- KDsize desktopNameLength = 0;
- bool openkodeImpDoesNotFail = false;
- if (openkodeImpDoesNotFail) {
- qDebug() << "printing desktopname";
- kdGetDisplayPropertycvNV(display,KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,desktopName,&desktopNameLength);
- if (desktopNameLength) {
- desktopName = new KDchar[desktopNameLength];
- kdGetDisplayPropertycvNV(display,KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,desktopName,&desktopNameLength);
- } else {
- desktopName = KD_DEFAULT_DESKTOP_NV;
- }
- } else {
- desktopName = KD_DEFAULT_DESKTOP_NV;
- }
-
- KDDesktopNV *desktop = kdGetDesktopNV(desktopName,this);
- if (!desktop || desktop == (void*)-1) {
- qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer");
- kdReleaseDisplayNV(display);
- return;
- }
- if (desktopNameLength)
- delete desktopName;
-
- QOpenKODEScreen *screen = new QOpenKODEScreen(display,desktop);
- mScreens.append(screen);
- }
-}
-
-QOpenKODEIntegration::~QOpenKODEIntegration()
-{
- delete mEventLoopIntegration;
- delete mFontDb;
-}
-
-
-bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) const
-{
- switch (cap) {
- case ThreadedPixmaps: return true;
- case OpenGL: return true;
- default: return QPlatformIntegration::hasCapability(cap);
- }
-}
-
-QPlatformPixmap *QOpenKODEIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
-{
- return new QGLPlatformPixmap(type);
-}
-
-QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) const
-{
- return new QOpenKODEWindow(tlw);
-}
-
-QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId) const
-{
- QWindowSurface *returnSurface = 0;
- switch (widget->platformWindowFormat().windowApi()) {
-
- case QPlatformWindowFormat::Raster:
- case QPlatformWindowFormat::OpenGL:
- returnSurface = new QGLWindowSurface(widget);
- break;
-
- case QPlatformWindowFormat::OpenVG:
-// returnSurface = new QVGWindowSurface(widget);
-// break;
-
- default:
- returnSurface = new QGLWindowSurface(widget);
- break;
- }
-
- return returnSurface;
-}
-
-QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration() const
-{
- if (!mEventLoopIntegration) {
- QOpenKODEIntegration *that = const_cast<QOpenKODEIntegration *>(this);
- that->mEventLoopIntegration = new QOpenKODEEventLoopIntegration;
- }
- return mEventLoopIntegration;
-}
-
-QPlatformFontDatabase *QOpenKODEIntegration::fontDatabase() const
-{
- return mFontDb;
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h
deleted file mode 100644
index 31d76dcad7..0000000000
--- a/src/plugins/platforms/openkode/qopenkodeintegration.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_OPENKODE_H
-#define QGRAPHICSSYSTEM_OPENKODE_H
-
-#include "qopenkodeeventloopintegration.h"
-
-#include <QtCore/qsemaphore.h>
-
-#include <QtGui/QPlatformIntegration>
-#include <QtGui/QPlatformScreen>
-#include <QtGui/QPlatformOpenGLContext>
-#include <QtGui/QPlatformFontDatabase>
-
-#include <GLES2/gl2.h>
-#include <EGL/egl.h>
-
-QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE
-
-struct KDDesktopNV;
-struct KDDisplayNV;
-class QOpenKODECursor;
-
-class QOpenKODEScreen : public QPlatformScreen
-{
- Q_OBJECT
-public:
- QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop);
- ~QOpenKODEScreen() {}
-
- QRect geometry() const { return mGeometry; }
- int depth() const { return mDepth; }
- QImage::Format format() const { return mFormat; }
-
- EGLDisplay eglDisplay() { return mEglDisplay; }
-
- bool isFullScreen() const {return mIsFullScreen;}
- void setFullScreen(bool fullscreen) { mIsFullScreen = fullscreen; }
-private:
- QRect mGeometry;
- int mDepth;
- QImage::Format mFormat;
- EGLDisplay mEglDisplay;
- bool mIsFullScreen;
-};
-
-class QOpenKODEIntegration : public QPlatformIntegration
-{
-public:
- QOpenKODEIntegration();
- ~QOpenKODEIntegration();
-
- bool hasCapability(QPlatformIntegration::Capability cap) const;
-
- QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
- QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
- QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
-
- QPlatformEventLoopIntegration *createEventLoopIntegration() const;
-
- QPlatformFontDatabase *fontDatabase() const;
-
- virtual QList<QPlatformScreen *> screens() const { return mScreens; }
-
- static GLuint blitterProgram();
-
- void setMainGLContext(QEGLPlatformContext *ctx) { mMainGlContext = ctx; }
- void mainGLContext() const { return mMainGlContext; }
-
-private:
- QList<QPlatformScreen *> mScreens;
- QOpenKODEEventLoopIntegration *mEventLoopIntegration;
- QPlatformFontDatabase *mFontDb;
- QEGLPlatformContext *mMainGlContext;
-};
-
-QT_END_NAMESPACE
-QT_END_HEADER
-
-#endif
diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp
deleted file mode 100644
index 23bcd12440..0000000000
--- a/src/plugins/platforms/openkode/qopenkodewindow.cpp
+++ /dev/null
@@ -1,315 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenkodewindow.h"
-#include "qopenkodeintegration.h"
-#include "../eglconvenience/qeglplatformcontext.h"
-#include "../eglconvenience/qeglconvenience.h"
-
-#include <KD/kd.h>
-#include <KD/NV_display.h>
-#include <KD/kdplatform.h>
-#ifdef KD_ATX_keyboard
-#include "openkodekeytranslator.h"
-#endif
-
-#include <EGL/egl.h>
-
-#include <QtWidgets/qwidget.h>
-#include <QtGui/private/qwidget_p.h>
-#include <QtGui/private/qapplication_p.h>
-
-#include <QtCore/qvector.h>
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-void kdProcessMouseEvents( const KDEvent *event )
-{
- QOpenKODEWindow *window = static_cast<QOpenKODEWindow *>(event->userptr);
- window->processMouseEvents(event);
-}
-
-#ifdef KD_ATX_keyboard
-void kdProcessKeyEvents( const KDEvent *event )
-{
- QOpenKODEWindow *window = static_cast<QOpenKODEWindow *>(event->userptr);
- window->processKeyEvents(event);
-}
-#endif //KD_ATX_keyboard
-
-QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw)
- : QPlatformWindow(tlw), isFullScreen(false)
-{
- if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) {
- m_eglApi = EGL_OPENVG_API;
- } else {
- m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
- m_eglContextAttrs.append(2);
-
- m_eglApi = EGL_OPENGL_ES_API;
- }
- eglBindAPI(m_eglApi);
-
- m_eglContextAttrs.append(EGL_NONE);
- m_eglWindowAttrs.append(EGL_NONE);
-
- QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens();
- //XXXX: jl figure out how to pick the correct screen.
-// Q_ASSERT(screens.size() > tlw->d_func()->screenNumber);
-// QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(tlw->d_func()->screenNumber));
- QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0));
- if (!screen) {
- qErrnoWarning("Could not make QOpenKODEWindow without a screen");
- }
-
- QPlatformWindowFormat format = tlw->platformWindowFormat();
- format.setRedBufferSize(5);
- format.setGreenBufferSize(6);
- format.setBlueBufferSize(5);
-
- m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),format);
-
- m_kdWindow = kdCreateWindow(screen->eglDisplay(),
- m_eglConfig,
- this);
- kdInstallCallback(kdProcessMouseEvents,KD_EVENT_INPUT_POINTER,this);
-#ifdef KD_ATX_keyboard
- kdInstallCallback(kdProcessKeyEvents, KD_EVENT_INPUT_KEY_ATX,this);
-#endif //KD_ATX_keyboard
-
- if (!m_kdWindow) {
- qErrnoWarning(kdGetError(), "Error creating native window");
- return;
- }
-
- KDboolean exclusive(false);
- if (kdSetWindowPropertybv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, &exclusive)) {
- isFullScreen = true;
- }
-
- if (isFullScreen) {
- tlw->setGeometry(screen->geometry());
- screen->setFullScreen(isFullScreen);
- }else {
- const KDint windowSize[2] = { tlw->width(), tlw->height() };
- if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) {
- qErrnoWarning(kdGetError(), "Could not set native window size");
- }
- KDboolean visibillity(false);
- if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) {
- qErrnoWarning(kdGetError(), "Could not set visibillity to false");
- }
-
- const KDint windowPos[2] = { tlw->x(), tlw->y() };
- if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) {
- qErrnoWarning(kdGetError(), "Could not set native window position");
- return;
- }
- }
-
-
- QOpenKODEIntegration *integration = static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration());
-
- if (!isFullScreen || (isFullScreen && !integration->mainGLContext())) {
- if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) {
- qErrnoWarning(kdGetError(), "Could not realize native window");
- return;
- }
-
- EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData());
- m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig,
- m_eglContextAttrs.data(), surface, m_eglApi);
- integration->setMainGLContext(m_platformGLContext);
- } else {
- m_platformGlContext = integration->mainGLContext();
- kdDestroyWindow(m_kdWindow);
- m_kdWindow = 0;
- }
-}
-
-
-QOpenKODEWindow::~QOpenKODEWindow()
-{
- if (m_platformGlContext != static_cast<QOpenKODEIntegration *>(QApplicationPrivate::platformIntegration())) {
- delete m_platformGlContext;
- }
- if (m_kdWindow)
- kdDestroyWindow(m_kdWindow);
-}
-void QOpenKODEWindow::setGeometry(const QRect &rect)
-{
- if (isFullScreen) {
- QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens();
- QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0));
- widget()->setGeometry(screen->geometry());
- return;
- }
- bool needToDeleteContext = false;
- if (!isFullScreen) {
- const QRect geo = geometry();
- if (geo.size() != rect.size()) {
- const KDint windowSize[2] = { rect.width(), rect.height() };
- if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) {
- qErrnoWarning(kdGetError(), "Could not set native window size");
- //return;
- } else {
- needToDeleteContext = true;
- }
- }
-
- if (geo.topLeft() != rect.topLeft()) {
- const KDint windowPos[2] = { rect.x(), rect.y() };
- if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) {
- qErrnoWarning(kdGetError(), "Could not set native window position");
- //return;
- } else {
- needToDeleteContext = true;
- }
- }
- }
-
- //need to recreate context
- if (needToDeleteContext) {
- delete m_platformGlContext;
-
- QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens();
- QOpenKODEScreen *screen = qobject_cast<QOpenKODEScreen *>(screens.at(0));
- EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData());
- m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,
- m_eglContextAttrs.data(),surface,m_eglApi);
- }
-}
-
-void QOpenKODEWindow::setVisible(bool visible)
-{
- if (!m_kdWindow)
- return;
- KDboolean visibillity(visible);
- if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) {
- qErrnoWarning(kdGetError(), "Could not set visibillity property");
- }
-}
-
-WId QOpenKODEWindow::winId() const
-{
- static int i = 0;
- return i++;
-}
-
-QPlatformOpenGLContext *QOpenKODEWindow::glContext() const
-{
- return m_platformGlContext;
-}
-
-void QOpenKODEWindow::raise()
-{
- if (!m_kdWindow)
- return;
- KDboolean focus(true);
- if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) {
- qErrnoWarning(kdGetError(), "Could not set focus");
- }
-}
-
-void QOpenKODEWindow::lower()
-{
- if (!m_kdWindow)
- return;
- KDboolean focus(false);
- if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) {
- qErrnoWarning(kdGetError(), "Could not set focus");
- }
-}
-
-void QOpenKODEWindow::processMouseEvents(const KDEvent *event)
-{
- int x = event->data.inputpointer.x;
- int y = event->data.inputpointer.y;
- Qt::MouseButtons buttons;
- switch(event->data.inputpointer.select) {
- case 1:
- buttons = Qt::LeftButton;
- break;
- default:
- buttons = Qt::NoButton;
- }
- QPoint pos(x,y);
- QWindowSystemInterface::handleMouseEvent(0,event->timestamp,pos,pos,buttons);
-}
-
-void QOpenKODEWindow::processKeyEvents(const KDEvent *event)
-{
-#ifdef KD_ATX_keyboard
- //KD_KEY_PRESS_ATX 1
- QEvent::Type keyPressed = QEvent::KeyRelease;
- if (event->data.keyboardInputKey.flags)
- keyPressed = QEvent::KeyPress;
-//KD_KEY_LOCATION_LEFT_ATX // dont care for now
-//KD_KEY_LOCATION_RIGHT_ATX
-//KD_KEY_LOCATION_NUMPAD_ATX
- Qt::KeyboardModifiers mod = Qt::NoModifier;
- int openkodeMods = event->data.keyboardInputKey.flags;
- if (openkodeMods & KD_KEY_MODIFIER_SHIFT_ATX)
- mod |= Qt::ShiftModifier;
- if (openkodeMods & KD_KEY_MODIFIER_CTRL_ATX)
- mod |= Qt::ControlModifier;
- if (openkodeMods & KD_KEY_MODIFIER_ALT_ATX)
- mod |= Qt::AltModifier;
- if (openkodeMods & KD_KEY_MODIFIER_META_ATX)
- mod |= Qt::MetaModifier;
-
- Qt::Key qtKey;
- QChar keyText;
- int key = event->data.keyboardInputKey.keycode;
- if (key >= 0x20 && key <= 0x0ff){ // 8 bit printable Latin1
- qtKey = Qt::Key(key);
- keyText = QChar(event->data.keyboardInputKeyChar.character);
- if (!(mod & Qt::ShiftModifier))
- keyText = keyText.toLower();
- } else {
- qtKey = keyTranslator(key);
- }
- QWindowSystemInterface::handleKeyEvent(0,event->timestamp,keyPressed,qtKey,mod,keyText);
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h
deleted file mode 100644
index 7685350eb8..0000000000
--- a/src/plugins/platforms/openkode/qopenkodewindow.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENKODEWINDOW_H
-#define QOPENKODEWINDOW_H
-
-#include <QtGui/QPlatformWindow>
-#include <QtCore/QVector>
-
-#include <KD/kd.h>
-
-QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE
-
-class QEGLPlatformContext;
-class QPlatformEventLoopIntegration;
-
-class QOpenKODEWindow : public QPlatformWindow
-{
-public:
- QOpenKODEWindow(QWidget *tlw);
- ~QOpenKODEWindow();
-
- void setGeometry(const QRect &rect);
- void setVisible(bool visible);
- WId winId() const;
-
- QPlatformOpenGLContext *glContext() const;
-
- void raise();
- void lower();
-
- void processKeyEvents( const KDEvent *event );
- void processMouseEvents( const KDEvent *event );
-
-private:
- struct KDWindow *m_kdWindow;
- EGLNativeWindowType m_eglWindow;
- EGLConfig m_eglConfig;
- QVector<EGLint> m_eglWindowAttrs;
- QVector<EGLint> m_eglContextAttrs;
- EGLenum m_eglApi;
- QEGLPlatformContext *m_platformGlContext;
-
- bool isFullScreen;
-};
-
-QT_END_NAMESPACE
-QT_END_HEADER
-
-#endif //QOPENKODEWINDOW_H
diff --git a/src/plugins/platforms/openkode/resources.qrc b/src/plugins/platforms/openkode/resources.qrc
deleted file mode 100644
index dbb34199ff..0000000000
--- a/src/plugins/platforms/openkode/resources.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>shaders/vert.glslv</file>
- <file>shaders/frag.glslf</file>
-</qresource>
-</RCC>
diff --git a/src/plugins/platforms/openvglite/openvglite.pro b/src/plugins/platforms/openvglite/openvglite.pro
deleted file mode 100644
index bb7efe9bf3..0000000000
--- a/src/plugins/platforms/openvglite/openvglite.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qvglitegraphicssystem
-load(qt_plugin)
-
-QT += openvg
-
-DESTDIR = $$QT.gui.plugins/graphicssystems
-
-SOURCES = main.cpp qgraphicssystem_vglite.cpp qwindowsurface_vglite.cpp
-HEADERS = qgraphicssystem_vglite.h qwindowsurface_vglite.h
-
-target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
-INSTALLS += target
diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp
deleted file mode 100644
index f5b154fd38..0000000000
--- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicssystem_vglite.h"
-#include "qwindowsurface_vglite.h"
-#include <QtOpenVG/qplatformpixmap_vg_p.h>
-#include <QtGui/private/qegl_p.h>
-#include <QtCore/qdebug.h>
-#ifdef OPENVG_USBHP_INIT
-extern "C" {
-#include <linuxusbhp.h>
-};
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QVGLiteGraphicsSystem::QVGLiteGraphicsSystem()
- : w(0), h(0), d(0), dw(0), dh(0), physWidth(0), physHeight(0),
- surface(0), context(0), rootWindow(0),
- screenFormat(QImage::Format_RGB16), preservedSwap(false)
-{
-#ifdef OPENVG_USBHP_INIT
- initLibrary();
-#endif
-
- // The graphics system is also the screen definition.
- mScreens.append(this);
-
- QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY"));
- QStringList displayArgs = displaySpec.split(QLatin1Char(':'));
-
- // Initialize EGL and create the global EGL context.
- context = qt_vg_create_context(0);
- if (!context) {
- qFatal("QVGLiteGraphicsSystem: could not initialize EGL");
- return;
- }
-
- // Get the root window handle to use. Default to zero.
- QRegExp winidRx(QLatin1String("winid=?(\\d+)"));
- int winidIdx = displayArgs.indexOf(winidRx);
- int handle = 0;
- if (winidIdx >= 0) {
- winidRx.exactMatch(displayArgs.at(winidIdx));
- handle = winidRx.cap(1).toInt();
- }
-
- // Create a full-screen window based on the native handle.
- // If the context is premultiplied, the window should be too.
- QEglProperties props;
-#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
- EGLint surfaceType = 0;
- if (context->configAttrib(EGL_SURFACE_TYPE, &surfaceType) &&
- (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
- props.setValue(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE);
-#endif
- rootWindow = eglCreateWindowSurface
- (context->display(), context->config(),
- (EGLNativeWindowType)handle, props.properties());
- if (rootWindow == EGL_NO_SURFACE) {
- delete context;
- context = 0;
- qFatal("QVGLiteGraphicsSystem: could not create full-screen window");
- return;
- }
-
- // Try to turn on preserved swap behaviour on the root window.
- // This will allow us to optimize compositing to focus on just
- // the screen region that has changed. Otherwise we must
- // re-composite the entire screen every frame.
-#if !defined(QVG_NO_PRESERVED_SWAP)
- eglGetError(); // Clear error state first.
- eglSurfaceAttrib(context->display(), rootWindow,
- EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
- preservedSwap = (eglGetError() == EGL_SUCCESS);
-#else
- preservedSwap = false;
-#endif
-
- // Fetch the root window properties.
- eglQuerySurface(context->display(), rootWindow, EGL_WIDTH, &w);
- eglQuerySurface(context->display(), rootWindow, EGL_HEIGHT, &h);
- screenFormat = qt_vg_config_to_image_format(context);
- switch (screenFormat) {
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB32:
- case QImage::Format_RGB32:
- default:
- d = 32;
- break;
- case QImage::Format_RGB16:
- case QImage::Format_ARGB4444_Premultiplied:
- d = 16;
- break;
- }
- dw = w;
- dh = h;
- qDebug("screen size: %dx%dx%d", w, h, d);
-
- // Handle display physical size spec. From qscreenlinuxfb_qws.cpp.
- QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)"));
- int dimIdxW = displayArgs.indexOf(mmWidthRx);
- QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)"));
- int dimIdxH = displayArgs.indexOf(mmHeightRx);
- if (dimIdxW >= 0) {
- mmWidthRx.exactMatch(displayArgs.at(dimIdxW));
- physWidth = mmWidthRx.cap(1).toInt();
- if (dimIdxH < 0)
- physHeight = dh*physWidth/dw;
- }
- if (dimIdxH >= 0) {
- mmHeightRx.exactMatch(displayArgs.at(dimIdxH));
- physHeight = mmHeightRx.cap(1).toInt();
- if (dimIdxW < 0)
- physWidth = dw*physHeight/dh;
- }
- if (dimIdxW < 0 && dimIdxH < 0) {
- const int dpi = 72;
- physWidth = qRound(dw * 25.4 / dpi);
- physHeight = qRound(dh * 25.4 / dpi);
- }
-}
-
-QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem()
-{
-}
-
-QPlatformPixmap *QVGLiteGraphicsSystem::createPlatformPixmap(QPlatformPixmap::PixelType type) const
-{
-#if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA)
- // Pixmaps can use QVGLitePlatformPixmap; bitmaps must use raster.
- if (type == QPlatformPixmap::PixmapType)
- return new QVGPlatformPixmap(type);
- else
- return new QRasterPlatformPixmap(type);
-#else
- return new QRasterPlatformPixmap(type);
-#endif
-}
-
-QWindowSurface *QVGLiteGraphicsSystem::createWindowSurface(QWidget *widget) const
-{
- if (widget->windowType() == Qt::Desktop)
- return 0; // Don't create an explicit window surface for the destkop.
- if (surface) {
- qWarning() << "QVGLiteGraphicsSystem: only one window surface "
- "is supported at a time";
- return 0;
- }
- surface = new QVGLiteWindowSurface
- (const_cast<QVGLiteGraphicsSystem *>(this), widget);
- return surface;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h
deleted file mode 100644
index 46faf7cd2c..0000000000
--- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_VGLITE_H
-#define QGRAPHICSSYSTEM_VGLITE_H
-
-#include <QtGui/private/qgraphicssystem_p.h>
-#include <QtGui/private/qegl_p.h>
-#include <QtGui/qimage.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVGLiteWindowSurface;
-
-class QVGLiteGraphicsSystem : public QGraphicsSystem,
- public QGraphicsSystemScreen
-{
-public:
- QVGLiteGraphicsSystem();
- ~QVGLiteGraphicsSystem();
-
- QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
- QWindowSurface *createWindowSurface(QWidget *widget) const;
- QList<QGraphicsSystemScreen *> screens() const { return mScreens; }
-
- QRect geometry() const { return QRect(0, 0, w, h); }
- int depth() const { return d; }
- QImage::Format format() const { return screenFormat; }
- QSize physicalSize() const { return QSize(physWidth, physHeight); }
-
-private:
- friend class QVGLiteWindowSurface;
-
- int w;
- int h;
- int d;
-
- int dw;
- int dh;
-
- int physWidth;
- int physHeight;
-
- mutable QVGLiteWindowSurface *surface;
- QEglContext *context;
- EGLSurface rootWindow;
- QImage::Format screenFormat;
- bool preservedSwap;
-
- QList<QGraphicsSystemScreen *> mScreens;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp
deleted file mode 100644
index f50067e030..0000000000
--- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowsurface_vglite.h"
-#include "qgraphicssystem_vglite.h"
-#include <QtOpenVG/qvg.h>
-#include <QtOpenVG/private/qvg_p.h>
-#include <QtOpenVG/private/qpaintengine_vg_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QVGLiteWindowSurface::QVGLiteWindowSurface
- (QVGLiteGraphicsSystem *gs, QWidget *window)
- : QWindowSurface(window), graphicsSystem(gs),
- isPaintingActive(false), engine(0)
-{
-}
-
-QVGLiteWindowSurface::~QVGLiteWindowSurface()
-{
- graphicsSystem->surface = 0;
- if (engine)
- qt_vg_destroy_paint_engine(engine);
-}
-
-QPaintDevice *QVGLiteWindowSurface::paintDevice()
-{
- qt_vg_make_current(graphicsSystem->context, graphicsSystem->rootWindow);
- isPaintingActive = true;
- // TODO: clear the parts of the back buffer that are not
- // covered by the window surface to black.
- return this;
-}
-
-void QVGLiteWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
-{
- Q_UNUSED(widget);
- Q_UNUSED(region);
- Q_UNUSED(offset);
- QEglContext *context = graphicsSystem->context;
- if (context) {
- if (!isPaintingActive)
- qt_vg_make_current(context, graphicsSystem->rootWindow);
- context->swapBuffers();
- qt_vg_done_current(context);
- context->setSurface(EGL_NO_SURFACE);
- isPaintingActive = false;
- }
-}
-
-void QVGLiteWindowSurface::setGeometry(const QRect &rect)
-{
- QWindowSurface::setGeometry(rect);
-}
-
-bool QVGLiteWindowSurface::scroll(const QRegion &area, int dx, int dy)
-{
- return QWindowSurface::scroll(area, dx, dy);
-}
-
-void QVGLiteWindowSurface::beginPaint(const QRegion &region)
-{
- Q_UNUSED(region);
-}
-
-void QVGLiteWindowSurface::endPaint(const QRegion &region)
-{
- Q_UNUSED(region);
-}
-
-QPaintEngine *QVGLiteWindowSurface::paintEngine() const
-{
- if (!engine)
- engine = qt_vg_create_paint_engine();
- return engine;
-}
-
-// We need to get access to QWidget::metric() from QVGLiteWindowSurface::metric,
-// but it is not a friend of QWidget. To get around this, we create a
-// fake QX11PaintEngine class, which is a friend.
-class QX11PaintEngine
-{
-public:
- static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met)
- {
- return widget->metric(met);
- }
-};
-
-int QVGLiteWindowSurface::metric(PaintDeviceMetric met) const
-{
- return QX11PaintEngine::metric(window(), met);
-}
diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h
deleted file mode 100644
index b3ee1df325..0000000000
--- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSURFACE_VGLITE_H
-#define QWINDOWSURFACE_VGLITE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qwindowsurface_p.h>
-#include <QtGui/private/qegl_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVGLiteGraphicsSystem;
-class QVGPaintEngine;
-
-class Q_OPENVG_EXPORT QVGLiteWindowSurface : public QWindowSurface, public QPaintDevice
-{
-public:
- QVGLiteWindowSurface(QVGLiteGraphicsSystem *gs, QWidget *window);
- ~QVGLiteWindowSurface();
-
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void setGeometry(const QRect &rect);
- bool scroll(const QRegion &area, int dx, int dy);
-
- void beginPaint(const QRegion &region);
- void endPaint(const QRegion &region);
-
- QPaintEngine *paintEngine() const;
-
-protected:
- int metric(PaintDeviceMetric metric) const;
-
-private:
- QVGLiteGraphicsSystem *graphicsSystem;
- bool isPaintingActive;
- mutable QVGPaintEngine *engine;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSURFACE_VGLITE_H
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
index 51de06f910..61e06d80c1 100644
--- a/src/plugins/platforms/platforms.pro
+++ b/src/plugins/platforms/platforms.pro
@@ -6,7 +6,7 @@ contains(QT_CONFIG, xcb) {
SUBDIRS += xcb
}
-mac:contains(QT_CONFIG, coreservices): SUBDIRS += cocoa
+mac:!ios: SUBDIRS += cocoa
win32: SUBDIRS += windows
diff --git a/src/plugins/platforms/qnx/main.cpp b/src/plugins/platforms/qnx/main.cpp
index b1e1687150..2dbff096c0 100644
--- a/src/plugins/platforms/qnx/main.cpp
+++ b/src/plugins/platforms/qnx/main.cpp
@@ -39,18 +39,11 @@
**
****************************************************************************/
-#include <QtGui/QPlatformIntegrationPlugin>
+#include "main.h"
#include "qqnxintegration.h"
QT_BEGIN_NAMESPACE
-class QQnxIntegrationPlugin : public QPlatformIntegrationPlugin
-{
-public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
-};
-
QStringList QQnxIntegrationPlugin::keys() const
{
QStringList list;
@@ -67,6 +60,4 @@ QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const
return 0;
}
-Q_EXPORT_PLUGIN2(qnx, QQnxIntegrationPlugin)
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/shaders/vert.glslv b/src/plugins/platforms/qnx/main.h
index d7d6e15772..cc2cfdd000 100644
--- a/src/plugins/platforms/openkode/shaders/vert.glslv
+++ b/src/plugins/platforms/qnx/main.h
@@ -1,6 +1,6 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 - 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,17 +39,17 @@
**
****************************************************************************/
-uniform vec2 window; // window size
+#include <QtGui/QPlatformIntegrationPlugin>
-// Per-vertex attributes]
-attribute vec2 pos_attr;
-attribute vec2 texcoord_attr;
+QT_BEGIN_NAMESPACE
-// Output vertex color
-varying vec2 texcoord_var;
-
-void main()
+class QQnxIntegrationPlugin : public QPlatformIntegrationPlugin
{
- gl_Position = vec4( (2.0 * pos_attr / window -1.0) * vec2(1.0, -1.0), 0.0, 1.0);
- texcoord_var = texcoord_attr;
-}
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPlatformIntegrationFactoryInterface" FILE "qnx.json")
+public:
+ QStringList keys() const;
+ QPlatformIntegration *create(const QString&, const QStringList&);
+};
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qnx.json b/src/plugins/platforms/qnx/qnx.json
new file mode 100644
index 0000000000..38df228ef4
--- /dev/null
+++ b/src/plugins/platforms/qnx/qnx.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "qnx" ]
+}
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index 82c3b201c9..7ca9ddf63a 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -2,15 +2,27 @@ TARGET = qnx
include(../../qpluginbase.pri)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
-QT += opengl opengl-private platformsupport platformsupport-private widgets-private
+QT += platformsupport platformsupport-private widgets-private
+
+contains(QT_CONFIG, opengles2) {
+ QT += opengl opengl-private
+}
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
#CONFIG += qqnx_imf
+# Uncomment this to build with support for PPS based platform integration
+#CONFIG += qqnx_pps
+
+CONFIG(blackberry) {
+ CONFIG += qqnx_pps
+}
+
# Uncomment these to enable debugging output for various aspects of the plugin
#DEFINES += QQNXBUFFER_DEBUG
+#DEFINES += QQNXBPSEVENTFILTER_DEBUG
#DEFINES += QQNXCLIPBOARD_DEBUG
-#DEFINES += QQNXEVENTTHREAD_DEBUG
+#DEFINES += QQNXSCREENEVENTTHREAD_DEBUG
#DEFINES += QQNXGLBACKINGSTORE_DEBUG
#DEFINES += QQNXGLCONTEXT_DEBUG
#DEFINES += QQNXINPUTCONTEXT_DEBUG
@@ -24,65 +36,94 @@ QT += opengl opengl-private platformsupport platformsupport-private widgets-priv
#DEFINES += QQNXSCREENEVENT_DEBUG
#DEFINES += QQNXVIRTUALKEYBOARD_DEBUG
#DEFINES += QQNXWINDOW_DEBUG
+#DEFINES += QQNXNAVIGATOR_DEBUG
SOURCES = main.cpp \
qqnxbuffer.cpp \
- qqnxeventthread.cpp \
- qqnxglcontext.cpp \
- qqnxglbackingstore.cpp \
+ qqnxscreeneventthread.cpp \
qqnxintegration.cpp \
- qqnxnavigatoreventhandler.cpp \
- qqnxnavigatoreventnotifier.cpp \
qqnxscreen.cpp \
qqnxwindow.cpp \
qqnxrasterbackingstore.cpp \
- qqnxvirtualkeyboard.cpp \
- qqnxclipboard.cpp \
qqnxrootwindow.cpp \
qqnxscreeneventhandler.cpp \
+ qqnxnativeinterface.cpp \
+ qqnxnavigatoreventhandler.cpp \
+ qqnxabstractnavigator.cpp \
qqnxabstractvirtualkeyboard.cpp \
- qqnxnativeinterface.cpp
+ qqnxservices.cpp
-HEADERS = qqnxbuffer.h \
- qqnxeventthread.h \
+HEADERS = main.h \
+ qqnxbuffer.h \
+ qqnxscreeneventthread.h \
qqnxkeytranslator.h \
qqnxintegration.h \
- qqnxnavigatoreventhandler.h \
- qqnxnavigatoreventnotifier.h \
- qqnxglcontext.h \
- qqnxglbackingstore.h \
qqnxscreen.h \
qqnxwindow.h \
qqnxrasterbackingstore.h \
- qqnxvirtualkeyboard.h \
- qqnxclipboard.h \
qqnxrootwindow.h \
qqnxscreeneventhandler.h \
+ qqnxnativeinterface.h \
+ qqnxnavigatoreventhandler.h \
+ qqnxabstractnavigator.h \
qqnxabstractvirtualkeyboard.h \
- qqnxnativeinterface.h
+ qqnxservices.h
-CONFIG(blackberry) {
- SOURCES += qqnxservices.cpp
- HEADERS += qqnxservices.h
-}
+LIBS += -lscreen
-CONFIG(qqnx_imf) {
- DEFINES += QQNX_IMF
- HEADERS += qqnxinputcontext_imf.h
- SOURCES += qqnxinputcontext_imf.cpp
-} else {
- HEADERS += qqnxinputcontext_noimf.h
- SOURCES += qqnxinputcontext_noimf.cpp
-}
+contains(QT_CONFIG, opengles2) {
+ SOURCES += qqnxglcontext.cpp \
+ qqnxglbackingstore.cpp
-QMAKE_CXXFLAGS += -I./private
+ HEADERS += qqnxglcontext.h \
+ qqnxglbackingstore.h
-LIBS += -lpps -lscreen -lEGL -lclipboard
+ LIBS += -lEGL
+}
CONFIG(blackberry) {
+ SOURCES += qqnxnavigatorbps.cpp \
+ qqnxeventdispatcher_blackberry.cpp \
+ qqnxbpseventfilter.cpp \
+ qqnxvirtualkeyboardbps.cpp
+
+ HEADERS += qqnxnavigatorbps.h \
+ qqnxeventdispatcher_blackberry.h \
+ qqnxbpseventfilter.h \
+ qqnxvirtualkeyboardbps.h
+
LIBS += -lbps
}
+CONFIG(qqnx_pps) {
+ DEFINES += QQNX_PPS
+
+ SOURCES += qqnxnavigatorpps.cpp \
+ qqnxnavigatoreventnotifier.cpp \
+ qqnxvirtualkeyboardpps.cpp \
+ qqnxclipboard.cpp
+
+ HEADERS += qqnxnavigatorpps.h \
+ qqnxnavigatoreventnotifier.h \
+ qqnxvirtualkeyboardpps.h \
+ qqnxclipboard.h
+
+ LIBS += -lpps -lclipboard
+
+ CONFIG(qqnx_imf) {
+ DEFINES += QQNX_IMF
+ HEADERS += qqnxinputcontext_imf.h
+ SOURCES += qqnxinputcontext_imf.cpp
+ } else {
+ HEADERS += qqnxinputcontext_noimf.h
+ SOURCES += qqnxinputcontext_noimf.cpp
+ }
+}
+
+OTHER_FILES += qnx.json
+
+QMAKE_CXXFLAGS += -I./private
+
include (../../../platformsupport/eglconvenience/eglconvenience.pri)
include (../../../platformsupport/fontdatabases/fontdatabases.pri)
diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp
new file mode 100644
index 0000000000..f57f49df9c
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp
@@ -0,0 +1,74 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxabstractnavigator.h"
+
+#include <QDebug>
+#include <QUrl>
+
+QT_BEGIN_NAMESPACE
+
+QQnxAbstractNavigator::QQnxAbstractNavigator(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQnxAbstractNavigator::~QQnxAbstractNavigator()
+{
+}
+
+bool QQnxAbstractNavigator::invokeUrl(const QUrl &url)
+{
+ if (!url.isValid() || url.isRelative())
+ return false;
+
+ // not using QUrl::toEncoded() because for e.g. camera:// it creates camera:
+ // which is not recognized by the navigator anymore
+ const bool result = requestInvokeUrl(url.toString().toUtf8());
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "url=" << url << "result=" << result;
+#endif
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.h b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
new file mode 100644
index 0000000000..969366c925
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQNXABSTRACTNAVIGATOR_H
+#define QQNXABSTRACTNAVIGATOR_H
+
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+
+class QUrl;
+
+class QQnxAbstractNavigator : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QQnxAbstractNavigator(QObject *parent = 0);
+ ~QQnxAbstractNavigator();
+
+ bool invokeUrl(const QUrl &url);
+
+protected:
+ virtual bool requestInvokeUrl(const QByteArray &encodedUrl) = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXABSTRACTNAVIGATOR_H
diff --git a/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp
new file mode 100644
index 0000000000..647e1a692f
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp
@@ -0,0 +1,204 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxbpseventfilter.h"
+#include "qqnxnavigatoreventhandler.h"
+#include "qqnxscreen.h"
+#include "qqnxscreeneventhandler.h"
+#include "qqnxvirtualkeyboardbps.h"
+
+#include <QAbstractEventDispatcher>
+#include <QDebug>
+
+#include <bps/event.h>
+#include <bps/navigator.h>
+#include <bps/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+static QQnxBpsEventFilter *s_instance = 0;
+
+QQnxBpsEventFilter::QQnxBpsEventFilter(QQnxNavigatorEventHandler *navigatorEventHandler,
+ QQnxScreenEventHandler *screenEventHandler,
+ QQnxVirtualKeyboardBps *virtualKeyboard, QObject *parent)
+ : QObject(parent)
+ , m_navigatorEventHandler(navigatorEventHandler)
+ , m_screenEventHandler(screenEventHandler)
+ , m_virtualKeyboard(virtualKeyboard)
+{
+ Q_ASSERT(s_instance == 0);
+
+ s_instance = this;
+}
+
+QQnxBpsEventFilter::~QQnxBpsEventFilter()
+{
+ Q_ASSERT(s_instance == this);
+
+ s_instance = 0;
+}
+
+void QQnxBpsEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *dispatcher)
+{
+#if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << Q_FUNC_INFO << "dispatcher=" << dispatcher;
+#endif
+
+ if (navigator_request_events(0) != BPS_SUCCESS)
+ qWarning("QQNX: failed to register for navigator events");
+
+ QAbstractEventDispatcher::EventFilter previousEventFilter = dispatcher->setEventFilter(dispatcherEventFilter);
+
+ // the QPA plugin creates the event dispatcher so we are the first event
+ // filter assert on that just in case somebody adds another event filter
+ // in the QQnxIntegration constructor instead of adding a new section in here
+ Q_ASSERT(previousEventFilter == 0);
+ Q_UNUSED(previousEventFilter);
+}
+
+void QQnxBpsEventFilter::registerForScreenEvents(QQnxScreen *screen)
+{
+ if (screen_request_events(screen->nativeContext()) != BPS_SUCCESS)
+ qWarning("QQNX: failed to register for screen events on screen %p", screen->nativeContext());
+}
+
+void QQnxBpsEventFilter::unregisterForScreenEvents(QQnxScreen *screen)
+{
+ if (screen_stop_events(screen->nativeContext()) != BPS_SUCCESS)
+ qWarning("QQNX: failed to unregister for screen events on screen %p", screen->nativeContext());
+}
+
+bool QQnxBpsEventFilter::dispatcherEventFilter(void *message)
+{
+#if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (s_instance == 0)
+ return false;
+
+ bps_event_t *event = static_cast<bps_event_t *>(message);
+ return s_instance->bpsEventFilter(event);
+}
+
+bool QQnxBpsEventFilter::bpsEventFilter(bps_event_t *event)
+{
+ const int eventDomain = bps_event_get_domain(event);
+
+#if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << Q_FUNC_INFO << "event=" << event << "domain=" << eventDomain;
+#endif
+
+ if (eventDomain == screen_get_domain()) {
+ screen_event_t screenEvent = screen_event_get_event(event);
+ return m_screenEventHandler->handleEvent(screenEvent);
+ }
+
+ if (eventDomain == navigator_get_domain())
+ return handleNavigatorEvent(event);
+
+ if (m_virtualKeyboard->handleEvent(event))
+ return true;
+
+ return false;
+}
+
+bool QQnxBpsEventFilter::handleNavigatorEvent(bps_event_t *event)
+{
+ switch (bps_event_get_code(event)) {
+ case NAVIGATOR_ORIENTATION_CHECK: {
+ const int angle = navigator_event_get_orientation_angle(event);
+
+ #if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << "QQNX: Navigator ORIENTATION CHECK event. angle=" << angle;
+ #endif
+
+ const bool result = m_navigatorEventHandler->handleOrientationCheck(angle);
+
+ #if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << "QQNX: Navigator ORIENTATION CHECK event. result=" << result;
+ #endif
+
+ // reply to navigator whether orientation is acceptable
+ navigator_orientation_check_response(event, result);
+ break;
+ }
+
+ case NAVIGATOR_ORIENTATION: {
+ const int angle = navigator_event_get_orientation_angle(event);
+
+ #if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << "QQNX: Navigator ORIENTATION event. angle=" << angle;
+ #endif
+
+ m_navigatorEventHandler->handleOrientationChange(angle);
+
+ navigator_done_orientation(event);
+ break;
+ }
+
+ case NAVIGATOR_SWIPE_DOWN:
+ #if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << "QQNX: Navigator SWIPE DOWN event";
+ #endif
+
+ m_navigatorEventHandler->handleSwipeDown();
+ break;
+
+ case NAVIGATOR_EXIT:
+ #if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << "QQNX: Navigator EXIT event";
+ #endif
+
+ m_navigatorEventHandler->handleExit();
+ break;
+
+ default:
+ #if defined(QQNXBPSEVENTFILTER_DEBUG)
+ qDebug() << "QQNX: Unhandled navigator event. code=" << bps_event_get_code(event);
+ #endif
+ return false;
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.h b/src/plugins/platforms/qnx/qqnxbpseventfilter.h
index 92fe6aea2d..215027e8e6 100644
--- a/src/plugins/platforms/qvfb/qvfbwindowsurface.h
+++ b/src/plugins/platforms/qnx/qqnxbpseventfilter.h
@@ -1,6 +1,6 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,42 +39,47 @@
**
****************************************************************************/
-#ifndef QWINDOWSURFACE_QVFB_H
-#define QWINDOWSURFACE_QVFB_H
+#ifndef QQNXBPSEVENTFILTER_H
+#define QQNXBPSEVENTFILTER_H
-#include <QtGui/private/qwindowsurface_p.h>
-#include <QPlatformWindow>
+#include <QObject>
+
+struct bps_event_t;
QT_BEGIN_NAMESPACE
-class QVFbIntegration;
-class QVFbScreen;
+class QAbstractEventDispatcher;
+class QQnxNavigatorEventHandler;
+class QQnxScreen;
+class QQnxScreenEventHandler;
+class QQnxVirtualKeyboardBps;
-class QVFbWindowSurface : public QWindowSurface
+class QQnxBpsEventFilter : public QObject
{
+ Q_OBJECT
public:
- QVFbWindowSurface(QVFbScreen *screen, QWidget *window);
- ~QVFbWindowSurface();
+ QQnxBpsEventFilter(QQnxNavigatorEventHandler *navigatorEventHandler,
+ QQnxScreenEventHandler *screenEventHandler,
+ QQnxVirtualKeyboardBps *virtualKeyboard, QObject *parent = 0);
+ ~QQnxBpsEventFilter();
+
+ void installOnEventDispatcher(QAbstractEventDispatcher *dispatcher);
- QPaintDevice *paintDevice();
- void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
- void resize(const QSize &size);
+ void registerForScreenEvents(QQnxScreen *screen);
+ void unregisterForScreenEvents(QQnxScreen *screen);
private:
- QVFbScreen *mScreen;
-};
+ static bool dispatcherEventFilter(void *message);
+ bool bpsEventFilter(bps_event_t *event);
-class QVFbWindow : public QPlatformWindow
-{
-public:
- QVFbWindow(QVFbScreen *screen, QWidget *window);
- void setGeometry(const QRect &rect);
+ bool handleNavigatorEvent(bps_event_t *event);
private:
- QVFbScreen *mScreen;
+ QQnxNavigatorEventHandler *m_navigatorEventHandler;
+ QQnxScreenEventHandler *m_screenEventHandler;
+ QQnxVirtualKeyboardBps *m_virtualKeyboard;
};
-
QT_END_NAMESPACE
-#endif
+#endif // QQNXBPSEVENTFILTER_H
diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp
index 8931a15139..38dac0c5ab 100644
--- a/src/plugins/platforms/qnx/qqnxclipboard.cpp
+++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp
@@ -153,7 +153,7 @@ protected:
return QMimeData::retrieveData(mimetype, preferredType);
const QByteArray data = readClipboardBuff(mimetype.toUtf8().constData());
- return qVariantFromValue(data);
+ return QVariant::fromValue(data);
}
private Q_SLOTS:
diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp
index 3013b69daf..c7d9eb5ed9 100644
--- a/src/plugins/platforms/qvfb/main.cpp
+++ b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.cpp
@@ -1,6 +1,6 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,35 +39,42 @@
**
****************************************************************************/
-#include <QPlatformIntegrationPlugin>
-#include "qvfbintegration.h"
-#include <qstringlist.h>
+#include "qqnxeventdispatcher_blackberry.h"
+
+#include <QWindowSystemInterface>
+#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
-class QVFbIntegrationPlugin : public QPlatformIntegrationPlugin
+
+QQnxEventDispatcherBlackberry::QQnxEventDispatcherBlackberry(QObject *parent)
+ : QEventDispatcherBlackberry(parent)
{
-public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
-};
+}
-QStringList QVFbIntegrationPlugin::keys() const
+QQnxEventDispatcherBlackberry::~QQnxEventDispatcherBlackberry()
{
- QStringList list;
- list << "QVFb";
- return list;
}
-QPlatformIntegration* QVFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+bool QQnxEventDispatcherBlackberry::processEvents(QEventLoop::ProcessEventsFlags flags)
{
- Q_UNUSED(paramList);
- if (system.toLower() == "qvfb")
- return new QVFbIntegration(paramList);
+ bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(this, flags);
- return 0;
+ if (QEventDispatcherBlackberry::processEvents(flags))
+ return true;
+
+ return didSendEvents;
}
-Q_EXPORT_PLUGIN2(qvfb, QVFbIntegrationPlugin)
+bool QQnxEventDispatcherBlackberry::hasPendingEvents()
+{
+ return QEventDispatcherBlackberry::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued();
+}
+
+void QQnxEventDispatcherBlackberry::flush()
+{
+ if (qApp)
+ qApp->sendPostedEvents();
+}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.h b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.h
new file mode 100644
index 0000000000..be34b5f7d0
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxeventdispatcher_blackberry.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQNXEVENTDISPATCHER_BLACKBERRY_H
+#define QQNXEVENTDISPATCHER_BLACKBERRY_H
+
+#include <qglobal.h>
+#include <private/qeventdispatcher_blackberry_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQnxEventDispatcherBlackberry : public QEventDispatcherBlackberry
+{
+ Q_OBJECT
+
+public:
+ explicit QQnxEventDispatcherBlackberry(QObject *parent = 0);
+ ~QQnxEventDispatcherBlackberry();
+
+ bool processEvents(QEventLoop::ProcessEventsFlags flags);
+ bool hasPendingEvents();
+
+ void flush();
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXEVENTDISPATCHER_BLACKBERRY_H
diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp
index 882b71753e..934e6afedf 100644
--- a/src/plugins/platforms/qnx/qqnxglcontext.cpp
+++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp
@@ -141,7 +141,6 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext)
format.setRedBufferSize(redSize);
format.setGreenBufferSize(greenSize);
format.setBlueBufferSize(blueSize);
- format.setSamples(2);
// Select EGL config based on requested window format
m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format);
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index b4112999b6..2fa3b45047 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -40,33 +40,54 @@
****************************************************************************/
#include "qqnxintegration.h"
-#include "qqnxeventthread.h"
-#include "qqnxglbackingstore.h"
-#include "qqnxglcontext.h"
+#include "qqnxscreeneventthread.h"
#include "qqnxnativeinterface.h"
-#include "qqnxnavigatoreventhandler.h"
-#include "qqnxnavigatoreventnotifier.h"
#include "qqnxrasterbackingstore.h"
#include "qqnxscreen.h"
#include "qqnxscreeneventhandler.h"
#include "qqnxwindow.h"
-#include "qqnxvirtualkeyboard.h"
-#include "qqnxclipboard.h"
-#include "qqnxglcontext.h"
+#include "qqnxnavigatoreventhandler.h"
+#include "qqnxabstractnavigator.h"
+#include "qqnxabstractvirtualkeyboard.h"
#include "qqnxservices.h"
-#if defined(QQnx_IMF)
-#include "qqnxinputcontext_imf.h"
-#else
-#include "qqnxinputcontext_noimf.h"
+#if defined(Q_OS_BLACKBERRY)
+#include "qqnxbpseventfilter.h"
+#include "qqnxnavigatorbps.h"
+#include "qqnxvirtualkeyboardbps.h"
+#elif defined(QQNX_PPS)
+#include "qqnxnavigatorpps.h"
+#include "qqnxvirtualkeyboardpps.h"
+#endif
+
+#if defined(QQNX_PPS)
+# include "qqnxnavigatoreventnotifier.h"
+# include "qqnxclipboard.h"
+
+# if defined(QQNX_IMF)
+# include "qqnxinputcontext_imf.h"
+# else
+# include "qqnxinputcontext_noimf.h"
+# endif
#endif
#include "private/qgenericunixfontdatabase_p.h"
+
+#if defined(Q_OS_BLACKBERRY)
+#include "qqnxeventdispatcher_blackberry.h"
+#else
#include "private/qgenericunixeventdispatcher_p.h"
+#endif
#include <QtGui/QPlatformWindow>
#include <QtGui/QWindowSystemInterface>
+
+#if !defined(QT_NO_OPENGL)
+#include "qqnxglbackingstore.h"
+#include "qqnxglcontext.h"
+
#include <QtGui/QOpenGLContext>
+#endif
#include <QtCore/QDebug>
#include <QtCore/QHash>
@@ -80,18 +101,27 @@ QMutex QQnxIntegration::ms_windowMapperMutex;
QQnxIntegration::QQnxIntegration()
: QPlatformIntegration()
- , m_eventThread(0)
+ , m_screenEventThread(0)
, m_navigatorEventHandler(new QQnxNavigatorEventHandler())
- , m_navigatorEventNotifier(0)
, m_virtualKeyboard(0)
+#if defined(QQNX_PPS)
+ , m_navigatorEventNotifier(0)
, m_inputContext(0)
+#endif
+ , m_services(0)
, m_fontDatabase(new QGenericUnixFontDatabase())
+#if !defined(QT_NO_OPENGL)
, m_paintUsingOpenGL(false)
+#endif
+#if defined(Q_OS_BLACKBERRY)
+ , m_eventDispatcher(new QQnxEventDispatcherBlackberry())
+ , m_bpsEventFilter(0)
+#else
, m_eventDispatcher(createUnixEventDispatcher())
+#endif
, m_nativeInterface(new QQnxNativeInterface())
- , m_services(0)
, m_screenEventHandler(new QQnxScreenEventHandler())
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
, m_clipboard(0)
#endif
{
@@ -105,41 +135,73 @@ QQnxIntegration::QQnxIntegration()
qFatal("QQnx: failed to connect to composition manager, errno=%d", errno);
}
+ // Not on BlackBerry, it has specialised event dispatcher which also handles navigator events
+#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
// Create/start navigator event notifier
m_navigatorEventNotifier = new QQnxNavigatorEventNotifier(m_navigatorEventHandler);
// delay invocation of start() to the time the event loop is up and running
// needed to have the QThread internals of the main thread properly initialized
QMetaObject::invokeMethod(m_navigatorEventNotifier, "start", Qt::QueuedConnection);
+#endif
// Create displays for all possible screens (which may not be attached)
createDisplays();
+#if !defined(QT_NO_OPENGL)
// Initialize global OpenGL resources
QQnxGLContext::initialize();
+#endif
// Create/start event thread
- m_eventThread = new QQnxEventThread(m_screenContext, m_screenEventHandler);
- m_eventThread->start();
+ // Not on BlackBerry, it has specialised event dispatcher which also handles screen events
+#if !defined(Q_OS_BLACKBERRY)
+ m_screenEventThread = new QQnxScreenEventThread(m_screenContext, m_screenEventHandler);
+ m_screenEventThread->start();
+#endif
+ // Not on BlackBerry, it has specialised event dispatcher which also handles virtual keyboard events
+#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
// Create/start the keyboard class.
- m_virtualKeyboard = new QQnxVirtualKeyboard();
+ m_virtualKeyboard = new QQnxVirtualKeyboardPps();
// delay invocation of start() to the time the event loop is up and running
// needed to have the QThread internals of the main thread properly initialized
QMetaObject::invokeMethod(m_virtualKeyboard, "start", Qt::QueuedConnection);
+#endif
- // TODO check if we need to do this for all screens or only the primary one
- QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),
- primaryDisplay(), SLOT(keyboardHeightChanged(int)));
-
- // Set up the input context
- m_inputContext = new QQnxInputContext(*m_virtualKeyboard);
+#if defined(Q_OS_BLACKBERRY)
+ m_navigator = new QQnxNavigatorBps();
+#elif defined(QQNX_PPS)
+ m_navigator = new QQnxNavigatorPps();
+#endif
// Create services handling class
-#ifdef Q_OS_BLACKBERRY
- m_services = new QQnxServices;
+ if (m_navigator)
+ m_services = new QQnxServices(m_navigator);
+
+#if defined(Q_OS_BLACKBERRY)
+ QQnxVirtualKeyboardBps* virtualKeyboardBps = new QQnxVirtualKeyboardBps;
+ m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler, m_screenEventHandler, virtualKeyboardBps);
+ Q_FOREACH (QQnxScreen *screen, m_screens)
+ m_bpsEventFilter->registerForScreenEvents(screen);
+
+ m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher);
+
+ m_virtualKeyboard = virtualKeyboardBps;
#endif
+
+ if (m_virtualKeyboard) {
+ // TODO check if we need to do this for all screens or only the primary one
+ QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),
+ primaryDisplay(), SLOT(keyboardHeightChanged(int)));
+
+#if defined(QQNX_PPS)
+ // Set up the input context
+ m_inputContext = new QQnxInputContext(*m_virtualKeyboard);
+#endif
+ }
+
}
QQnxIntegration::~QQnxIntegration()
@@ -151,23 +213,35 @@ QQnxIntegration::~QQnxIntegration()
delete m_nativeInterface;
+#if defined(QQNX_PPS)
// Destroy input context
delete m_inputContext;
+#endif
// Destroy the keyboard class.
delete m_virtualKeyboard;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
// Delete the clipboard
delete m_clipboard;
#endif
// Stop/destroy navigator event notifier
+#if defined(QQNX_PPS)
delete m_navigatorEventNotifier;
+#endif
delete m_navigatorEventHandler;
- // Stop/destroy event thread
- delete m_eventThread;
+#if !defined(Q_OS_BLACKBERRY)
+ // Stop/destroy screen event thread
+ delete m_screenEventThread;
+#else
+ Q_FOREACH (QQnxScreen *screen, m_screens)
+ m_bpsEventFilter->unregisterForScreenEvents(screen);
+
+ delete m_bpsEventFilter;
+#endif
+
delete m_screenEventHandler;
// Destroy all displays
@@ -176,13 +250,16 @@ QQnxIntegration::~QQnxIntegration()
// Close connection to QNX composition manager
screen_destroy_context(m_screenContext);
+#if !defined(QT_NO_OPENGL)
// Cleanup global OpenGL resources
QQnxGLContext::shutdown();
+#endif
// Destroy services class
-#ifdef Q_OS_BLACKBERRY
delete m_services;
-#endif
+
+ // Destroy navigator interface
+ delete m_navigator;
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << "QQnx: platform plugin shutdown end";
@@ -217,12 +294,15 @@ QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *wind
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO;
#endif
+#if !defined(QT_NO_OPENGL)
if (paintUsingOpenGL())
return new QQnxGLBackingStore(window);
else
+#endif
return new QQnxRasterBackingStore(window);
}
+#if !defined(QT_NO_OPENGL)
QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
#if defined(QQNXINTEGRATION_DEBUG)
@@ -230,7 +310,9 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont
#endif
return new QQnxGLContext(context);
}
+#endif
+#if defined(QQNX_PPS)
QPlatformInputContext *QQnxIntegration::inputContext() const
{
#if defined(QQNXINTEGRATION_DEBUG)
@@ -238,6 +320,7 @@ QPlatformInputContext *QQnxIntegration::inputContext() const
#endif
return m_inputContext;
}
+#endif
void QQnxIntegration::moveToScreen(QWindow *window, int screen)
{
@@ -268,15 +351,18 @@ QPlatformNativeInterface *QQnxIntegration::nativeInterface() const
return m_nativeInterface;
}
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
QPlatformClipboard *QQnxIntegration::clipboard() const
{
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO;
#endif
+
+#if defined(QQNX_PPS)
if (!m_clipboard) {
m_clipboard = new QQnxClipboard;
}
+#endif
return m_clipboard;
}
#endif
diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h
index 801bd7b6e5..a3c476f16e 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.h
+++ b/src/plugins/platforms/qnx/qqnxintegration.h
@@ -50,18 +50,23 @@
QT_BEGIN_NAMESPACE
-class QQnxEventThread;
-class QQnxInputContext;
+class QQnxBpsEventFilter;
+class QQnxScreenEventThread;
class QQnxNativeInterface;
-class QQnxNavigatorEventHandler;
-class QQnxNavigatorEventNotifier;
-class QQnxAbstractVirtualKeyboard;
class QQnxWindow;
-class QQnxServices;
class QQnxScreen;
class QQnxScreenEventHandler;
+class QQnxNavigatorEventHandler;
+class QQnxAbstractNavigator;
+class QQnxAbstractVirtualKeyboard;
+class QQnxServices;
+
+#if defined(QQNX_PPS)
+class QQnxInputContext;
+class QQnxNavigatorEventNotifier;
+#endif
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
class QQnxClipboard;
#endif
@@ -78,9 +83,14 @@ public:
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
+
+#if !defined(QT_NO_OPENGL)
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+#endif
+#if defined(QQNX_PPS)
QPlatformInputContext *inputContext() const;
+#endif
void moveToScreen(QWindow *window, int screen);
@@ -90,13 +100,15 @@ public:
QPlatformNativeInterface *nativeInterface() const;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
QPlatformClipboard *clipboard() const;
#endif
QVariant styleHint(StyleHint hint) const;
+#if !defined(QT_NO_OPENGL)
bool paintUsingOpenGL() const { return m_paintUsingOpenGL; }
+#endif
QPlatformServices *services() const;
@@ -111,22 +123,31 @@ private:
static void removeWindow(screen_window_t qnxWindow);
screen_context_t m_screenContext;
- QQnxEventThread *m_eventThread;
+ QQnxScreenEventThread *m_screenEventThread;
QQnxNavigatorEventHandler *m_navigatorEventHandler;
- QQnxNavigatorEventNotifier *m_navigatorEventNotifier;
QQnxAbstractVirtualKeyboard *m_virtualKeyboard;
+#if defined(QQNX_PPS)
+ QQnxNavigatorEventNotifier *m_navigatorEventNotifier;
QQnxInputContext *m_inputContext;
+#endif
+ QQnxServices *m_services;
QPlatformFontDatabase *m_fontDatabase;
+#if !defined(QT_NO_OPENGL)
bool m_paintUsingOpenGL;
+#endif
QAbstractEventDispatcher *m_eventDispatcher;
+#if defined(Q_OS_BLACKBERRY)
+ QQnxBpsEventFilter *m_bpsEventFilter;
+#endif
QQnxNativeInterface *m_nativeInterface;
- QQnxServices *m_services;
QList<QQnxScreen*> m_screens;
QQnxScreenEventHandler *m_screenEventHandler;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
mutable QQnxClipboard* m_clipboard;
#endif
+ QQnxAbstractNavigator *m_navigator;
+
static QQnxWindowMapper ms_windowMapper;
static QMutex ms_windowMapperMutex;
diff --git a/src/plugins/platforms/openvglite/main.cpp b/src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
index 83ffc06452..78ef3e890c 100644
--- a/src/plugins/platforms/openvglite/main.cpp
+++ b/src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
@@ -1,6 +1,6 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,33 +39,36 @@
**
****************************************************************************/
-#include <private/qgraphicssystemplugin_p.h>
-#include "qgraphicssystem_vglite.h"
+#include "qqnxnavigatorbps.h"
+
+#include <QDebug>
+
+#include <bps/navigator.h>
QT_BEGIN_NAMESPACE
-class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin
+QQnxNavigatorBps::QQnxNavigatorBps(QObject *parent)
+ : QQnxAbstractNavigator(parent)
{
-public:
- QStringList keys() const;
- QGraphicsSystem *create(const QString&);
-};
+ bps_initialize();
+}
-QStringList QVGGraphicsSystemPlugin::keys() const
+QQnxNavigatorBps::~QQnxNavigatorBps()
{
- QStringList list;
- list << "OpenVG";
- return list;
+ bps_shutdown();
}
-QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system)
+bool QQnxNavigatorBps::requestInvokeUrl(const QByteArray &encodedUrl)
{
- if (system.toLower() == "openvg")
- return new QVGLiteGraphicsSystem;
+ char *error = 0;
- return 0;
-}
+ int ret = navigator_invoke(encodedUrl, &error);
+ if (error) {
+ qWarning() << Q_FUNC_INFO << "error=" << error;
+ bps_free(error);
+ }
-Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin)
+ return (ret == BPS_SUCCESS);
+}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/shaders/frag.glslf b/src/plugins/platforms/qnx/qqnxnavigatorbps.h
index f657f4f926..db5c291a96 100644
--- a/src/plugins/platforms/openkode/shaders/frag.glslf
+++ b/src/plugins/platforms/qnx/qqnxnavigatorbps.h
@@ -1,6 +1,6 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,11 +39,24 @@
**
****************************************************************************/
-uniform sampler2D tex_samp;
+#ifndef QQNXNAVIGATORBPS_H
+#define QQNXNAVIGATORBPS_H
-varying vec2 texcoord_var;
+#include "qqnxabstractnavigator.h"
-void main(void)
+QT_BEGIN_NAMESPACE
+
+class QQnxNavigatorBps : public QQnxAbstractNavigator
{
- gl_FragColor = texture2D(tex_samp, texcoord_var);
-}
+ Q_OBJECT
+public:
+ explicit QQnxNavigatorBps(QObject *parent = 0);
+ ~QQnxNavigatorBps();
+
+protected:
+ bool requestInvokeUrl(const QByteArray &encodedUrl);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXNAVIGATORBPS_H
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp
new file mode 100644
index 0000000000..cce817d1ed
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp
@@ -0,0 +1,192 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxnavigatorpps.h"
+
+#include <QDebug>
+#include <private/qcore_unix_p.h>
+
+static const char *navigatorControlPath = "/pps/services/navigator/control";
+static const int ppsBufferSize = 4096;
+
+QT_BEGIN_NAMESPACE
+
+QQnxNavigatorPps::QQnxNavigatorPps(QObject *parent)
+ : QQnxAbstractNavigator(parent)
+ , m_fd(-1)
+{
+}
+
+QQnxNavigatorPps::~QQnxNavigatorPps()
+{
+ // close connection to navigator
+ if (m_fd != -1)
+ qt_safe_close(m_fd);
+}
+
+bool QQnxNavigatorPps::openPpsConnection()
+{
+ if (m_fd != -1)
+ return true;
+
+ // open connection to navigator
+ errno = 0;
+ m_fd = qt_safe_open(navigatorControlPath, O_RDWR);
+ if (m_fd == -1) {
+ qWarning("QQNX: failed to open navigator pps, errno=%d", errno);
+ return false;
+ }
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "successfully connected to Navigator. fd=" << m_fd;
+#endif
+
+ return true;
+}
+
+bool QQnxNavigatorPps::requestInvokeUrl(const QByteArray &encodedUrl)
+{
+ if (!openPpsConnection())
+ return false;
+
+ return sendPpsMessage("invoke", encodedUrl);
+}
+
+bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArray &data)
+{
+ QByteArray ppsMessage = "msg::" + message;
+
+ if (!data.isEmpty())
+ ppsMessage += "\ndat::" + data;
+
+ ppsMessage += "\n";
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "sending PPS message:\n" << ppsMessage;
+#endif
+
+ // send pps message to navigator
+ errno = 0;
+ int bytes = qt_safe_write(m_fd, ppsMessage.constData(), ppsMessage.size());
+ if (bytes == -1)
+ qFatal("QQNX: failed to write navigator pps, errno=%d", errno);
+
+ // allocate buffer for pps data
+ char buffer[ppsBufferSize];
+
+ // attempt to read pps data
+ do {
+ errno = 0;
+ bytes = qt_safe_read(m_fd, buffer, ppsBufferSize - 1);
+ if (bytes == -1)
+ qFatal("QQNX: failed to read navigator pps, errno=%d", errno);
+ } while (bytes == 0);
+
+ // ensure data is null terminated
+ buffer[bytes] = '\0';
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "received PPS message:\n" << buffer;
+#endif
+
+ // process received message
+ QByteArray ppsData(buffer);
+ QHash<QByteArray, QByteArray> responseFields;
+ parsePPS(ppsData, responseFields);
+
+ if (responseFields.contains("res") && responseFields.value("res") == message) {
+ if (responseFields.contains("err")) {
+ qCritical() << "navigator responded with error: " << responseFields.value("err");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash<QByteArray, QByteArray> &messageFields)
+{
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << "PPS: data=" << ppsData;
+#endif
+
+ // tokenize pps data into lines
+ QList<QByteArray> lines = ppsData.split('\n');
+
+ // validate pps object
+ if (lines.size() == 0 || lines.at(0) != "@control") {
+ qFatal("QQNX: unrecognized pps object, data=%s", ppsData.constData());
+ }
+
+ // parse pps object attributes and extract values
+ for (int i = 1; i < lines.size(); i++) {
+
+ // tokenize current attribute
+ const QByteArray &attr = lines.at(i);
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << "PPS: attr=" << attr;
+#endif
+
+ int firstColon = attr.indexOf(':');
+ if (firstColon == -1) {
+ // abort - malformed attribute
+ continue;
+ }
+
+ int secondColon = attr.indexOf(':', firstColon + 1);
+ if (secondColon == -1) {
+ // abort - malformed attribute
+ continue;
+ }
+
+ QByteArray key = attr.left(firstColon);
+ QByteArray value = attr.mid(secondColon + 1);
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << "PPS: key=" << key;
+ qDebug() << "PPS: val=" << value;
+#endif
+ messageFields[key] = value;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/main.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
index 0507d5bfb2..02ad0cc18d 100644
--- a/src/plugins/platforms/openkode/main.cpp
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
@@ -1,6 +1,6 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,34 +39,35 @@
**
****************************************************************************/
-#include <QtGui/QPlatformIntegrationPlugin>
-#include "qopenkodeintegration.h"
+#ifndef QQNXNAVIGATORPPS_H
+#define QQNXNAVIGATORPPS_H
+
+#include "qqnxabstractnavigator.h"
QT_BEGIN_NAMESPACE
-class QOpenKODEPlugin : public QPlatformIntegrationPlugin
+template <typename K, typename V> class QHash;
+
+class QQnxNavigatorPps : public QQnxAbstractNavigator
{
+ Q_OBJECT
public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
-};
+ explicit QQnxNavigatorPps(QObject *parent = 0);
+ ~QQnxNavigatorPps();
-QStringList QOpenKODEPlugin::keys() const
-{
- QStringList list;
- list << "OpenKODE";
- return list;
-}
+protected:
+ bool requestInvokeUrl(const QByteArray &encodedUrl);
-QPlatformIntegration * QOpenKODEPlugin::create(const QString& system, const QStringList& paramList)
-{
- Q_UNUSED(paramList);
- if (system.toLower() == "openkode")
- return new QOpenKODEIntegration;
+private:
+ bool openPpsConnection();
- return 0;
-}
+ bool sendPpsMessage(const QByteArray &message, const QByteArray &data);
+ void parsePPS(const QByteArray &ppsData, QHash<QByteArray, QByteArray> &messageFields);
-Q_EXPORT_PLUGIN2(openkode, QOpenKODEPlugin)
+private:
+ int m_fd;
+};
QT_END_NAMESPACE
+
+#endif // QQNXNAVIGATORPPS_H
diff --git a/src/plugins/platforms/qnx/qqnxeventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
index 768d508add..a3e50dc8da 100644
--- a/src/plugins/platforms/qnx/qqnxeventthread.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qqnxeventthread.h"
+#include "qqnxscreeneventthread.h"
#include "qqnxscreeneventhandler.h"
#include <QtCore/QDebug>
@@ -49,8 +49,7 @@
#include <cctype>
-QQnxEventThread::QQnxEventThread(screen_context_t context,
- QQnxScreenEventHandler *screenEventHandler)
+QQnxScreenEventThread::QQnxScreenEventThread(screen_context_t context, QQnxScreenEventHandler *screenEventHandler)
: QThread(),
m_screenContext(context),
m_screenEventHandler(screenEventHandler),
@@ -58,18 +57,18 @@ QQnxEventThread::QQnxEventThread(screen_context_t context,
{
}
-QQnxEventThread::~QQnxEventThread()
+QQnxScreenEventThread::~QQnxScreenEventThread()
{
// block until thread terminates
shutdown();
}
-void QQnxEventThread::injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
+void QQnxScreenEventThread::injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
{
QQnxScreenEventHandler::injectKeyboardEvent(flags, sym, mod, scan, cap);
}
-void QQnxEventThread::run()
+void QQnxScreenEventThread::run()
{
screen_event_t event;
@@ -77,10 +76,10 @@ void QQnxEventThread::run()
errno = 0;
int result = screen_create_event(&event);
if (result)
- qFatal("QQNX: failed to create event, errno=%d", errno);
+ qFatal("QQNX: failed to create screen event, errno=%d", errno);
-#if defined(QQNXEVENTTHREAD_DEBUG)
- qDebug() << "QQNX: event loop started";
+#if defined(QQNXSCREENEVENTTHREAD_DEBUG)
+ qDebug() << "QQNX: screen event thread started";
#endif
// loop indefinitely
@@ -90,7 +89,7 @@ void QQnxEventThread::run()
errno = 0;
result = screen_get_event(m_screenContext, event, -1);
if (result)
- qFatal("QQNX: failed to get event, errno=%d", errno);
+ qFatal("QQNX: failed to get screen event, errno=%d", errno);
// process received event
// get the event type
@@ -98,12 +97,12 @@ void QQnxEventThread::run()
int qnxType;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType);
if (result)
- qFatal("QQNX: failed to query event type, errno=%d", errno);
+ qFatal("QQNX: failed to query screen event type, errno=%d", errno);
if (qnxType == SCREEN_EVENT_USER) {
// treat all user events as shutdown requests
- #if defined(QQNXEVENTTHREAD_DEBUG)
- qDebug() << "QQNX: QNX user event";
+ #if defined(QQNXSCREENEVENTTHREAD_DEBUG)
+ qDebug() << "QQNX: QNX user screen event";
#endif
m_quit = true;
} else {
@@ -111,15 +110,15 @@ void QQnxEventThread::run()
}
}
-#if defined(QQNXEVENTTHREAD_DEBUG)
- qDebug() << "QQNX: event loop stopped";
+#if defined(QQNXSCREENEVENTTHREAD_DEBUG)
+ qDebug() << "QQNX: screen event thread stopped";
#endif
// cleanup
screen_destroy_event(event);
}
-void QQnxEventThread::shutdown()
+void QQnxScreenEventThread::shutdown()
{
screen_event_t event;
@@ -127,14 +126,14 @@ void QQnxEventThread::shutdown()
errno = 0;
int result = screen_create_event(&event);
if (result)
- qFatal("QQNX: failed to create event, errno=%d", errno);
+ qFatal("QQNX: failed to create screen event, errno=%d", errno);
// set the event type as user
errno = 0;
int type = SCREEN_EVENT_USER;
result = screen_set_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type);
if (result)
- qFatal("QQNX: failed to set event type, errno=%d", errno);
+ qFatal("QQNX: failed to set screen event type, errno=%d", errno);
// NOTE: ignore SCREEN_PROPERTY_USER_DATA; treat all user events as shutdown events
@@ -142,19 +141,19 @@ void QQnxEventThread::shutdown()
errno = 0;
result = screen_send_event(m_screenContext, event, getpid());
if (result)
- qFatal("QQNX: failed to set event type, errno=%d", errno);
+ qFatal("QQNX: failed to set screen event type, errno=%d", errno);
// cleanup
screen_destroy_event(event);
-#if defined(QQNXEVENTTHREAD_DEBUG)
- qDebug() << "QQNX: event loop shutdown begin";
+#if defined(QQNXSCREENEVENTTHREAD_DEBUG)
+ qDebug() << "QQNX: screen event thread shutdown begin";
#endif
// block until thread terminates
wait();
-#if defined(QQNXEVENTTHREAD_DEBUG)
- qDebug() << "QQNX: event loop shutdown end";
+#if defined(QQNXSCREENEVENTTHREAD_DEBUG)
+ qDebug() << "QQNX: screen event thread shutdown end";
#endif
}
diff --git a/src/plugins/platforms/qnx/qqnxeventthread.h b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
index aa6186aa0d..4f41e67940 100644
--- a/src/plugins/platforms/qnx/qqnxeventthread.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QQNXEVENTTHREAD_H
-#define QQNXEVENTTHREAD_H
+#ifndef QQNXSCREENEVENTTHREAD_H
+#define QQNXSCREENEVENTTHREAD_H
#include <QtCore/QThread>
@@ -50,11 +50,11 @@ QT_BEGIN_NAMESPACE
class QQnxScreenEventHandler;
-class QQnxEventThread : public QThread
+class QQnxScreenEventThread : public QThread
{
public:
- QQnxEventThread(screen_context_t context, QQnxScreenEventHandler *screenEventHandler);
- virtual ~QQnxEventThread();
+ QQnxScreenEventThread(screen_context_t context, QQnxScreenEventHandler *screenEventHandler);
+ ~QQnxScreenEventThread();
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
@@ -71,4 +71,4 @@ private:
QT_END_NAMESPACE
-#endif // QQNXEVENTTHREAD_H
+#endif // QQNXSCREENEVENTTHREAD_H
diff --git a/src/plugins/platforms/qnx/qqnxservices.cpp b/src/plugins/platforms/qnx/qqnxservices.cpp
index a1a27906ae..b02dd25527 100644
--- a/src/plugins/platforms/qnx/qqnxservices.cpp
+++ b/src/plugins/platforms/qnx/qqnxservices.cpp
@@ -41,21 +41,17 @@
#include "qqnxservices.h"
-#include <bps/navigator.h>
-#include <stdbool.h>
-#include <sys/platform.h>
-#include <QUrl>
+#include "qqnxabstractnavigator.h"
QT_BEGIN_NAMESPACE
-QQnxServices::QQnxServices()
+QQnxServices::QQnxServices(QQnxAbstractNavigator *navigator)
+ : m_navigator(navigator)
{
- bps_initialize();
}
QQnxServices::~QQnxServices()
{
- bps_shutdown();
}
bool QQnxServices::openUrl(const QUrl &url)
@@ -70,12 +66,7 @@ bool QQnxServices::openDocument(const QUrl &url)
bool QQnxServices::navigatorInvoke(const QUrl &url)
{
- if (!url.isValid() || url.isRelative())
- return false;
-
- int ret = navigator_invoke(url.toString().toUtf8(), 0);
-
- return (ret == BPS_SUCCESS);
+ return m_navigator->invokeUrl(url);
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxservices.h b/src/plugins/platforms/qnx/qqnxservices.h
index 36eb8edf65..fe7c014047 100644
--- a/src/plugins/platforms/qnx/qqnxservices.h
+++ b/src/plugins/platforms/qnx/qqnxservices.h
@@ -46,10 +46,12 @@
QT_BEGIN_NAMESPACE
+class QQnxAbstractNavigator;
+
class QQnxServices : public QPlatformServices
{
public:
- QQnxServices();
+ explicit QQnxServices(QQnxAbstractNavigator *navigator);
~QQnxServices();
bool openUrl(const QUrl &url);
@@ -57,6 +59,9 @@ public:
private:
bool navigatorInvoke(const QUrl &url);
+
+private:
+ QQnxAbstractNavigator *m_navigator;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
new file mode 100644
index 0000000000..3f0e5b2713
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
@@ -0,0 +1,209 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxvirtualkeyboardbps.h"
+
+#include <QDebug>
+
+#include <bps/event.h>
+#include <bps/locale.h>
+#include <bps/virtualkeyboard.h>
+
+QT_BEGIN_NAMESPACE
+
+QQnxVirtualKeyboardBps::QQnxVirtualKeyboardBps(QObject *parent)
+ : QQnxAbstractVirtualKeyboard(parent)
+{
+ if (locale_request_events(0) != BPS_SUCCESS)
+ qWarning("QQNX: Failed to register for locale events");
+
+ if (virtualkeyboard_request_events(0) != BPS_SUCCESS)
+ qWarning("QQNX: Failed to register for virtual keyboard events");
+
+ int height = 0;
+ if (virtualkeyboard_get_height(&height) != BPS_SUCCESS)
+ qWarning("QQNX: Failed to get virtual keyboard height");
+
+ setHeight(height);
+}
+
+bool QQnxVirtualKeyboardBps::handleEvent(bps_event_t *event)
+{
+ const int eventDomain = bps_event_get_domain(event);
+ if (eventDomain == locale_get_domain())
+ return handleLocaleEvent(event);
+
+ if (eventDomain == virtualkeyboard_get_domain())
+ return handleVirtualKeyboardEvent(event);
+
+ return false;
+}
+
+bool QQnxVirtualKeyboardBps::showKeyboard()
+{
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << Q_FUNC_INFO << "current visibility=" << isVisible();
+#endif
+
+ virtualkeyboard_show();
+ return true;
+}
+
+bool QQnxVirtualKeyboardBps::hideKeyboard()
+{
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << Q_FUNC_INFO << "current visibility=" << isVisible();
+#endif
+
+ virtualkeyboard_hide();
+ return true;
+}
+
+void QQnxVirtualKeyboardBps::applyKeyboardMode(KeyboardMode mode)
+{
+ virtualkeyboard_layout_t layout = VIRTUALKEYBOARD_LAYOUT_DEFAULT;
+
+ switch (mode) {
+ case Url:
+ layout = VIRTUALKEYBOARD_LAYOUT_URL;
+ break;
+
+ case Email:
+ layout = VIRTUALKEYBOARD_LAYOUT_EMAIL;
+ break;
+
+ case Web:
+ layout = VIRTUALKEYBOARD_LAYOUT_WEB;
+ break;
+
+ case NumPunc:
+ layout = VIRTUALKEYBOARD_LAYOUT_NUM_PUNC;
+ break;
+
+ case Symbol:
+ layout = VIRTUALKEYBOARD_LAYOUT_SYMBOL;
+ break;
+
+ case Phone:
+ layout = VIRTUALKEYBOARD_LAYOUT_PHONE;
+ break;
+
+ case Pin:
+ layout = VIRTUALKEYBOARD_LAYOUT_PIN;
+ break;
+
+ case Default: // fall through
+ default:
+ layout = VIRTUALKEYBOARD_LAYOUT_DEFAULT;
+ break;
+ }
+
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << Q_FUNC_INFO << "mode=" << mode;
+#endif
+
+ virtualkeyboard_change_options(layout, VIRTUALKEYBOARD_ENTER_DEFAULT);
+}
+
+bool QQnxVirtualKeyboardBps::handleLocaleEvent(bps_event_t *event)
+{
+ if (bps_event_get_code(event) == LOCALE_INFO) {
+ const QString language = QString::fromAscii(locale_event_get_language(event));
+ const QString country = QString::fromAscii(locale_event_get_country(event));
+
+ const QLocale newLocale(language + QLatin1Char('_') + country);
+
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << Q_FUNC_INFO << "current locale" << locale() << "new locale=" << newLocale;
+#endif
+ setLocale(newLocale);
+ return true;
+ }
+
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << "QQNX: Unhandled locale event. code=" << bps_event_get_code(event);
+#endif
+
+ return false;
+}
+
+bool QQnxVirtualKeyboardBps::handleVirtualKeyboardEvent(bps_event_t *event)
+{
+ switch (bps_event_get_code(event)) {
+ case VIRTUALKEYBOARD_EVENT_VISIBLE:
+ #if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << Q_FUNC_INFO << "EVENT VISIBLE: current visibility=" << isVisible();
+ #endif
+
+ setVisible(true);
+ break;
+
+ case VIRTUALKEYBOARD_EVENT_HIDDEN:
+ #if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << Q_FUNC_INFO << "EVENT HIDDEN: current visibility=" << isVisible();
+ #endif
+
+ setVisible(false);
+ break;
+
+ case VIRTUALKEYBOARD_EVENT_INFO: {
+ const int newHeight = virtualkeyboard_event_get_height(event);
+
+ #if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << Q_FUNC_INFO << "EVENT INFO: current height=" << height() << "new height=" << newHeight;
+ #endif
+
+ setHeight(newHeight);
+ break;
+ }
+
+ default:
+ #if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << "QQNX: Unhandled virtual keyboard event. code=" << bps_event_get_code(event);
+ #endif
+
+ return false;
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.h
index 0ba0eb882f..0fc95aad50 100644
--- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.h
@@ -1,6 +1,6 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,33 +39,34 @@
**
****************************************************************************/
-#ifndef QOPENKODEEVENTLOOPINTEGRATION_H
-#define QOPENKODEEVENTLOOPINTEGRATION_H
+#ifndef QQNXVIRTUALKEYBOARDBPS_H
+#define QQNXVIRTUALKEYBOARDBPS_H
-#include <QtGui/QPlatformEventLoopIntegration>
+#include "qqnxabstractvirtualkeyboard.h"
-class KDThread;
-class KDEvent;
+struct bps_event_t;
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QOpenKODEEventLoopIntegration : public QPlatformEventLoopIntegration
+class QQnxVirtualKeyboardBps : public QQnxAbstractVirtualKeyboard
{
+ Q_OBJECT
public:
- QOpenKODEEventLoopIntegration();
- void startEventLoop();
- void quitEventLoop();
- void qtNeedsToProcessEvents();
+ explicit QQnxVirtualKeyboardBps(QObject *parent = 0);
- void processInputEvent(const KDEvent *event);
-private:
+ bool handleEvent(bps_event_t *event);
+
+ bool showKeyboard();
+ bool hideKeyboard();
- bool m_quit;
- KDThread *m_kdThread;
+protected:
+ void applyKeyboardMode(KeyboardMode mode);
+
+private:
+ bool handleLocaleEvent(bps_event_t *event);
+ bool handleVirtualKeyboardEvent(bps_event_t *event);
};
QT_END_NAMESPACE
-QT_END_HEADER
-#endif // QOPENKODEEVENTLOOPINTEGRATION_H
+#endif // QQNXVIRTUALKEYBOARDBPS_H
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
index 916c6dfa62..d139e7f66b 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qqnxvirtualkeyboard.h"
+#include "qqnxvirtualkeyboardpps.h"
#include "qqnxscreen.h"
#include <QtCore/QDebug>
@@ -58,13 +58,13 @@
QT_BEGIN_NAMESPACE
-const char *QQnxVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait";
-const size_t QQnxVirtualKeyboard::ms_bufferSize = 2048;
+const char *QQnxVirtualKeyboardPps::ms_PPSPath = "/pps/services/input/control";
+const size_t QQnxVirtualKeyboardPps::ms_bufferSize = 2048;
// Huge hack for keyboard shadow (see QNX PR 88400). Should be removed ASAP.
#define KEYBOARD_SHADOW_HEIGHT 8
-QQnxVirtualKeyboard::QQnxVirtualKeyboard()
+QQnxVirtualKeyboardPps::QQnxVirtualKeyboardPps()
: m_encoder(0),
m_decoder(0),
m_buffer(0),
@@ -73,26 +73,26 @@ QQnxVirtualKeyboard::QQnxVirtualKeyboard()
{
}
-QQnxVirtualKeyboard::~QQnxVirtualKeyboard()
+QQnxVirtualKeyboardPps::~QQnxVirtualKeyboardPps()
{
close();
}
-void QQnxVirtualKeyboard::start()
+void QQnxVirtualKeyboardPps::start()
{
-#ifdef QQNXVIRTUALKEYBOARD_DEBUG
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
qDebug() << "QQNX: starting keyboard event processing";
#endif
if (!connect())
return;
}
-void QQnxVirtualKeyboard::applyKeyboardMode(KeyboardMode mode)
+void QQnxVirtualKeyboardPps::applyKeyboardMode(KeyboardMode mode)
{
applyKeyboardModeOptions(mode);
}
-void QQnxVirtualKeyboard::close()
+void QQnxVirtualKeyboardPps::close()
{
delete m_readNotifier;
m_readNotifier = 0;
@@ -118,7 +118,7 @@ void QQnxVirtualKeyboard::close()
m_buffer = 0;
}
-bool QQnxVirtualKeyboard::connect()
+bool QQnxVirtualKeyboardPps::connect()
{
close();
@@ -153,7 +153,7 @@ bool QQnxVirtualKeyboard::connect()
return true;
}
-bool QQnxVirtualKeyboard::queryPPSInfo()
+bool QQnxVirtualKeyboardPps::queryPPSInfo()
{
// Request info, requires id to regenerate res message.
pps_encoder_add_string(m_encoder, "msg", "info");
@@ -169,11 +169,11 @@ bool QQnxVirtualKeyboard::queryPPSInfo()
return true;
}
-void QQnxVirtualKeyboard::ppsDataReady()
+void QQnxVirtualKeyboardPps::ppsDataReady()
{
ssize_t nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1);
-#ifdef QQNXVIRTUALKEYBOARD_DEBUG
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
qDebug() << "QQNX: keyboardMessage size: " << nread;
#endif
if (nread < 0){
@@ -181,6 +181,11 @@ void QQnxVirtualKeyboard::ppsDataReady()
return;
}
+ // We sometimes get spurious read notifications when no data is available.
+ // Bail out early in this case
+ if (nread == 0)
+ return;
+
// nread is the real space necessary, not the amount read.
if (static_cast<size_t>(nread) > ms_bufferSize - 1) {
qCritical("QQnxVirtualKeyboard: Keyboard buffer size too short; need %u.", nread + 1);
@@ -191,7 +196,7 @@ void QQnxVirtualKeyboard::ppsDataReady()
m_buffer[nread] = 0;
pps_decoder_parse_pps_str(m_decoder, m_buffer);
pps_decoder_push(m_decoder, NULL);
-#ifdef QQNXVIRTUALKEYBOARD_DEBUG
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
pps_decoder_dump_tree(m_decoder, stderr);
#endif
@@ -220,7 +225,7 @@ void QQnxVirtualKeyboard::ppsDataReady()
qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS message type");
}
-void QQnxVirtualKeyboard::handleKeyboardInfoMessage()
+void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage()
{
int newHeight = 0;
const char *value;
@@ -256,14 +261,14 @@ void QQnxVirtualKeyboard::handleKeyboardInfoMessage()
const QLocale locale = QLocale(languageId + QLatin1Char('_') + countryId);
setLocale(locale);
-#ifdef QQNXVIRTUALKEYBOARD_DEBUG
- qDebug() << "QQNX: handleKeyboardInfoMessage size=" << m_height << "locale=" << m_locale;
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
+ qDebug() << "QQNX: handleKeyboardInfoMessage size=" << newHeight << "locale=" << locale;
#endif
}
-bool QQnxVirtualKeyboard::showKeyboard()
+bool QQnxVirtualKeyboardPps::showKeyboard()
{
-#ifdef QQNXVIRTUALKEYBOARD_DEBUG
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
qDebug() << "QQNX: showKeyboard()";
#endif
@@ -295,9 +300,9 @@ bool QQnxVirtualKeyboard::showKeyboard()
return true;
}
-bool QQnxVirtualKeyboard::hideKeyboard()
+bool QQnxVirtualKeyboardPps::hideKeyboard()
{
-#ifdef QQNXVIRTUALKEYBOARD_DEBUG
+#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
qDebug() << "QQNX: hideKeyboard()";
#endif
@@ -327,7 +332,7 @@ bool QQnxVirtualKeyboard::hideKeyboard()
return true;
}
-void QQnxVirtualKeyboard::applyKeyboardModeOptions(KeyboardMode mode)
+void QQnxVirtualKeyboardPps::applyKeyboardModeOptions(KeyboardMode mode)
{
// Try to connect.
if (m_fd == -1 && !connect())
@@ -374,49 +379,49 @@ void QQnxVirtualKeyboard::applyKeyboardModeOptions(KeyboardMode mode)
pps_encoder_reset(m_encoder);
}
-void QQnxVirtualKeyboard::addDefaultModeOptions()
+void QQnxVirtualKeyboardPps::addDefaultModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "default");
}
-void QQnxVirtualKeyboard::addUrlModeOptions()
+void QQnxVirtualKeyboardPps::addUrlModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "url");
}
-void QQnxVirtualKeyboard::addEmailModeOptions()
+void QQnxVirtualKeyboardPps::addEmailModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "email");
}
-void QQnxVirtualKeyboard::addWebModeOptions()
+void QQnxVirtualKeyboardPps::addWebModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "web");
}
-void QQnxVirtualKeyboard::addNumPuncModeOptions()
+void QQnxVirtualKeyboardPps::addNumPuncModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "numPunc");
}
-void QQnxVirtualKeyboard::addPhoneModeOptions()
+void QQnxVirtualKeyboardPps::addPhoneModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "phone");
}
-void QQnxVirtualKeyboard::addPinModeOptions()
+void QQnxVirtualKeyboardPps::addPinModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "pin");
}
-void QQnxVirtualKeyboard::addSymbolModeOptions()
+void QQnxVirtualKeyboardPps::addSymbolModeOptions()
{
pps_encoder_add_string(m_encoder, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "symbol");
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h
index b01a4df963..abcf411fed 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboard.h
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef VIRTUALKEYBOARD_H_
-#define VIRTUALKEYBOARD_H_
+#ifndef VIRTUALKEYBOARDPPS_H_
+#define VIRTUALKEYBOARDPPS_H_
#include "qqnxabstractvirtualkeyboard.h"
@@ -50,13 +50,12 @@ QT_BEGIN_NAMESPACE
class QSocketNotifier;
-/* Shamelessly copied from the browser - this should be rewritten once we have a proper PPS wrapper class */
-class QQnxVirtualKeyboard : public QQnxAbstractVirtualKeyboard
+class QQnxVirtualKeyboardPps : public QQnxAbstractVirtualKeyboard
{
Q_OBJECT
public:
- QQnxVirtualKeyboard();
- ~QQnxVirtualKeyboard();
+ QQnxVirtualKeyboardPps();
+ ~QQnxVirtualKeyboardPps();
bool showKeyboard();
bool hideKeyboard();
@@ -98,4 +97,4 @@ private:
static const size_t ms_bufferSize;
};
-#endif /* VIRTUALKEYBOARD_H_ */
+#endif /* VIRTUALKEYBOARDPPS_H_ */
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 2b41631d06..e37c82740c 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -40,7 +40,9 @@
****************************************************************************/
#include "qqnxwindow.h"
+#ifndef QT_NO_OPENGL
#include "qqnxglcontext.h"
+#endif
#include "qqnxintegration.h"
#include "qqnxscreen.h"
@@ -59,7 +61,9 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
m_window(0),
m_currentBufferIndex(-1),
m_previousBufferIndex(-1),
+#ifndef QT_NO_OPENGL
m_platformOpenGLContext(0),
+#endif
m_screen(0),
m_parentWindow(0),
m_visible(true)
@@ -240,6 +244,9 @@ void QQnxWindow::setVisible(bool visible)
root->updateVisibility(root->m_visible);
window()->requestActivateWindow();
+
+ if (window()->isTopLevel() && visible)
+ QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
}
void QQnxWindow::updateVisibility(bool parentVisible)
@@ -278,6 +285,11 @@ void QQnxWindow::setOpacity(qreal level)
// the transparency will look wrong...
}
+bool QQnxWindow::isExposed() const
+{
+ return m_visible;
+}
+
void QQnxWindow::setBufferSize(const QSize &size)
{
#if defined(QQNXWINDOW_DEBUG)
@@ -293,6 +305,7 @@ void QQnxWindow::setBufferSize(const QSize &size)
// Create window buffers if they do not exist
if (!hasBuffers()) {
+#ifndef QT_NO_OPENGL
// Get pixel format from EGL config if using OpenGL;
// otherwise inherit pixel format of window's screen
if (m_platformOpenGLContext != 0) {
@@ -300,6 +313,7 @@ void QQnxWindow::setBufferSize(const QSize &size)
} else {
val[0] = m_screen->nativeFormat();
}
+#endif
errno = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
@@ -545,12 +559,14 @@ void QQnxWindow::gainedFocus()
QWindowSystemInterface::handleWindowActivated(window());
}
+#ifndef QT_NO_OPENGL
void QQnxWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext)
{
// This function does not take ownership of the platform gl context.
// It is owned by the frontend QOpenGLContext
m_platformOpenGLContext = platformOpenGLContext;
}
+#endif
QQnxWindow *QQnxWindow::findWindow(screen_window_t windowHandle)
{
diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h
index 63e71c0bf8..2ea7bbca51 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.h
+++ b/src/plugins/platforms/qnx/qqnxwindow.h
@@ -48,7 +48,9 @@
#include <QtGui/QImage>
+#ifndef QT_NO_OPENGL
#include <EGL/egl.h>
+#endif
#include <screen/screen.h>
@@ -57,7 +59,9 @@ QT_BEGIN_NAMESPACE
// all surfaces double buffered
#define MAX_BUFFER_COUNT 2
+#ifndef QT_NO_OPENGL
class QQnxGLContext;
+#endif
class QQnxScreen;
class QSurfaceFormat;
@@ -73,6 +77,8 @@ public:
void setVisible(bool visible);
void setOpacity(qreal level);
+ bool isExposed() const;
+
WId winId() const { return (WId)m_window; }
screen_window_t nativeHandle() const { return m_window; }
@@ -96,8 +102,10 @@ public:
QQnxScreen *screen() const { return m_screen; }
const QList<QQnxWindow*>& children() const { return m_childWindows; }
+#ifndef QT_NO_OPENGL
void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext);
QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; }
+#endif
QQnxWindow *findWindow(screen_window_t windowHandle);
@@ -122,7 +130,9 @@ private:
QRegion m_previousDirty;
QRegion m_scrolled;
+#ifndef QT_NO_OPENGL
QQnxGLContext *m_platformOpenGLContext;
+#endif
QQnxScreen *m_screen;
QList<QQnxWindow*> m_childWindows;
QQnxWindow *m_parentWindow;
diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro
deleted file mode 100644
index 8738b18bc6..0000000000
--- a/src/plugins/platforms/qvfb/qvfb.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = qvfbintegration
-load(qt_plugin)
-
-DESTDIR = $$QT.gui.plugins/platforms
-
-QT += core-private gui-private platformsupport-private
-
-SOURCES = main.cpp qvfbintegration.cpp qvfbwindowsurface.cpp
-HEADERS = qvfbintegration.h qvfbwindowsurface.h
-
-CONFIG += qpa/genericunixfontdatabase
-
-target.path += $$[QT_INSTALL_PLUGINS]/platforms
-INSTALLS += target
diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp
deleted file mode 100644
index 478733e96f..0000000000
--- a/src/plugins/platforms/qvfb/qvfbintegration.cpp
+++ /dev/null
@@ -1,454 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <qvfbhdr.h>
-#include <qsocketnotifier.h>
-
-#include "qvfbintegration.h"
-#include "qvfbwindowsurface.h"
-#include <QtGui/private/qpixmap_raster_p.h>
-#include <QtCore/qdebug.h>
-#include <QMouseEvent>
-
-#include <qsocketnotifier.h>
-#include <QApplication>
-#include <QWindowSystemInterface>
-
-#include "qgenericunixfontdatabase.h"
-#include "qgenericunixeventdispatcher.h"
-
-QT_BEGIN_NAMESPACE
-
-
-class QVFbScreenKeyboardHandler : public QObject
-{
- Q_OBJECT
-public:
- QVFbScreenKeyboardHandler(int displayId);
- ~QVFbScreenKeyboardHandler();
-
-private slots:
- void readKeyboardData();
-
-private:
- int kbdFD;
- int kbdIdx;
- int kbdBufferLen;
- unsigned char *kbdBuffer;
- QSocketNotifier *keyNotifier;
-};
-
-QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler(int displayId)
-{
- const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId);
-
-
- kbdFD = -1;
- kbdIdx = 0;
- kbdBufferLen = sizeof(QVFbKeyData) * 5;
- kbdBuffer = new unsigned char [kbdBufferLen];
-
- kbdFD = QT_OPEN(keyboardDev.toLatin1().constData(), O_RDWR | O_NDELAY);
-
- if (kbdFD == -1) {
- perror("QVFbScreenKeyboardHandler");
- qWarning("QVFbScreenKeyboardHandler: Unable to open device %s",
- qPrintable(keyboardDev));
- return;
- }
-
- // Clear pending input
- char buf[2];
- while (QT_READ(kbdFD, buf, 1) > 0) { }
-
- keyNotifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this);
- connect(keyNotifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
-
-}
-
-QVFbScreenKeyboardHandler::~QVFbScreenKeyboardHandler()
-{
- if (kbdFD >= 0)
- QT_CLOSE(kbdFD);
- delete [] kbdBuffer;
-}
-
-
-void QVFbScreenKeyboardHandler::readKeyboardData()
-{
- int n;
- do {
- n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
- if (n > 0)
- kbdIdx += n;
- } while (n > 0);
-
- int idx = 0;
- while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) {
- QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx);
- if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) {
- // magic exit key
- qWarning("Instructed to quit by Virtual Keyboard");
- qApp->quit();
- }
-
- //QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat);
-
- QEvent::Type type = kd->press ? QEvent::KeyPress : QEvent::KeyRelease;
-
- QString text;
- if (kd->unicode && kd->unicode != 0xffff)
- text += QChar(kd->unicode);
-
-// qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text;
-
- QWindowSystemInterface::handleKeyEvent(0, type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length()));
- idx += sizeof(QVFbKeyData);
- }
-
- int surplus = kbdIdx - idx;
- for (int i = 0; i < surplus; i++)
- kbdBuffer[i] = kbdBuffer[idx+i];
- kbdIdx = surplus;
-}
-
-
-
-
-class QVFbScreenMouseHandler : public QObject
-{
- Q_OBJECT
-public:
- QVFbScreenMouseHandler(int displayId);
- ~QVFbScreenMouseHandler();
-
-private slots:
- void readMouseData();
-
-private:
- int mouseFD;
- int mouseIdx;
- enum {mouseBufSize = 128};
- uchar mouseBuf[mouseBufSize];
- QSocketNotifier *mouseNotifier;
-
- int oldButtonState;
-};
-
-QVFbScreenMouseHandler::QVFbScreenMouseHandler(int displayId)
-{
- QString mouseDev = QT_VFB_MOUSE_PIPE(displayId);
-
- mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY);
-
- if (mouseFD == -1) {
- perror("QVFbMouseHandler::QVFbMouseHandler");
- qWarning("QVFbMouseHander: Unable to open device %s",
- qPrintable(mouseDev));
- return;
- }
-
- // Clear pending input
- char buf[2];
- while (QT_READ(mouseFD, buf, 1) > 0) { }
-
- mouseIdx = 0;
- oldButtonState = 0;
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-
-QVFbScreenMouseHandler::~QVFbScreenMouseHandler()
-{
- if (mouseFD >= 0)
- QT_CLOSE(mouseFD);
-}
-
-void QVFbScreenMouseHandler::readMouseData()
-{
- int n;
- do {
- n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
- if (n > 0)
- mouseIdx += n;
- } while (n > 0);
-
- int idx = 0;
- static const int packetsize = sizeof(QPoint) + 2*sizeof(int);
- while (mouseIdx-idx >= packetsize) {
- uchar *mb = mouseBuf+idx;
- QPoint mousePos = *reinterpret_cast<QPoint *>(mb);
- mb += sizeof(QPoint);
- int bstate = *reinterpret_cast<int *>(mb);
- mb += sizeof(int);
- //int wheel = *reinterpret_cast<int *>(mb);
-
- int button = bstate ^ oldButtonState;
- QEvent::Type type = QEvent::MouseMove;
-
- if (button) {
- type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease;
- }
- QWindowSystemInterface::handleMouseEvent(0, mousePos, mousePos, Qt::MouseButtons(bstate));
-
-// qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type;
-
- oldButtonState = bstate;
-
- idx += packetsize;
- }
-
- int surplus = mouseIdx - idx;
- for (int i = 0; i < surplus; i++)
- mouseBuf[i] = mouseBuf[idx+i];
- mouseIdx = surplus;
-
-}
-
-
-class QVFbScreenPrivate
-{
-public:
- QVFbScreenPrivate(int id)
- : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0)
- {
- displayId = id;
- connect(displayId);
- }
-
- ~QVFbScreenPrivate() { disconnect(); }
- void setDirty(const QRect &r);
-
- bool connect(int displayId);
- void disconnect();
-
- QImage *screenImage() { return &img; }
- QSize screenSize() { return img.size(); }
-
- int depth() const { return img.depth(); }
- QImage::Format format() const { return img.format(); }
-
-private:
- unsigned char *shmrgn;
- QVFbHeader *hdr;
- uchar *data;
- QVFbScreenMouseHandler *mouseHandler;
- QVFbScreenKeyboardHandler *keyboardHandler;
- int displayId;
-
- QImage img;
-};
-
-
-void QVFbScreenPrivate::setDirty(const QRect &r)
-{
- hdr->dirty = true;
- hdr->update = hdr->update.united(r);
-}
-
-
-bool QVFbScreenPrivate::connect(int displayId)
-{
- qDebug() << "QVFbScreenPrivate::connect" << displayId;
- key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b');
-
- if (key == -1)
- return false;
-
-
- int shmId = shmget(key, 0, 0);
- if (shmId != -1)
- shmrgn = (unsigned char *)shmat(shmId, 0, 0);
- else
- return false;
-
- if ((long)shmrgn == -1 || shmrgn == 0) {
- qDebug("No shmrgn %ld", (long)shmrgn);
- return false;
- }
-
- hdr = (QVFbHeader *)shmrgn;
- data = shmrgn + hdr->dataoffset;
-
- int w = hdr->width;
- int h = hdr->height;
- int d = hdr->depth;
- int lstep = hdr->linestep;
-
- QImage::Format format = QImage::Format_Invalid;
- if (d == 32)
- format = QImage::Format_ARGB32_Premultiplied;
- else if (d == 16)
- format = QImage::Format_RGB16;
-
-
- if (format == QImage::Format_Invalid) {
- img = QImage();
- return false;
- }
-
- img = QImage(data, w, h, lstep, format);
-
- qDebug("connected %dx%d %d bpp", w, h, d);
-
-
- mouseHandler = new QVFbScreenMouseHandler(displayId);
- keyboardHandler = new QVFbScreenKeyboardHandler(displayId);
- return true;
-}
-
-void QVFbScreenPrivate::disconnect()
-{
- if ((long)shmrgn != -1 && shmrgn) {
- shmdt((char*)shmrgn);
- shmrgn = 0;
- }
- delete mouseHandler;
- mouseHandler = 0;
- delete keyboardHandler;
- keyboardHandler = 0;
-}
-
-
-QVFbScreen::QVFbScreen(int id)
-{
- d_ptr = new QVFbScreenPrivate(id);
-}
-
-
-QVFbScreen::~QVFbScreen()
-{
- delete d_ptr;
-}
-
-void QVFbScreen::setDirty(const QRect &rect)
-{
- d_ptr->setDirty(rect);
-}
-
-
-
-QRect QVFbScreen::geometry() const {
- return QRect(QPoint(), d_ptr->screenSize());
-}
-
-
-int QVFbScreen::depth() const
-{
- return d_ptr->depth();
-}
-
-QImage::Format QVFbScreen::format() const
-{
- return d_ptr->format();
-}
-
-QSizeF QVFbScreen::physicalSize() const {
- return (QSizeF(d_ptr->screenSize())*254)/720.;
-}
-
-#if 0
-int QVFbScreen::linestep() const {
- return d_ptr->screenImage() ? d_ptr->screenImage()->bytesPerLine() : 0;
-}
-
-uchar *QVFbScreen::base() const {
- return d_ptr->screenImage() ? d_ptr->screenImage()->bits() : 0;
-}
-#endif
-
-QImage *QVFbScreen::screenImage()
-{
- return d_ptr->screenImage();
-}
-
-QVFbIntegration::QVFbIntegration(const QStringList &paramList)
- : mFontDb(new QGenericUnixFontDatabase())
-{
- int displayId = 0;
- if (paramList.length() > 0)
- displayId = paramList.at(0).toInt();
-
- mPrimaryScreen = new QVFbScreen(displayId);
-
- mScreens.append(mPrimaryScreen);
-}
-
-QPlatformPixmap *QVFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
-{
- return new QRasterPlatformPixmap(type);
-}
-
-QWindowSurface *QVFbIntegration::createWindowSurface(QWidget *widget, WId) const
-{
- return new QVFbWindowSurface(mPrimaryScreen, widget);
-}
-
-
-QPlatformWindow *QVFbIntegration::createPlatformWindow(QWidget *widget, WId) const
-{
- return new QVFbWindow(mPrimaryScreen, widget);
-}
-
-QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const
-{
- return createUnixEventDispatcher();
-}
-
-QPlatformFontDatabase *QVFbIntegration::fontDatabase() const
-{
- return mFontDb;
-}
-
-QT_END_NAMESPACE
-
-#include "qvfbintegration.moc"
diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h
deleted file mode 100644
index 45f6b391f0..0000000000
--- a/src/plugins/platforms/qvfb/qvfbintegration.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSSYSTEM_QVFB_H
-#define QGRAPHICSSYSTEM_QVFB_H
-
-#include <QPlatformScreen>
-#include <QPlatformIntegration>
-
-QT_BEGIN_NAMESPACE
-
-
-class QVFbScreenPrivate;
-class QAbstractEventDispatcher;
-
-class QVFbScreen : public QPlatformScreen
-{
-public:
- QVFbScreen(int id);
- ~QVFbScreen();
-
- QRect geometry() const;
- int depth() const;
- QImage::Format format() const;
- QSizeF physicalSize() const;
-
- QImage *screenImage();
-
- void setDirty(const QRect &rect);
-
-public:
-
- QVFbScreenPrivate *d_ptr;
-};
-
-class QVFbIntegrationPrivate;
-
-
-class QVFbIntegration : public QPlatformIntegration
-{
-public:
- QVFbIntegration(const QStringList &paramList);
-
- QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
- QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
- QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
- QAbstractEventDispatcher *createEventDispatcher() const;
-
- QList<QPlatformScreen *> screens() const { return mScreens; }
-
- QPlatformFontDatabase *fontDatabase() const;
-
-private:
- QVFbScreen *mPrimaryScreen;
- QList<QPlatformScreen *> mScreens;
- QPlatformFontDatabase *mFontDb;
-};
-
-
-
-QT_END_NAMESPACE
-
-
-#endif
diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp
deleted file mode 100644
index 6180836127..0000000000
--- a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qvfbwindowsurface.h"
-#include "qvfbintegration.h"
-#include <QtCore/qdebug.h>
-#include <QtGui/qpainter.h>
-#include <private/qapplication_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QVFbWindowSurface::QVFbWindowSurface(//QVFbIntegration *graphicsSystem,
- QVFbScreen *screen, QWidget *window)
- : QWindowSurface(window),
- mScreen(screen)
-{
-}
-
-QVFbWindowSurface::~QVFbWindowSurface()
-{
-}
-
-QPaintDevice *QVFbWindowSurface::paintDevice()
-{
- return mScreen->screenImage();
-}
-
-void QVFbWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
-{
- Q_UNUSED(widget);
- Q_UNUSED(offset);
-
-// QRect rect = geometry();
-// QPoint topLeft = rect.topLeft();
-
- mScreen->setDirty(region.boundingRect());
-}
-
-void QVFbWindowSurface::resize(const QSize&)
-{
-
-// any size you like as long as it's full-screen...
-
- QRect rect(mScreen->availableGeometry());
- QWindowSurface::resize(rect.size());
-}
-
-
-QVFbWindow::QVFbWindow(QVFbScreen *screen, QWidget *window)
- : QPlatformWindow(window),
- mScreen(screen)
-{
-}
-
-
-void QVFbWindow::setGeometry(const QRect &)
-{
-
-// any size you like as long as it's full-screen...
-
- QRect rect(mScreen->availableGeometry());
- QWindowSystemInterface::handleGeometryChange(this->widget(), rect);
-
- QPlatformWindow::setGeometry(rect);
-}
-
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp
index 9a0fce20b8..2823306609 100644
--- a/src/plugins/platforms/windows/accessible/comutils.cpp
+++ b/src/plugins/platforms/windows/accessible/comutils.cpp
@@ -51,6 +51,8 @@
#include <QtCore/qbytearray.h>
#include <QtGui/qcolor.h>
+QT_BEGIN_NAMESPACE
+
static DATE QDateTimeToDATE(const QDateTime &dt)
{
if (!dt.isValid() || dt.isNull())
@@ -639,3 +641,5 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
return true;
}
+QT_END_NAMESPACE
+
diff --git a/src/plugins/platforms/windows/accessible/comutils.h b/src/plugins/platforms/windows/accessible/comutils.h
index 08420cc46c..4d8e603899 100644
--- a/src/plugins/platforms/windows/accessible/comutils.h
+++ b/src/plugins/platforms/windows/accessible/comutils.h
@@ -48,6 +48,8 @@
#include <ocidl.h>
#include <QtCore/qstring.h>
+QT_BEGIN_NAMESPACE
+
class QVariant;
bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out);
@@ -57,5 +59,7 @@ inline BSTR QStringToBSTR(const QString &str)
return SysAllocStringLen((OLECHAR*)str.unicode(), str.length());
}
+QT_END_NAMESPACE
+
#endif // COMUTILS_H
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index ddab3cb0f2..71a26aff6b 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -338,13 +338,19 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relations(long maxRelations
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::role(long *ia2role)
{
accessibleDebugClientCalls(accessible);
- //### Change QAccessibleInterface::role() to return both MSAA and IA2 roles.
- // When that is completed, we must patch the MSAA bridge not not return any
- // IA2-specific roles from get_accRole().
if (!accessible->isValid())
return E_FAIL;
- *ia2role = accessible->role();
+ long r = accessible->role();
+
+ switch (r) {
+ case QAccessible::LayeredPane: r = IA2_ROLE_LAYERED_PANE; break;
+ case QAccessible::Terminal: r = IA2_ROLE_TERMINAL; break;
+ case QAccessible::Desktop: r = IA2_ROLE_DESKTOP_PANE; break;
+ default: break;
+ }
+
+ *ia2role = r;
return S_OK;
}
@@ -1363,15 +1369,16 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidServic
Q_UNUSED(guidService);
*iface = 0;
accessibleDebug("QWindowsIA2Accessible::QS(): %s", IIDToString(riid).constData());
- if (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch) {
- *iface = static_cast<IAccessible*>(this);
- } else if (/*guidService == IID_IAccessible && */riid == IID_IAccessible2) {
+
+ if (guidService == IID_IAccessible && riid == IID_IAccessible2) {
+ // The conditions for entering here should be ok (from _dicoveringInterfaces in IAccessible2.idl)
*iface = static_cast<IAccessible2*>(this);
- } else if (riid == IID_IAccessibleApplication) {
+ } else if (guidService == IID_IAccessible && (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch)) {
+ // The above conditions works with AccProbe and NVDA.
+ *iface = static_cast<IAccessible*>(this);
+ } else if (riid == IID_IAccessibleApplication) {
*iface = new AccessibleApplication;
return S_OK;
- } else {
- QueryInterface(riid, iface);
}
if (*iface) {
AddRef();
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
index 0672a86dd9..17ee6eb82c 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
@@ -110,10 +110,10 @@ QWindowsAccessibility::QWindowsAccessibility()
{
}
-void QWindowsAccessibility::notifyAccessibilityUpdate(const QAccessibleEvent &event)
+void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
QString soundName;
- switch (event.type()) {
+ switch (event->type()) {
case QAccessible::PopupMenuStart:
soundName = QLatin1String("MenuPopup");
break;
@@ -184,7 +184,7 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(const QAccessibleEvent &ev
// An event has to be associated with a window,
// so find the first parent that is a widget and that has a WId
- QAccessibleInterface *iface = event.accessibleInterface();
+ QAccessibleInterface *iface = event->accessibleInterface();
QWindow *window = iface ? QWindowsAccessibility::windowHelper(iface) : 0;
delete iface;
@@ -198,13 +198,13 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(const QAccessibleEvent &ev
HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window);
static int eventNum = 0;
- if (event.type() != QAccessible::MenuCommand) { // MenuCommand is faked
+ if (event->type() != QAccessible::MenuCommand) { // MenuCommand is faked
// See comment "SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE"
eventNum %= 50; //[0..49]
int eventId = - (eventNum - 1);
- qAccessibleRecentSentEvents()->insert(eventId, qMakePair(event.object(), event.child()));
- ptrNotifyWinEvent(event.type(), hWnd, OBJID_CLIENT, eventId );
+ qAccessibleRecentSentEvents()->insert(eventId, qMakePair(event->object(), event->child()));
+ ptrNotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, eventId );
++eventNum;
}
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h
index 0c3aca0a03..3366c32daa 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h
+++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h
@@ -56,7 +56,7 @@ class QWindowsAccessibility : public QPlatformAccessibility
public:
QWindowsAccessibility();
static bool handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
- virtual void notifyAccessibilityUpdate(const QAccessibleEvent &event);
+ virtual void notifyAccessibilityUpdate(QAccessibleEvent *event);
/*
virtual void setRootObject(QObject *o);
virtual void initialize();
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 6c4d217cb4..5003d9effd 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -998,8 +998,14 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VAR
}
if (role != QAccessible::NoRole) {
- if (role == QAccessible::LayeredPane)
- role = QAccessible::Pane;
+ if (role >= QAccessible::LayeredPane) {
+ // This block should hopefully only be entered if the AT client
+ // does not support IAccessible2, since it should prefer IA2::role() then.
+ if (role == QAccessible::LayeredPane)
+ role = QAccessible::Pane;
+ else
+ role = QAccessible::Client;
+ }
(*pvarRole).vt = VT_I4;
(*pvarRole).lVal = role;
} else {
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
index d7dda6b3e2..28f45eb9b5 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
@@ -59,14 +59,16 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DEBUG
+#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_OUTPUT)
bool debug_accessibility();
# define accessibleDebug !debug_accessibility() ? (void)0 : qDebug
#else
# define accessibleDebug
#endif
+#ifndef QT_NO_DEBUG_OUTPUT
#define DEBUG_SHOW_ATCLIENT_COMMANDS
+#endif
#if defined(DEBUG_SHOW_ATCLIENT_COMMANDS)
void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleInterface *iface);
# define accessibleDebugClientCalls(iface) accessibleDebugClientCalls_helper(Q_FUNC_INFO, iface)
@@ -92,6 +94,7 @@ class QWindowsMsaaAccessible : public
public:
QWindowsMsaaAccessible(QAccessibleInterface *a)
: accessible(a)
+ , ref(0)
{
}
diff --git a/src/plugins/platforms/windows/main.cpp b/src/plugins/platforms/windows/main.cpp
index 6d7c89e086..9f6ce99836 100644
--- a/src/plugins/platforms/windows/main.cpp
+++ b/src/plugins/platforms/windows/main.cpp
@@ -59,8 +59,8 @@ QT_BEGIN_NAMESPACE
of QGuiApplication:
\list
- \li \c fontengine=native Indicates that the freetype font
- engine should not be used.
+ \li \c fontengine=native Indicates that native font engine should be used (default)
+ \li \c fontengine=freetype Indicates that freetype font engine should be used
\li \c gl=gdi Indicates that ARB Open GL functionality should not be used
\endlist
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index bbb6b5305f..fad7dbdbf4 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -78,11 +78,12 @@ QPaintDevice *QWindowsBackingStore::paintDevice()
void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
const QPoint &offset)
{
+ Q_ASSERT(window);
// TODO: Prepare paint for translucent windows.
const QRect br = region.boundingRect();
if (QWindowsContext::verboseBackingStore > 1)
qDebug() << __FUNCTION__ << window << offset << br;
- QWindowsWindow *rw = rasterWindow();
+ QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
const HDC dc = rw->getDC();
if (!dc) {
qErrnoWarning("%s: GetDC failed", __FUNCTION__);
@@ -106,6 +107,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
void QWindowsBackingStore::resize(const QSize &size, const QRegion &region)
{
if (m_image.isNull() || m_image->image().size() != size) {
+#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseBackingStore) {
QDebug nsp = qDebug().nospace();
nsp << __FUNCTION__ << ' ' << rasterWindow()->window()
@@ -113,6 +115,7 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion &region)
if (!m_image.isNull())
nsp << " from: " << m_image->image().size();
}
+#endif
m_image.reset(new QWindowsNativeImage(size.width(), size.height(),
QWindowsNativeImage::systemFormat()));
}
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index cd555d71a1..4166e567c4 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -158,6 +158,7 @@ QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType,
if (const QWindowsMime *converter = mc.converterToMime(mimeType, pDataObj))
result = converter->convertToMime(mimeType, pDataObj, type);
releaseDataObject(pDataObj);
+#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseOLE) {
QDebug nospace = qDebug().nospace();
nospace << __FUNCTION__ << ' ' << mimeType << ' ' << type
@@ -165,6 +166,7 @@ QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType,
if (result.type() != QVariant::ByteArray)
nospace << ' ' << result;
}
+#endif
return result;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index c5b1dcce9f..6913bc8dd4 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -47,7 +47,9 @@
#include "qtwindowsglobal.h"
#include "qwindowsmime.h"
#include "qwindowsinputcontext.h"
+#ifndef QT_NO_ACCESSIBILITY
#include "accessible/qwindowsaccessibility.h"
+#endif
#include "qwindowsscreen.h"
#include "qwindowstheme.h"
@@ -698,7 +700,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::UnknownEvent:
return false;
case QtWindows::AccessibleObjectFromWindowRequest:
+#ifndef QT_NO_ACCESSIBILITY
return QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(hwnd, wParam, lParam, result);
+#else
+ return false;
+#endif
case QtWindows::DisplayChangedEvent:
return d->m_screenManager.handleDisplayChange(wParam, lParam);
default:
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index a6bde74103..12ea880ab0 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -486,11 +486,11 @@ void QWindowsDialogThread::run()
}
template <class BaseClass>
-bool QWindowsDialogHelperBase<BaseClass>::show_sys(QPlatformDialogHelper::ShowFlags flags,
- Qt::WindowFlags,
+bool QWindowsDialogHelperBase<BaseClass>::show_sys(Qt::WindowFlags,
+ Qt::WindowModality windowModality,
QWindow *parent)
{
- const bool modal = flags & QPlatformDialogHelper::ShowModal;
+ const bool modal = (windowModality == Qt::ApplicationModal);
if (parent) {
m_ownerWindow = QWindowsWindow::handleOf(parent);
} else {
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
index 3ae22e69eb..909ce5984e 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
@@ -69,8 +69,8 @@ public:
virtual void platformNativeDialogModalHelp();
virtual void _q_platformRunNativeAppModalPanel();
virtual void deleteNativeDialog_sys();
- virtual bool show_sys(QPlatformDialogHelper::ShowFlags flags,
- Qt::WindowFlags windowFlags,
+ virtual bool show_sys(Qt::WindowFlags windowFlags,
+ Qt::WindowModality windowModality,
QWindow *parent);
virtual void hide_sys();
virtual QVariant styleHint(QPlatformDialogHelper::StyleHint) const;
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 979b2a028b..caa1913bb5 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -62,6 +62,442 @@
QT_BEGIN_NAMESPACE
+// Helper classes for creating font engines directly from font data
+namespace {
+
+# pragma pack(1)
+
+ // Common structure for all formats of the "name" table
+ struct NameTable
+ {
+ quint16 format;
+ quint16 count;
+ quint16 stringOffset;
+ };
+
+ struct NameRecord
+ {
+ quint16 platformID;
+ quint16 encodingID;
+ quint16 languageID;
+ quint16 nameID;
+ quint16 length;
+ quint16 offset;
+ };
+
+ struct OffsetSubTable
+ {
+ quint32 scalerType;
+ quint16 numTables;
+ quint16 searchRange;
+ quint16 entrySelector;
+ quint16 rangeShift;
+ };
+
+ struct TableDirectory
+ {
+ quint32 identifier;
+ quint32 checkSum;
+ quint32 offset;
+ quint32 length;
+ };
+
+ struct OS2Table
+ {
+ quint16 version;
+ qint16 avgCharWidth;
+ quint16 weightClass;
+ quint16 widthClass;
+ quint16 type;
+ qint16 subscriptXSize;
+ qint16 subscriptYSize;
+ qint16 subscriptXOffset;
+ qint16 subscriptYOffset;
+ qint16 superscriptXSize;
+ qint16 superscriptYSize;
+ qint16 superscriptXOffset;
+ qint16 superscriptYOffset;
+ qint16 strikeOutSize;
+ qint16 strikeOutPosition;
+ qint16 familyClass;
+ quint8 panose[10];
+ quint32 unicodeRanges[4];
+ quint8 vendorID[4];
+ quint16 selection;
+ quint16 firstCharIndex;
+ quint16 lastCharIndex;
+ qint16 typoAscender;
+ qint16 typoDescender;
+ qint16 typoLineGap;
+ quint16 winAscent;
+ quint16 winDescent;
+ quint32 codepageRanges[2];
+ qint16 height;
+ qint16 capHeight;
+ quint16 defaultChar;
+ quint16 breakChar;
+ quint16 maxContext;
+ };
+
+# pragma pack()
+
+ class EmbeddedFont
+ {
+ public:
+ EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) {}
+
+ QString changeFamilyName(const QString &newFamilyName);
+ QByteArray data() const { return m_fontData; }
+ TableDirectory *tableDirectoryEntry(const QByteArray &tagName);
+ QString familyName(TableDirectory *nameTableDirectory = 0);
+
+ private:
+ QByteArray m_fontData;
+ };
+
+ TableDirectory *EmbeddedFont::tableDirectoryEntry(const QByteArray &tagName)
+ {
+ Q_ASSERT(tagName.size() == 4);
+ quint32 tagId = *(reinterpret_cast<const quint32 *>(tagName.constData()));
+
+ OffsetSubTable *offsetSubTable = reinterpret_cast<OffsetSubTable *>(m_fontData.data());
+ TableDirectory *tableDirectory = reinterpret_cast<TableDirectory *>(offsetSubTable + 1);
+
+ TableDirectory *nameTableDirectoryEntry = 0;
+ for (int i = 0; i < qFromBigEndian<quint16>(offsetSubTable->numTables); ++i, ++tableDirectory) {
+ if (tableDirectory->identifier == tagId) {
+ nameTableDirectoryEntry = tableDirectory;
+ break;
+ }
+ }
+
+ return nameTableDirectoryEntry;
+ }
+
+ QString EmbeddedFont::familyName(TableDirectory *nameTableDirectoryEntry)
+ {
+ QString name;
+
+ if (nameTableDirectoryEntry == 0)
+ nameTableDirectoryEntry = tableDirectoryEntry("name");
+
+ if (nameTableDirectoryEntry != 0) {
+ NameTable *nameTable = reinterpret_cast<NameTable *>(
+ m_fontData.data() + qFromBigEndian<quint32>(nameTableDirectoryEntry->offset));
+ NameRecord *nameRecord = reinterpret_cast<NameRecord *>(nameTable + 1);
+ for (int i = 0; i < qFromBigEndian<quint16>(nameTable->count); ++i, ++nameRecord) {
+ if (qFromBigEndian<quint16>(nameRecord->nameID) == 1
+ && qFromBigEndian<quint16>(nameRecord->platformID) == 3 // Windows
+ && qFromBigEndian<quint16>(nameRecord->languageID) == 0x0409) { // US English
+ const void *ptr = reinterpret_cast<const quint8 *>(nameTable)
+ + qFromBigEndian<quint16>(nameTable->stringOffset)
+ + qFromBigEndian<quint16>(nameRecord->offset);
+
+ const quint16 *s = reinterpret_cast<const quint16 *>(ptr);
+ const quint16 *e = s + qFromBigEndian<quint16>(nameRecord->length) / sizeof(quint16);
+ while (s != e)
+ name += QChar( qFromBigEndian<quint16>(*s++));
+ break;
+ }
+ }
+ }
+
+ return name;
+ }
+
+ QString EmbeddedFont::changeFamilyName(const QString &newFamilyName)
+ {
+ TableDirectory *nameTableDirectoryEntry = tableDirectoryEntry("name");
+ if (nameTableDirectoryEntry == 0)
+ return QString();
+
+ QString oldFamilyName = familyName(nameTableDirectoryEntry);
+
+ // Reserve size for name table header, five required name records and string
+ const int requiredRecordCount = 5;
+ quint16 nameIds[requiredRecordCount] = { 1, 2, 3, 4, 6 };
+
+ int sizeOfHeader = sizeof(NameTable) + sizeof(NameRecord) * requiredRecordCount;
+ int newFamilyNameSize = newFamilyName.size() * sizeof(quint16);
+
+ const QString regularString = QString::fromLatin1("Regular");
+ int regularStringSize = regularString.size() * sizeof(quint16);
+
+ // Align table size of table to 32 bits (pad with 0)
+ int fullSize = ((sizeOfHeader + newFamilyNameSize + regularStringSize) & ~3) + 4;
+
+ QByteArray newNameTable(fullSize, char(0));
+
+ {
+ NameTable *nameTable = reinterpret_cast<NameTable *>(newNameTable.data());
+ nameTable->count = qbswap<quint16>(requiredRecordCount);
+ nameTable->stringOffset = qbswap<quint16>(sizeOfHeader);
+
+ NameRecord *nameRecord = reinterpret_cast<NameRecord *>(nameTable + 1);
+ for (int i = 0; i < requiredRecordCount; ++i, nameRecord++) {
+ nameRecord->nameID = qbswap<quint16>(nameIds[i]);
+ nameRecord->encodingID = qbswap<quint16>(1);
+ nameRecord->languageID = qbswap<quint16>(0x0409);
+ nameRecord->platformID = qbswap<quint16>(3);
+ nameRecord->length = qbswap<quint16>(newFamilyNameSize);
+
+ // Special case for sub-family
+ if (nameIds[i] == 4) {
+ nameRecord->offset = qbswap<quint16>(newFamilyNameSize);
+ nameRecord->length = qbswap<quint16>(regularStringSize);
+ }
+ }
+
+ // nameRecord now points to string data
+ quint16 *stringStorage = reinterpret_cast<quint16 *>(nameRecord);
+ const quint16 *sourceString = newFamilyName.utf16();
+ for (int i = 0; i < newFamilyName.size(); ++i)
+ stringStorage[i] = qbswap<quint16>(sourceString[i]);
+ stringStorage += newFamilyName.size();
+
+ sourceString = regularString.utf16();
+ for (int i = 0; i < regularString.size(); ++i)
+ stringStorage[i] = qbswap<quint16>(sourceString[i]);
+ }
+
+ quint32 *p = reinterpret_cast<quint32 *>(newNameTable.data());
+ quint32 *tableEnd = reinterpret_cast<quint32 *>(newNameTable.data() + fullSize);
+
+ quint32 checkSum = 0;
+ while (p < tableEnd)
+ checkSum += qFromBigEndian<quint32>(*(p++));
+
+ nameTableDirectoryEntry->checkSum = qbswap<quint32>(checkSum);
+ nameTableDirectoryEntry->offset = qbswap<quint32>(m_fontData.size());
+ nameTableDirectoryEntry->length = qbswap<quint32>(fullSize);
+
+ m_fontData.append(newNameTable);
+
+ return oldFamilyName;
+ }
+
+#if !defined(QT_NO_DIRECTWRITE)
+
+ class DirectWriteFontFileStream: public IDWriteFontFileStream
+ {
+ public:
+ DirectWriteFontFileStream(const QByteArray &fontData)
+ : m_fontData(fontData)
+ , m_referenceCount(0)
+ {
+ }
+
+ ~DirectWriteFontFileStream()
+ {
+ }
+
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **object);
+ ULONG STDMETHODCALLTYPE AddRef();
+ ULONG STDMETHODCALLTYPE Release();
+
+ HRESULT STDMETHODCALLTYPE ReadFileFragment(const void **fragmentStart, UINT64 fileOffset,
+ UINT64 fragmentSize, OUT void **fragmentContext);
+ void STDMETHODCALLTYPE ReleaseFileFragment(void *fragmentContext);
+ HRESULT STDMETHODCALLTYPE GetFileSize(OUT UINT64 *fileSize);
+ HRESULT STDMETHODCALLTYPE GetLastWriteTime(OUT UINT64 *lastWriteTime);
+
+ private:
+ QByteArray m_fontData;
+ ULONG m_referenceCount;
+ };
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::QueryInterface(REFIID iid, void **object)
+ {
+ if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileStream)) {
+ *object = this;
+ AddRef();
+ return S_OK;
+ } else {
+ *object = NULL;
+ return E_NOINTERFACE;
+ }
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileStream::AddRef()
+ {
+ return InterlockedIncrement(&m_referenceCount);
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileStream::Release()
+ {
+ ULONG newCount = InterlockedDecrement(&m_referenceCount);
+ if (newCount == 0)
+ delete this;
+ return newCount;
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::ReadFileFragment(
+ const void **fragmentStart,
+ UINT64 fileOffset,
+ UINT64 fragmentSize,
+ OUT void **fragmentContext)
+ {
+ *fragmentContext = NULL;
+ if (fragmentSize + fileOffset <= m_fontData.size()) {
+ *fragmentStart = m_fontData.data() + fileOffset;
+ return S_OK;
+ } else {
+ *fragmentStart = NULL;
+ return E_FAIL;
+ }
+ }
+
+ void STDMETHODCALLTYPE DirectWriteFontFileStream::ReleaseFileFragment(void *)
+ {
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::GetFileSize(UINT64 *fileSize)
+ {
+ *fileSize = m_fontData.size();
+ return S_OK;
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileStream::GetLastWriteTime(UINT64 *lastWriteTime)
+ {
+ *lastWriteTime = 0;
+ return E_NOTIMPL;
+ }
+
+ class DirectWriteFontFileLoader: public IDWriteFontFileLoader
+ {
+ public:
+ DirectWriteFontFileLoader() : m_referenceCount(0) {}
+
+ ~DirectWriteFontFileLoader()
+ {
+ }
+
+ inline void addKey(const void *key, const QByteArray &fontData)
+ {
+ Q_ASSERT(!m_fontDatas.contains(key));
+ m_fontDatas.insert(key, fontData);
+ }
+
+ inline void removeKey(const void *key)
+ {
+ m_fontDatas.remove(key);
+ }
+
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **object);
+ ULONG STDMETHODCALLTYPE AddRef();
+ ULONG STDMETHODCALLTYPE Release();
+
+ HRESULT STDMETHODCALLTYPE CreateStreamFromKey(void const *fontFileReferenceKey,
+ UINT32 fontFileReferenceKeySize,
+ OUT IDWriteFontFileStream **fontFileStream);
+
+ private:
+ ULONG m_referenceCount;
+ QHash<const void *, QByteArray> m_fontDatas;
+ };
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileLoader::QueryInterface(const IID &iid,
+ void **object)
+ {
+ if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) {
+ *object = this;
+ AddRef();
+ return S_OK;
+ } else {
+ *object = NULL;
+ return E_NOINTERFACE;
+ }
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileLoader::AddRef()
+ {
+ return InterlockedIncrement(&m_referenceCount);
+ }
+
+ ULONG STDMETHODCALLTYPE DirectWriteFontFileLoader::Release()
+ {
+ ULONG newCount = InterlockedDecrement(&m_referenceCount);
+ if (newCount == 0)
+ delete this;
+ return newCount;
+ }
+
+ HRESULT STDMETHODCALLTYPE DirectWriteFontFileLoader::CreateStreamFromKey(
+ void const *fontFileReferenceKey,
+ UINT32 fontFileReferenceKeySize,
+ IDWriteFontFileStream **fontFileStream)
+ {
+ Q_UNUSED(fontFileReferenceKeySize);
+
+ if (fontFileReferenceKeySize != sizeof(const void *)) {
+ qWarning("%s: Wrong key size", __FUNCTION__);
+ return E_FAIL;
+ }
+
+ const void *key = *reinterpret_cast<void * const *>(fontFileReferenceKey);
+ *fontFileStream = NULL;
+ if (!m_fontDatas.contains(key))
+ return E_FAIL;
+
+ QByteArray fontData = m_fontDatas.value(key);
+ DirectWriteFontFileStream *stream = new DirectWriteFontFileStream(fontData);
+ stream->AddRef();
+ *fontFileStream = stream;
+
+ return S_OK;
+ }
+
+ class CustomFontFileLoader
+ {
+ public:
+ CustomFontFileLoader() : m_directWriteFactory(0), m_directWriteFontFileLoader(0)
+ {
+ HRESULT hres = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
+ __uuidof(IDWriteFactory),
+ reinterpret_cast<IUnknown **>(&m_directWriteFactory));
+ if (FAILED(hres)) {
+ qErrnoWarning(hres, "%s: DWriteCreateFactory failed.", __FUNCTION__);
+ } else {
+ m_directWriteFontFileLoader = new DirectWriteFontFileLoader();
+ m_directWriteFactory->RegisterFontFileLoader(m_directWriteFontFileLoader);
+ }
+ }
+
+ ~CustomFontFileLoader()
+ {
+ if (m_directWriteFactory != 0 && m_directWriteFontFileLoader != 0)
+ m_directWriteFactory->UnregisterFontFileLoader(m_directWriteFontFileLoader);
+
+ if (m_directWriteFactory != 0)
+ m_directWriteFactory->Release();
+ }
+
+ void addKey(const void *key, const QByteArray &fontData)
+ {
+ if (m_directWriteFontFileLoader != 0)
+ m_directWriteFontFileLoader->addKey(key, fontData);
+ }
+
+ void removeKey(const void *key)
+ {
+ if (m_directWriteFontFileLoader != 0)
+ m_directWriteFontFileLoader->removeKey(key);
+ }
+
+ IDWriteFontFileLoader *loader() const
+ {
+ return m_directWriteFontFileLoader;
+ }
+
+ private:
+ IDWriteFactory *m_directWriteFactory;
+ DirectWriteFontFileLoader *m_directWriteFontFileLoader;
+ };
+
+#endif
+
+} // Anonymous namespace
+
/*!
\struct QWindowsFontEngineData
\brief Static constant data shared by the font engines.
@@ -536,6 +972,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
const QFont::Weight weight = weightFromInteger(tm->tmWeight);
const QFont::Stretch stretch = QFont::Unstretched;
+#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseFonts > 2) {
QDebug nospace = qDebug().nospace();
nospace << __FUNCTION__ << familyName << scriptName
@@ -550,6 +987,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
<< " Style=" << style << " Weight=" << weight
<< " stretch=" << stretch;
}
+#endif
QString englishName;
if (ttf && localizedName(familyName))
@@ -687,10 +1125,158 @@ QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef,
QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
{
- QFontEngine *fe = QPlatformFontDatabase::fontEngine(fontData, pixelSize, hintingPreference);
+ EmbeddedFont font(fontData);
+ QFontEngine *fontEngine = 0;
+
+#if !defined(QT_NO_DIRECTWRITE)
+ if (hintingPreference == QFont::PreferDefaultHinting
+ || hintingPreference == QFont::PreferFullHinting)
+#endif
+ {
+ GUID guid;
+ CoCreateGuid(&guid);
+
+ QString uniqueFamilyName = QLatin1Char('f')
+ + QString::number(guid.Data1, 36) + QLatin1Char('-')
+ + QString::number(guid.Data2, 36) + QLatin1Char('-')
+ + QString::number(guid.Data3, 36) + QLatin1Char('-')
+ + QString::number(*reinterpret_cast<quint64 *>(guid.Data4), 36);
+
+ QString actualFontName = font.changeFamilyName(uniqueFamilyName);
+ if (actualFontName.isEmpty()) {
+ qWarning("%s: Can't change family name of font", __FUNCTION__);
+ return 0;
+ }
+
+ DWORD count = 0;
+ QByteArray newFontData = font.data();
+ HANDLE fontHandle = AddFontMemResourceEx((void *)newFontData.constData(), newFontData.size(), 0,
+ &count);
+ if (count == 0 && fontHandle != 0) {
+ RemoveFontMemResourceEx(fontHandle);
+ fontHandle = 0;
+ }
+
+ if (fontHandle == 0) {
+ qWarning("%s: AddFontMemResourceEx failed", __FUNCTION__);
+ } else {
+ QFontDef request;
+ request.family = uniqueFamilyName;
+ request.pixelSize = pixelSize;
+ request.styleStrategy = QFont::NoFontMerging | QFont::PreferMatch;
+ request.hintingPreference = hintingPreference;
+
+ fontEngine = QWindowsFontDatabase::createEngine(QUnicodeTables::Common, request, 0,
+ QWindowsContext::instance()->defaultDPI(), false, QStringList(),
+ m_fontEngineData);
+
+ if (fontEngine) {
+ if (request.family != fontEngine->fontDef.family) {
+ qWarning("%s: Failed to load font. Got fallback instead: %s",
+ __FUNCTION__, qPrintable(fontEngine->fontDef.family));
+ if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0)
+ delete fontEngine;
+ fontEngine = 0;
+ } else {
+ Q_ASSERT(fontEngine->cache_count == 0 && fontEngine->ref.load() == 0);
+
+ // Override the generated font name
+ static_cast<QWindowsFontEngine *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
+ fontEngine->fontDef.family = actualFontName;
+ UniqueFontData uniqueData;
+ uniqueData.handle = fontHandle;
+ uniqueData.refCount.ref();
+ m_uniqueFontData[uniqueFamilyName] = uniqueData;
+ }
+ } else {
+ RemoveFontMemResourceEx(fontHandle);
+ }
+ }
+ }
+#if !defined(QT_NO_DIRECTWRITE)
+ else {
+ CustomFontFileLoader fontFileLoader;
+ fontFileLoader.addKey(this, fontData);
+
+ IDWriteFactory *factory = 0;
+ HRESULT hres = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
+ __uuidof(IDWriteFactory),
+ reinterpret_cast<IUnknown **>(&factory));
+ if (FAILED(hres)) {
+ qErrnoWarning(hres, "%s: DWriteCreateFactory failed", __FUNCTION__);
+ return 0;
+ }
+
+ IDWriteFontFile *fontFile = 0;
+ void *key = this;
+
+ hres = factory->CreateCustomFontFileReference(&key, sizeof(void *),
+ fontFileLoader.loader(), &fontFile);
+ if (FAILED(hres)) {
+ qErrnoWarning(hres, "%s: CreateCustomFontFileReference failed", __FUNCTION__);
+ factory->Release();
+ return 0;
+ }
+
+ BOOL isSupportedFontType;
+ DWRITE_FONT_FILE_TYPE fontFileType;
+ DWRITE_FONT_FACE_TYPE fontFaceType;
+ UINT32 numberOfFaces;
+ fontFile->Analyze(&isSupportedFontType, &fontFileType, &fontFaceType, &numberOfFaces);
+ if (!isSupportedFontType) {
+ fontFile->Release();
+ factory->Release();
+ return 0;
+ }
+
+ IDWriteFontFace *directWriteFontFace = 0;
+ hres = factory->CreateFontFace(fontFaceType, 1, &fontFile, 0, DWRITE_FONT_SIMULATIONS_NONE,
+ &directWriteFontFace);
+ if (FAILED(hres)) {
+ qErrnoWarning(hres, "%s: CreateFontFace failed", __FUNCTION__);
+ fontFile->Release();
+ factory->Release();
+ return 0;
+ }
+
+ fontFile->Release();
+
+ fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace, pixelSize,
+ m_fontEngineData);
+
+ // Get font family from font data
+ fontEngine->fontDef.family = font.familyName();
+
+ directWriteFontFace->Release();
+ factory->Release();
+ }
+#endif
+
+ // Get style and weight info
+ if (fontEngine != 0) {
+ TableDirectory *os2TableEntry = font.tableDirectoryEntry("OS/2");
+ if (os2TableEntry != 0) {
+ const OS2Table *os2Table =
+ reinterpret_cast<const OS2Table *>(fontData.constData()
+ + qFromBigEndian<quint32>(os2TableEntry->offset));
+
+ bool italic = qFromBigEndian<quint16>(os2Table->selection) & 1;
+ bool oblique = qFromBigEndian<quint16>(os2Table->selection) & 128;
+
+ if (italic)
+ fontEngine->fontDef.style = QFont::StyleItalic;
+ else if (oblique)
+ fontEngine->fontDef.style = QFont::StyleOblique;
+ else
+ fontEngine->fontDef.style = QFont::StyleNormal;
+
+ fontEngine->fontDef.weight = weightFromInteger(qFromBigEndian<quint16>(os2Table->weightClass));
+ }
+ }
+
if (QWindowsContext::verboseFonts)
- qDebug() << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fe;
- return fe;
+ qDebug() << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fontEngine;
+ return fontEngine;
}
QStringList QWindowsFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const
@@ -905,6 +1491,22 @@ bool QWindowsFontDatabase::fontsAlwaysScalable() const
return true;
}
+void QWindowsFontDatabase::derefUniqueFont(const QString &uniqueFont)
+{
+ if (m_uniqueFontData.contains(uniqueFont)) {
+ if (!m_uniqueFontData[uniqueFont].refCount.deref()) {
+ RemoveFontMemResourceEx(m_uniqueFontData[uniqueFont].handle);
+ m_uniqueFontData.remove(uniqueFont);
+ }
+ }
+}
+
+void QWindowsFontDatabase::refUniqueFont(const QString &uniqueFont)
+{
+ if (m_uniqueFontData.contains(uniqueFont))
+ m_uniqueFontData[uniqueFont].refCount.ref();
+}
+
HFONT QWindowsFontDatabase::systemFont()
{
static const HFONT stock_sysfont = (HFONT)GetStockObject(SYSTEM_FONT);
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h
index 3921992775..f442f492aa 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.h
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h
@@ -87,6 +87,8 @@ public:
virtual QFont defaultFont() const { return systemDefaultFont(); }
virtual bool fontsAlwaysScalable() const;
+ void derefUniqueFont(const QString &uniqueFont);
+ void refUniqueFont(const QString &uniqueFont);
static QFont systemDefaultFont();
@@ -112,6 +114,13 @@ private:
};
QList<WinApplicationFont> m_applicationFonts;
+
+ struct UniqueFontData {
+ HANDLE handle;
+ QAtomicInt refCount;
+ };
+
+ QMap<QString, UniqueFontData> m_uniqueFontData;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index 246b5b3710..42d30f1833 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -144,6 +144,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
const QFont::Weight weight = weightFromInteger(tm->tmWeight);
const QFont::Stretch stretch = QFont::Unstretched;
+#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseFonts > 2) {
QDebug nospace = qDebug().nospace();
nospace << __FUNCTION__ << faceName << fullName << scriptName
@@ -158,6 +159,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
<< " Style=" << style << " Weight=" << weight
<< " stretch=" << stretch;
}
+#endif
QString englishName;
if (ttf && localizedName(faceName))
@@ -324,7 +326,7 @@ QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, QUnico
QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
{
- QFontEngine *fe = QPlatformFontDatabase::fontEngine(fontData, pixelSize, hintingPreference);
+ QFontEngine *fe = QBasicFontDatabase::fontEngine(fontData, pixelSize, hintingPreference);
if (QWindowsContext::verboseFonts)
qDebug() << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fe;
return fe;
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index 94072622eb..f4bd3f0c53 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -44,6 +44,7 @@
#define _WIN32_WINNT 0x0500
#endif
+#include "qwindowsintegration.h"
#include "qwindowsfontengine.h"
#include "qwindowsnativeimage.h"
#include "qwindowscontext.h"
@@ -319,6 +320,11 @@ QWindowsFontEngine::~QWindowsFontEngine()
if (QWindowsContext::verboseFonts)
if (QWindowsContext::verboseFonts)
qDebug("%s: font='%s", __FUNCTION__, qPrintable(_name));
+
+ if (!uniqueFamilyName.isEmpty()) {
+ QPlatformFontDatabase *pfdb = QWindowsIntegration::instance()->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->derefUniqueFont(uniqueFamilyName);
+ }
}
HGDIOBJ QWindowsFontEngine::selectDesignFont() const
@@ -1133,14 +1139,23 @@ QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const
if (!uniqueFamilyName.isEmpty())
request.family = uniqueFamilyName;
request.pixelSize = pixelSize;
+ // Disable font merging, as otherwise createEngine will return a multi-engine
+ // instance instead of the specific engine we wish to clone.
+ request.styleStrategy |= QFont::NoFontMerging;
QFontEngine *fontEngine =
QWindowsFontDatabase::createEngine(QUnicodeTables::Common, request, 0,
QWindowsContext::instance()->defaultDPI(),
false,
QStringList(), m_fontEngineData);
- if (fontEngine)
+ if (fontEngine) {
fontEngine->fontDef.family = actualFontName;
+ if (!uniqueFamilyName.isEmpty()) {
+ static_cast<QWindowsFontEngine *>(fontEngine)->setUniqueFamilyName(uniqueFamilyName);
+ QPlatformFontDatabase *pfdb = QWindowsIntegration::instance()->fontDatabase();
+ static_cast<QWindowsFontDatabase *>(pfdb)->refUniqueFont(uniqueFamilyName);
+ }
+ }
return fontEngine;
}
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h
index f8ebc896f2..c869095769 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.h
+++ b/src/plugins/platforms/windows/qwindowsfontengine.h
@@ -128,13 +128,9 @@ public:
bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const;
- static QFontEngine *createEngine(int script, const QFontDef &request,
- HDC fontHdc, int dpi, bool rawMode,
- const QStringList &family_list,
- const QSharedPointer<QWindowsFontEngineData> &data);
-
QSharedPointer<QWindowsFontEngineData> fontEngineData() const { return m_fontEngineData; }
LOGFONT logfont() const { return m_logfont; }
+ void setUniqueFamilyName(const QString &newName) { uniqueFamilyName = newName; }
private:
QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 098f15f0f0..f16a0ca73d 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -470,6 +470,7 @@ static int choosePixelFormat(HDC hdc,
pixelFormat = 0;
}
+#ifndef QT_NO_DEBUG_OUTPUT
if (QWindowsContext::verboseGL) {
QDebug nsp = qDebug().nospace();
nsp << __FUNCTION__;
@@ -481,6 +482,7 @@ static int choosePixelFormat(HDC hdc,
nsp << noshowbase << dec << "\n obtained px #" << pixelFormat
<< " of " << numFormats << "\n " << *obtainedPfd;
} // Debug
+#endif
return pixelFormat;
}
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h
index 5aac636f83..a0489e2d02 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.h
+++ b/src/plugins/platforms/windows/qwindowsglcontext.h
@@ -152,6 +152,7 @@ public:
explicit QWindowsGLContext(const QOpenGLStaticContextPtr &staticContext,
QOpenGLContext *context);
virtual ~QWindowsGLContext();
+ bool isSharing() const { return m_context->shareHandle(); }
bool isValid() const { return m_renderingContext; }
virtual QSurfaceFormat format() const { return m_obtainedFormat; }
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index d8d04fc1b6..45f6ecf652 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -56,7 +56,9 @@
#include "qwindowsdrag.h"
#include "qwindowsinputcontext.h"
#include "qwindowskeymapper.h"
+#ifndef QT_NO_ACCESSIBILITY
#include "accessible/qwindowsaccessibility.h"
+#endif
#include <QtGui/QPlatformNativeInterface>
#include <QtGui/QWindowSystemInterface>
@@ -182,7 +184,9 @@ struct QWindowsIntegrationPrivate
QWindowsGuiEventDispatcher *m_eventDispatcher;
QOpenGLStaticContextPtr m_staticOpenGLContext;
QWindowsInputContext m_inputContext;
+#ifndef QT_NO_ACCESSIBILITY
QWindowsAccessibility m_accessibility;
+#endif
QWindowsServices m_services;
};
@@ -281,7 +285,6 @@ QPlatformOpenGLContext
* QML2 applications. */
enum FontDatabaseOption {
- FontDatabaseAuto,
FontDatabaseFreeType,
FontDatabaseNative
};
@@ -296,7 +299,7 @@ static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterfa
if (argument == QLatin1String("native"))
return FontDatabaseNative;
}
- return FontDatabaseAuto;
+ return FontDatabaseNative;
}
QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
@@ -306,10 +309,6 @@ QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
d->m_fontDatabase = new QWindowsFontDatabase();
#else
FontDatabaseOption option = fontDatabaseOption(d->m_nativeInterface);
- if (option == FontDatabaseAuto) {
- option = QCoreApplication::applicationName() == QStringLiteral("QtQmlViewer") ?
- FontDatabaseFreeType : FontDatabaseNative;
- }
if (option == FontDatabaseFreeType) {
d->m_fontDatabase = new QWindowsFontDatabaseFT;
} else {
@@ -374,10 +373,12 @@ QPlatformInputContext * QWindowsIntegration::inputContext() const
return &d->m_inputContext;
}
+#ifndef QT_NO_ACCESSIBILITY
QPlatformAccessibility *QWindowsIntegration::accessibility() const
{
return &d->m_accessibility;
}
+#endif
QWindowsIntegration *QWindowsIntegration::instance()
{
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 20fd790bfe..84bbf6103a 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -66,7 +66,9 @@ public:
virtual QPlatformClipboard *clipboard() const;
virtual QPlatformDrag *drag() const;
virtual QPlatformInputContext *inputContext() const;
+#ifndef QT_NO_ACCESSIBILITY
virtual QPlatformAccessibility *accessibility() const;
+#endif
virtual QPlatformNativeInterface *nativeInterface() const;
virtual QPlatformFontDatabase *fontDatabase() const;
virtual QStringList themeNames() const;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 38a44e2b5a..87980487b7 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -338,9 +338,9 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
} else {
style |= WS_THICKFRAME;
}
+ if (flags & Qt::WindowTitleHint)
+ style |= WS_CAPTION; // Contains WS_DLGFRAME
}
- if (flags & Qt::WindowTitleHint)
- style |= WS_CAPTION;
if (flags & Qt::WindowSystemMenuHint)
style |= WS_SYSMENU;
if (flags & Qt::WindowMinimizeButtonHint)
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index 87bc7245c4..63275d3402 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -149,6 +149,7 @@ contains(QT_CONFIG, freetype) {
OTHER_FILES += windows.json
-include(accessible/accessible.pri)
+contains(QT_CONFIG, accessibility):include(accessible/accessible.pri)
+
target.path += $$[QT_INSTALL_PLUGINS]/platforms
INSTALLS += target
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index fc320ee69c..cc00d0845e 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -231,6 +231,7 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
return 0;
#endif
#else
+ Q_UNUSED(context)
return 0;
#endif
}
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 6996c87f3f..ffce2f3956 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1188,7 +1188,7 @@ void QXcbWindow::requestActivateWindow()
}
#if XCB_USE_MAEMO_WINDOW_PROPERTIES
-void QXcbWindow::setOrientation(Qt::ScreenOrientation orientation)
+void QXcbWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
{
int angle = 0;
switch (orientation) {
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index c8999de83d..523dd559c1 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -95,7 +95,7 @@ public:
void requestActivateWindow();
#if XCB_USE_MAEMO_WINDOW_PROPERTIES
- void setOrientation(Qt::ScreenOrientation orientation);
+ void handleContentOrientationChange(Qt::ScreenOrientation orientation);
#endif
bool setKeyboardGrabEnabled(bool grab);