diff options
Diffstat (limited to 'src/plugins')
28 files changed, 234 insertions, 213 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 184ceb4..7f3501e 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -726,6 +726,7 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) if(servicePath.isEmpty()) { id = QString::number(qHash(networkPath)); + serv = 0; } else { id = QString::number(qHash(servicePath)); serv = new QConnmanServiceInterface(servicePath,this); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index b66298e..98b3663 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -216,7 +216,6 @@ void QConnmanManagerInterface::registerCounter(const QString &path, quint32 inte { QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("RegisterCounter"), QVariant::fromValue(path), QVariant::fromValue(interval)); - bool ok = true; if(reply.error().type() == QDBusError::InvalidArgs) { qWarning() << reply.error().message(); } @@ -225,7 +224,6 @@ void QConnmanManagerInterface::registerCounter(const QString &path, quint32 inte void QConnmanManagerInterface::unregisterCounter(const QString &path) { QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("UnregisterCounter"), QVariant::fromValue(path)); - bool ok = true; if(reply.error().type() == QDBusError::InvalidArgs) { qWarning() << reply.error().message(); } diff --git a/src/plugins/bearer/icd/proxyconf.cpp b/src/plugins/bearer/icd/proxyconf.cpp index e5c8f4e..efe2da7 100644 --- a/src/plugins/bearer/icd/proxyconf.cpp +++ b/src/plugins/bearer/icd/proxyconf.cpp @@ -142,16 +142,23 @@ QHash<QString,QVariant> GConfItemFast::getEntries() const -class NetworkProxyFactory : QNetworkProxyFactory { +class NetworkProxyFactory : QNetworkProxyFactory +{ + ProxyConf proxy_conf; + bool proxy_data_read; + public: - NetworkProxyFactory() { } + NetworkProxyFactory() : proxy_data_read(false) { } QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()); }; QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &query) { - ProxyConf proxy_conf; + if (proxy_data_read == false) { + proxy_data_read = true; + proxy_conf.readProxyData(); + } QList<QNetworkProxy> result = proxy_conf.flush(query); if (result.isEmpty()) @@ -299,12 +306,12 @@ QList<QNetworkProxy> ProxyConfPrivate::flush(const QNetworkProxyQuery &query) if (isHostExcluded(query.peerHostName())) return result; // no proxy for this host - if (mode == "auto") { + if (mode == QLatin1String("AUTO")) { // TODO: pac currently not supported, fix me return result; } - if (mode == "manual") { + if (mode == QLatin1String("MANUAL")) { bool isHttps = false; QString protocol = query.protocolTag().toLower(); @@ -377,10 +384,13 @@ ProxyConf::~ProxyConf() delete d_ptr; } +void ProxyConf::readProxyData() +{ + d_ptr->readProxyData(); +} QList<QNetworkProxy> ProxyConf::flush(const QNetworkProxyQuery &query) { - d_ptr->readProxyData(); return d_ptr->flush(query); } diff --git a/src/plugins/bearer/icd/proxyconf.h b/src/plugins/bearer/icd/proxyconf.h index 884cc5c..eedbbf2 100644 --- a/src/plugins/bearer/icd/proxyconf.h +++ b/src/plugins/bearer/icd/proxyconf.h @@ -58,6 +58,7 @@ public: virtual ~ProxyConf(); QList<QNetworkProxy> flush(const QNetworkProxyQuery &query = QNetworkProxyQuery()); // read the proxies from db + void readProxyData(); /* Note that for each update() call there should be corresponding * clear() call because the ProxyConf class implements a reference diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index 68343cf..0968e71 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -138,4 +138,4 @@ enum NDIS_PHYSICAL_MEDIUM { QT_END_NAMESPACE -#endif +#endif // QPLATFORMDEFS_WIN_H diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 6c30d0f..2325bd0 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -60,8 +60,8 @@ public: DisconnectionError, }; - QBearerEngineImpl(QObject *parent = 0) : QBearerEngine(parent) { } - ~QBearerEngineImpl() { } + QBearerEngineImpl(QObject *parent = 0) : QBearerEngine(parent) {} + ~QBearerEngineImpl() {} virtual void connectToId(const QString &id) = 0; virtual void disconnectFromId(const QString &id) = 0; @@ -81,4 +81,5 @@ Q_SIGNALS: QT_END_NAMESPACE #endif // QT_NO_BEARERMANAGEMENT -#endif + +#endif // QBEARERENGINE_IMPL_H diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index ef5f347..27e14b1 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -45,9 +45,10 @@ #include <QtNetwork/qnetworksession.h> #include <QtNetwork/private/qnetworkconfigmanager_p.h> -#include <QtCore/qstringlist.h> +#include <QtCore/qdatetime.h> #include <QtCore/qdebug.h> #include <QtCore/qmutex.h> +#include <QtCore/qstringlist.h> #ifndef QT_NO_BEARERMANAGEMENT @@ -71,10 +72,11 @@ class QNetworkSessionManagerPrivate : public QObject Q_OBJECT public: - QNetworkSessionManagerPrivate(QObject *parent = 0); - ~QNetworkSessionManagerPrivate(); + QNetworkSessionManagerPrivate(QObject *parent = 0) : QObject(parent) {} + ~QNetworkSessionManagerPrivate() {} - void forceSessionClose(const QNetworkConfiguration &config); + inline void forceSessionClose(const QNetworkConfiguration &config) + { emit forcedSessionClose(config); } Q_SIGNALS: void forcedSessionClose(const QNetworkConfiguration &config); @@ -84,20 +86,6 @@ Q_SIGNALS: Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); -QNetworkSessionManagerPrivate::QNetworkSessionManagerPrivate(QObject *parent) -: QObject(parent) -{ -} - -QNetworkSessionManagerPrivate::~QNetworkSessionManagerPrivate() -{ -} - -void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguration &config) -{ - emit forcedSessionClose(config); -} - void QNetworkSessionPrivateImpl::syncStateWithInterface() { connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), @@ -108,8 +96,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; - qRegisterMetaType<QBearerEngineImpl::ConnectionError> - ("QBearerEngineImpl::ConnectionError"); + qRegisterMetaType<QBearerEngineImpl::ConnectionError>("QBearerEngineImpl::ConnectionError"); switch (publicConfig.type()) { case QNetworkConfiguration::InternetAccessPoint: @@ -145,9 +132,8 @@ void QNetworkSessionPrivateImpl::open() lastError = QNetworkSession::OperationNotSupportedError; emit QNetworkSessionPrivate::error(lastError); } else if (!isOpen) { - if ((activeConfig.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - lastError =QNetworkSession::InvalidConfigurationError; + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) { + lastError = QNetworkSession::InvalidConfigurationError; state = QNetworkSession::Invalid; emit stateChanged(state); emit QNetworkSessionPrivate::error(lastError); @@ -221,11 +207,10 @@ void QNetworkSessionPrivateImpl::reject() #ifndef QT_NO_NETWORKINTERFACE QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const { - if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) + if (!engine || state != QNetworkSession::Connected || !publicConfig.isValid()) return QNetworkInterface(); QString interface = engine->getInterfaceFromId(activeConfig.identifier()); - if (interface.isEmpty()) return QNetworkInterface(); return QNetworkInterface::interfaceFromName(interface); @@ -237,10 +222,7 @@ QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString &key) const if (key == QLatin1String("AutoCloseSessionTimeout")) { if (engine && engine->requiresPolling() && !(engine->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces)) { - if (sessionTimeout >= 0) - return sessionTimeout * 10000; - else - return -1; + return sessionTimeout >= 0 ? sessionTimeout * 10000 : -1; } } @@ -278,7 +260,8 @@ QString QNetworkSessionPrivateImpl::errorString() const return tr("The specified configuration cannot be used."); case QNetworkSession::RoamingError: return tr("Roaming was aborted or is not possible."); - + default: + break; } return QString(); @@ -293,24 +276,21 @@ quint64 QNetworkSessionPrivateImpl::bytesWritten() const { if (engine && state == QNetworkSession::Connected) return engine->bytesWritten(activeConfig.identifier()); - else - return Q_UINT64_C(0); + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::bytesReceived() const { if (engine && state == QNetworkSession::Connected) return engine->bytesReceived(activeConfig.identifier()); - else - return Q_UINT64_C(0); + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::activeTime() const { if (state == QNetworkSession::Connected && startTime != Q_UINT64_C(0)) return QDateTime::currentDateTime().toTime_t() - startTime; - else - return Q_UINT64_C(0); + return Q_UINT64_C(0); } void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() @@ -323,17 +303,15 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() if (activeConfig != config) { if (engine) { - disconnect(engine, - SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), - this, - SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError))); + disconnect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError))); } activeConfig = config; engine = getEngineFromId(activeConfig.identifier()); + if (engine) { - connect(engine, - SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)), Qt::QueuedConnection); } @@ -362,7 +340,6 @@ void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() return; QNetworkSession::State oldState = state; - state = engine->sessionStateForId(activeConfig.identifier()); bool oldActive = isOpen; @@ -410,8 +387,7 @@ void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration } } -void QNetworkSessionPrivateImpl::connectionError(const QString &id, - QBearerEngineImpl::ConnectionError error) +void QNetworkSessionPrivateImpl::connectionError(const QString &id, QBearerEngineImpl::ConnectionError error) { if (activeConfig.identifier() == id) { networkConfigurationsChanged(); @@ -443,4 +419,3 @@ void QNetworkSessionPrivateImpl::decrementTimeout() QT_END_NAMESPACE #endif // QT_NO_BEARERMANAGEMENT - diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index a4902eb..d8f4803 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -58,8 +58,6 @@ #include <QtNetwork/private/qnetworkconfigmanager_p.h> #include <QtNetwork/private/qnetworksession_p.h> -#include <QtCore/qdatetime.h> - #ifndef QT_NO_BEARERMANAGEMENT QT_BEGIN_NAMESPACE @@ -69,15 +67,13 @@ class QBearerEngineImpl; class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { Q_OBJECT + public: QNetworkSessionPrivateImpl() - : startTime(0), sessionTimeout(-1) - { - } - + : startTime(0), sessionTimeout(-1) + {} ~QNetworkSessionPrivateImpl() - { - } + {} //called by QNetworkSession constructor and ensures //that the state is immediately updated (w/o actually opening @@ -106,10 +102,6 @@ public: quint64 bytesReceived() const; quint64 activeTime() const; -private: - void updateStateFromServiceNetwork(); - void updateStateFromActiveConfig(); - private Q_SLOTS: void networkConfigurationsChanged(); void configurationChanged(QNetworkConfigurationPrivatePointer config); @@ -118,6 +110,10 @@ private Q_SLOTS: void decrementTimeout(); private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +private: QBearerEngineImpl *engine; quint64 startTime; @@ -133,5 +129,4 @@ QT_END_NAMESPACE #endif // QT_NO_BEARERMANAGEMENT -#endif //QNETWORKSESSION_IMPL_H - +#endif // QNETWORKSESSION_IMPL_H diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp index 1a2e3fa..ca303a8 100644 --- a/src/plugins/graphicssystems/meego/dithering.cpp +++ b/src/plugins/graphicssystems/meego/dithering.cpp @@ -154,7 +154,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h // Add the diffusion for this pixel we stored in the accumulator. // >> 7 because the values in accumulator are stored * 128 - component[c] += accumulator[c][x] >> 7; + if (x != 0 && x != (width - 1)) { + if (accumulator[c][x] >> 7 != 0) + component[c] += rand() % accumulator[c][x] >> 7; + } // Make sure we're not over the boundaries. CLAMP_256(component[c]); @@ -172,10 +175,10 @@ unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int h // Distribute the difference according to the matrix in the // accumulation bufffer. - ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7); - ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3); + ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 3); + ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 5); ACCUMULATE(accumulator[c], x, 1, width, diff * 5); - ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1); + ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 3); } // Write the newly produced pixel diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 507f70b..4a86082 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -124,8 +124,10 @@ QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd) void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/) { - if (QMeeGoGraphicsSystem::surfaceWasCreated) + if (QMeeGoGraphicsSystem::surfaceWasCreated) { qWarning("Trying to set surface fixed size but surface already created!"); + return; + } #ifdef QT_WAS_PATCHED QEglProperties *properties = new QEglProperties(); @@ -143,6 +145,11 @@ void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height void QMeeGoGraphicsSystem::setTranslucent(bool translucent) { + if (QMeeGoGraphicsSystem::surfaceWasCreated) { + qWarning("Trying to set translucency but surface already created!"); + return; + } + QGLWindowSurface::surfaceFormat.setSampleBuffers(false); QGLWindowSurface::surfaceFormat.setSamples(0); QGLWindowSurface::surfaceFormat.setAlpha(translucent); diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h index 8c21944..87998e3 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h @@ -46,29 +46,20 @@ #include <QPlatformEventLoopIntegration> -@interface OurApplication: NSApplication -{ - bool shouldKeepRunning; -} - -- (void) run; -- (void) processEvents: (int) msec; - -@end class QCocoaEventLoopIntegration : public QPlatformEventLoopIntegration { public: QCocoaEventLoopIntegration(); - void processEvents( qint64 msec ); - void wakeup(); + void startEventLoop(); + void quitEventLoop(); + void qtNeedsToProcessEvents(); - static int wakeupEventId; private: - OurApplication *app; + CFRunLoopSourceContext m_sourceContext; + CFRunLoopTimerContext m_timerContext; + CFRunLoopSourceRef m_source; }; - - #endif // QCOCAEVENTLOOPINTEGRATION_H diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm index b184f90..844751c 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm @@ -48,81 +48,65 @@ #include <QtCore/QElapsedTimer> #include <QDebug> +#include <QApplication> -@implementation OurApplication - -- (void) run -{ - QCocoaAutoReleasePool pool; - [self finishLaunching]; - - shouldKeepRunning = YES; +void wakeupCallback ( void * ) { + QPlatformEventLoopIntegration::processEvents(); } -- (void) processEvents : (int) msec +void timerCallback( CFRunLoopTimerRef timer, void *info) { - QCocoaAutoReleasePool pool; - Q_UNUSED(pool); - - QElapsedTimer timer; - timer.start(); - - NSTimeInterval seconds = NSTimeInterval(msec)/1000; - id untilDate = [NSDate dateWithTimeIntervalSinceNow:seconds]; - bool continueLooping = true; - while ((timer.elapsed() < (msec-1)) && continueLooping) { - NSEvent *event = - [self nextEventMatchingMask:NSAnyEventMask - untilDate:untilDate - inMode:NSDefaultRunLoopMode - dequeue:YES]; - if ([event type] == NSApplicationDefined - && [event subtype] == QCocoaEventLoopIntegration::wakeupEventId) { - continueLooping = false; - } else { - [self sendEvent:event]; - } - - } - [self updateWindows]; + QPlatformEventLoopIntegration::processEvents(); + QCocoaEventLoopIntegration *eventLoopIntegration = + static_cast<QCocoaEventLoopIntegration *>(info); + qint64 nextTime = eventLoopIntegration->nextTimerEvent(); + CFAbsoluteTime nexttime = CFAbsoluteTimeGetCurrent(); + nexttime = nexttime + (double(nextTime)/1000); + CFRunLoopTimerSetNextFireDate(timer,nexttime); } -@end - -int QCocoaEventLoopIntegration::wakeupEventId = SHRT_MAX; - QCocoaEventLoopIntegration::QCocoaEventLoopIntegration() : QPlatformEventLoopIntegration() { - app = (OurApplication *)[OurApplication sharedApplication]; - [app run]; + [NSApplication sharedApplication]; + m_sourceContext.version = 0; + m_sourceContext.info = this; + m_sourceContext.retain = 0; + m_sourceContext.release = 0; + m_sourceContext.copyDescription = 0; + m_sourceContext.equal = 0; + m_sourceContext.hash = 0; + m_sourceContext.schedule = 0; + m_sourceContext.cancel = 0; + m_sourceContext.perform = wakeupCallback; + + m_source = CFRunLoopSourceCreate(0,0,&m_sourceContext); + CFRunLoopAddSource(CFRunLoopGetMain(),m_source,kCFRunLoopCommonModes); + + m_timerContext.version = 0; + m_timerContext.info = this; + m_timerContext.retain = 0; + m_timerContext.release = 0; + m_timerContext.copyDescription = 0; + CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent (); + CFTimeInterval interval = 30; + + CFRunLoopTimerRef m_timerSource = CFRunLoopTimerCreate(0,fireDate,interval,0,0,timerCallback,&m_timerContext); + CFRunLoopAddTimer(CFRunLoopGetMain(),m_timerSource,kCFRunLoopCommonModes); } -void QCocoaEventLoopIntegration::processEvents(qint64 msec) +void QCocoaEventLoopIntegration::startEventLoop() { - [app processEvents:msec]; + [[NSApplication sharedApplication] run]; } -void QCocoaEventLoopIntegration::wakeup() +void QCocoaEventLoopIntegration::quitEventLoop() { - QCocoaAutoReleasePool pool; - Q_UNUSED(pool); - - NSPoint p = NSMakePoint(0,0); - NSWindow *nswin = [app keyWindow]; - double timestamp = (double)(AbsoluteToDuration(UpTime())) / 1000.0; - NSEvent *event = [NSEvent - otherEventWithType:NSApplicationDefined - location:NSZeroPoint - modifierFlags:0 - timestamp: timestamp - windowNumber:[nswin windowNumber] - context:0 - subtype:QCocoaEventLoopIntegration::wakeupEventId - data1:0 - data2:0 - ]; - [app postEvent:event atStart:NO]; + [[NSApplication sharedApplication] terminate:nil]; +} +void QCocoaEventLoopIntegration::qtNeedsToProcessEvents() +{ + CFRunLoopSourceSignal(m_source); } diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 79d5f51..28e894c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -79,7 +79,7 @@ QCocoaIntegration::QCocoaIntegration() mPool = new QCocoaAutoReleasePool; //Make sure we have a nsapplication :) - [OurApplication sharedApplication]; + [NSApplication sharedApplication]; // [[OurApplication alloc] init]; NSArray *screens = [NSScreen screens]; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f004cb8..4e233ee 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -106,11 +106,5 @@ void QCocoaWindow::windowDidResize() //jlind: XXX This isn't ideal. Eventdispatcher does not run when resizing... NSRect rect = [[m_nsWindow contentView]frame]; QRect geo(rect.origin.x,rect.origin.y,rect.size.width,rect.size.height); - if (geometry() != geo) { - widget()->setGeometry(geo); - QResizeEvent e(geo.size(), geometry().size()); - setGeometry(geo); - QApplication::sendEvent(widget(), &e); - widget()->repaint(); - } + QWindowSystemInterface::handleGeometryChange(widget(),geo); } diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index ae3b539..4b83a22 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -88,6 +88,7 @@ QEGLPlatformContext::~QEGLPlatformContext() void QEGLPlatformContext::makeCurrent() { + QPlatformGLContext::makeCurrent(); #ifdef QEGL_EXTRA_DEBUG qWarning("QEglContext::makeCurrent: %p\n",this); #endif @@ -117,6 +118,7 @@ void QEGLPlatformContext::makeCurrent() } void QEGLPlatformContext::doneCurrent() { + QPlatformGLContext::doneCurrent(); #ifdef QEGL_EXTRA_DEBUG qWarning("QEglContext::doneCurrent:%p\n",this); #endif @@ -144,7 +146,7 @@ void* QEGLPlatformContext::getProcAddress(const QString& procName) return (void *)eglGetProcAddress(qPrintable(procName)); } -void QEGLPlatformContext::makeDefaultSaredContext() +void QEGLPlatformContext::makeDefaultSharedContext() { setDefaultSharedContext(this); } diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h index ae1a891..ac53559 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h @@ -56,7 +56,7 @@ public: void swapBuffers(); void* getProcAddress(const QString& procName); - void makeDefaultSaredContext(); + void makeDefaultSharedContext(); QPlatformWindowFormat platformWindowFormat() const; private: diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 9a40b86..db90ff2 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -87,7 +87,10 @@ static struct AttrInfo attrs[] = { #endif //QEGL_EXTRA_DEBUG QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) - : m_depth(32), m_format(QImage::Format_ARGB32_Premultiplied), m_platformContext(0) + : m_depth(32) + , m_format(QImage::Format_Invalid) + , m_platformContext(0) + , m_surface(0) { #ifdef QEGL_EXTRA_DEBUG qWarning("QEglScreen %p\n", this); @@ -116,7 +119,25 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) qWarning("Initialized display %d %d\n", major, minor); - QPlatformWindowFormat platformFormat; + int swapInterval = 1; + QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL"); + if (!swapIntervalString.isEmpty()) { + bool ok; + swapInterval = swapIntervalString.toInt(&ok); + if (!ok) + swapInterval = 1; + } + eglSwapInterval(m_dpy, swapInterval); +} + +void QEglFSScreen::createAndSetPlatformContext() const { + const_cast<QEglFSScreen *>(this)->createAndSetPlatformContext(); +} + +void QEglFSScreen::createAndSetPlatformContext() +{ + QPlatformWindowFormat platformFormat = QPlatformWindowFormat::defaultFormat(); + platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH"); @@ -132,23 +153,15 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) platformFormat.setRedBufferSize(8); platformFormat.setGreenBufferSize(8); platformFormat.setBlueBufferSize(8); + m_depth = 32; + m_format = QImage::Format_RGB32; } - if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty()) { platformFormat.setSampleBuffers(true); } - int swapInterval = 1; - QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL"); - if (!swapIntervalString.isEmpty()) { - bool ok; - swapInterval = swapIntervalString.toInt(&ok); - if (!ok) - swapInterval = 1; - } EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); - eglSwapInterval(display, swapInterval); EGLNativeWindowType eglWindow = 0; #ifdef Q_OPENKODE @@ -189,15 +202,44 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) attribList[temp++] = 2; // GLES version 2 attribList[temp++] = EGL_NONE; - m_platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API); - -// qWarning("Created platformcontext"); - EGLint w,h; + QEGLPlatformContext *platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API); + platformContext->makeDefaultSharedContext(); + m_platformContext = platformContext; + EGLint w,h; // screen size detection eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); m_geometry = QRect(0,0,w,h); + +} + +QRect QEglFSScreen::geometry() const +{ + if (m_geometry.isNull()) { + createAndSetPlatformContext(); + } + return m_geometry; +} + +int QEglFSScreen::depth() const +{ + return m_depth; +} + +QImage::Format QEglFSScreen::format() const +{ + if (m_format == QImage::Format_Invalid) + createAndSetPlatformContext(); + return m_format; +} +QPlatformGLContext *QEglFSScreen::platformContext() const +{ + if (!m_platformContext) { + QEglFSScreen *that = const_cast<QEglFSScreen *>(this); + that->createAndSetPlatformContext(); + } + return m_platformContext; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index 9ed1b04..bfbfa62 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -57,13 +57,16 @@ public: QEglFSScreen(EGLNativeDisplayType display); ~QEglFSScreen() {} - QRect geometry() const { return m_geometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } + QRect geometry() const; + int depth() const; + QImage::Format format() const; - QPlatformGLContext *platformContext() const { return m_platformContext; } + QPlatformGLContext *platformContext() const; private: + void createAndSetPlatformContext() const; + void createAndSetPlatformContext(); + QRect m_geometry; int m_depth; QImage::Format m_format; diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp index fcea4d3..ebc04bd 100644 --- a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp @@ -57,13 +57,10 @@ public: #ifdef QEGL_EXTRA_DEBUG qWarning("QEglPaintDevice %p, %p, %p",this, screen, widget); #endif - QGLFormat format; - m_context = new QGLContext(format, widget); - m_context->create(); } QSize size() const { return m_screen->geometry().size(); } - QGLContext* context() const { return m_context;} + QGLContext* context() const { return QGLContext::fromPlatformGLContext(m_screen->platformContext());} QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); } diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp index 4634477..ee520be 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp @@ -278,7 +278,7 @@ QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const } numFaces = face->num_faces; - int weight = QFont::Normal; + QFont::Weight weight = QFont::Normal; QFont::Style style = QFont::StyleNormal; if (face->style_flags & FT_STYLE_FLAG_ITALIC) @@ -315,7 +315,9 @@ QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const fontFile->fileName = file; fontFile->indexValue = index; - registerFont(family,"",weight,style,100,true,true,0,writingSystems,fontFile); + QFont::Stretch stretch = QFont::Unstretched; + + registerFont(family,"",weight,style,stretch,true,true,0,writingSystems,fontFile); families.append(family); diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp index c9d1b74..92f30fc 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -395,7 +395,7 @@ void QFontconfigDatabase::populateFontDatabase() : ((slant_value == FC_SLANT_OBLIQUE) ? QFont::StyleOblique : QFont::StyleNormal); - int weight = getFCWeight(weight_value); + QFont::Weight weight = QFont::Weight(getFCWeight(weight_value)); double pixel_size = 0; if (!scalable) { @@ -404,7 +404,8 @@ void QFontconfigDatabase::populateFontDatabase() FcPatternGetDouble (fonts->fonts[i], FC_PIXEL_SIZE, 0, &pixel_size); } - QPlatformFontDatabase::registerFont(familyName,QLatin1String((const char *)foundry_value),weight,style,100,antialias,scalable,pixel_size,writingSystems,fontFile); + QFont::Stretch stretch = QFont::Unstretched; + QPlatformFontDatabase::registerFont(familyName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,writingSystems,fontFile); // qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size; } @@ -426,10 +427,11 @@ void QFontconfigDatabase::populateFontDatabase() QSupportedWritingSystems ws; ws.setSupported(QFontDatabase::Latin); + while (f->qtname) { - registerFont(f->qtname,"",50,QFont::StyleNormal,100,true,true,0,ws,0); - registerFont(f->qtname,"",50,QFont::StyleItalic,100,true,true,0,ws,0); - registerFont(f->qtname,"",50,QFont::StyleOblique,100,true,true,0,ws,0); + registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,ws,0); + registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,ws,0); + registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,ws,0); ++f; } @@ -444,6 +446,8 @@ void QFontconfigDatabase::populateFontDatabase() QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::Script script, void *usrPtr) { + if (!usrPtr) + return 0; QFontDef fontDef = f; QFontEngineFT *engine; diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp index 73d874c..aefabf0 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp @@ -79,7 +79,7 @@ void kdprocessevent( const KDEvent *event) qDebug() << "KD_EVENT_INPUT_KEY_ATX"; break; case QT_EVENT_WAKEUP_EVENTLOOP: -// qDebug() << "QT_EVENT_WAKEUP_EVENTLOOP"; + QPlatformEventLoopIntegration::processEvents(); break; default: break; @@ -90,25 +90,34 @@ void kdprocessevent( const KDEvent *event) } QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration() + : m_quit(false) { m_kdThread = kdThreadSelf(); kdInstallCallback(&kdprocessevent,QT_EVENT_WAKEUP_EVENTLOOP,this); } -void QOpenKODEEventLoopIntegration::processEvents(qint64 msec) +void QOpenKODEEventLoopIntegration::startEventLoop() { - if (msec == 0) - msec = -1; - const KDEvent *event = kdWaitEvent(msec*1000); - if (event) { - kdDefaultEvent(event); - while ((event = kdWaitEvent(0)) != 0) { + + 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::wakeup() +void QOpenKODEEventLoopIntegration::quitEventLoop() +{ + m_quit = true; +} + +void QOpenKODEEventLoopIntegration::qtNeedsToProcessEvents() { KDEvent *event = kdCreateEvent(); event->type = QT_EVENT_WAKEUP_EVENTLOOP; diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h index 61bd444..73b287f 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h @@ -54,12 +54,14 @@ class QOpenKODEEventLoopIntegration : public QPlatformEventLoopIntegration { public: QOpenKODEEventLoopIntegration(); - void processEvents(qint64 msec); - void wakeup(); + void startEventLoop(); + void quitEventLoop(); + void qtNeedsToProcessEvents(); void processInputEvent(const KDEvent *event); private: + bool m_quit; KDThread *m_kdThread; }; diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 60be897..763e69e 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -207,7 +207,7 @@ QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId) case QPlatformWindowFormat::OpenVG: // returnSurface = new QVGWindowSurface(widget); - break; +// break; default: returnSurface = new QGLWindowSurface(widget); diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 32517c6..01f8d21 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -158,9 +158,9 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) 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); - m_platformGlContext->makeDefaultSaredContext(); + m_platformGlContext->makeDefaultSharedContext(); } else { - m_platformGlContext = static_cast<QEGLPlatformContext *>(QPlatformGLContext::defaultSharedContext()); + m_platformGlContext = const_cast<QEGLPlatformContext *>(static_cast<const QEGLPlatformContext *>(QPlatformGLContext::defaultSharedContext())); kdDestroyWindow(m_kdWindow); m_kdWindow = 0; } @@ -209,7 +209,6 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) //need to recreate context if (needToDeleteContext) { - qDebug() << "deleting context"; delete m_platformGlContext; QList<QPlatformScreen *> screens = QApplicationPrivate::platformIntegration()->screens(); diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index e262d5b..a4b7b69 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -242,7 +242,7 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow , m_context(0) { - QPlatformGLContext *sharePlatformContext; + const QPlatformGLContext *sharePlatformContext; if (format.useDefaultSharedContext()) { if (!QPlatformGLContext::defaultSharedContext()) { if (m_defaultSharedContextMutex.tryLock()){ @@ -259,7 +259,7 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow } GLXContext shareGlxContext = 0; if (sharePlatformContext) - shareGlxContext = static_cast<QGLXGLContext*>(sharePlatformContext)->glxContext(); + shareGlxContext = static_cast<const QGLXGLContext*>(sharePlatformContext)->glxContext(); GLXFBConfig config = findConfig(xd,format); m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); @@ -313,6 +313,7 @@ void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) void QGLXGLContext::makeCurrent() { + QPlatformGLContext::makeCurrent(); #ifdef MYX11_DEBUG qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); #endif @@ -321,6 +322,7 @@ void QGLXGLContext::makeCurrent() void QGLXGLContext::doneCurrent() { + QPlatformGLContext::doneCurrent(); glXMakeCurrent(m_xd->display, 0, 0); } diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 479be4b..e17790e 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -66,7 +66,7 @@ public: virtual void swapBuffers(); virtual void* getProcAddress(const QString& procName); - GLXContext glxContext() {return m_context;} + GLXContext glxContext() const {return m_context;} QPlatformWindowFormat platformWindowFormat() const; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 1de4b9d..b52aae9 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -649,7 +649,6 @@ void QTestLiteWindow::setParent(const QPlatformWindow *window) { QPoint point = widget()->mapTo(widget()->nativeParentWidget(),QPoint()); XReparentWindow(xd->display,x_window,window->winId(),point.x(),point.y()); - XMapWindow(xd->display, x_window); } void QTestLiteWindow::raise() @@ -1022,7 +1021,7 @@ QPlatformGLContext *QTestLiteWindow::glContext() const if (!mGLContext) { QTestLiteWindow *that = const_cast<QTestLiteWindow *>(this); #ifndef QT_NO_OPENGL - that->mGLContext = new QGLXGLContext(x_window, xd, widget()->platformWindowFormat()); + that->mGLContext = new QGLXGLContext(x_window, xd,widget()->platformWindowFormat()); #endif } return mGLContext; |