From 5f71203dd0129de76220f7a3198111a0d2186667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 3 Jan 2013 09:38:10 +0100 Subject: Cocoa: export setDockMenu Change-Id: I1eb35c34427660d2662f310a3e8c4e5ba42e08eb Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoanativeinterface.h | 4 ++++ src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 13 +++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index 34e8fb61e2..592ede4617 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QWidget; class QPlatformPrinterSupport; class QPrintEngine; +class QPlatformMenu; class QCocoaNativeInterface : public QPlatformNativeInterface { @@ -92,6 +93,9 @@ private: static void addToMimeList(void *macPasteboardMime); static void removeFromMimeList(void *macPasteboardMime); static void registerDraggedTypes(const QStringList &types); + + // Dock menu support + static void setDockMenu(QPlatformMenu *platformMenu); }; #endif // QCOCOANATIVEINTERFACE_H diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 08084b5200..14bb82bc7e 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -42,6 +42,7 @@ #include "qcocoanativeinterface.h" #include "qcocoaglcontext.h" #include "qcocoawindow.h" +#include "qcocoamenu.h" #include "qcocoamenubar.h" #include "qmacmime.h" @@ -60,6 +61,8 @@ #include #endif +#include + QT_BEGIN_NAMESPACE QCocoaNativeInterface::QCocoaNativeInterface() @@ -103,6 +106,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter return NativeResourceForIntegrationFunction(QCocoaNativeInterface::removeFromMimeList); if (resource.toLower() == "registerdraggedtypes") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerDraggedTypes); + if (resource.toLower() == "setdockmenu") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setDockMenu); return 0; } @@ -170,4 +175,12 @@ void QCocoaNativeInterface::registerDraggedTypes(const QStringList &types) qt_mac_registerDraggedTypes(types); } +void QCocoaNativeInterface::setDockMenu(QPlatformMenu *platformMenu) +{ + QCocoaMenu *cocoaPlatformMenu = static_cast(platformMenu); + NSMenu *menu = cocoaPlatformMenu->nsMenu(); + // setDockMenu seems to be undocumented, but this is what Qt 4 did. + [NSApp setDockMenu: menu]; +} + QT_END_NAMESPACE -- cgit v1.2.3 From 7bb43454b83ab0f055248b80defe0b985e59ed64 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sun, 27 Jan 2013 12:58:38 +0800 Subject: Fix minor typos in docs, printed messages & comments Missing apostrophes Change-Id: I3ef5e9d494fb7a37f8e6075f24cd3a274e572c23 Reviewed-by: Jerome Pasion --- src/plugins/platforms/cocoa/qmacclipboard.mm | 2 +- src/plugins/platforms/cocoa/qnsview.mm | 2 +- src/plugins/platforms/cocoa/qprintengine_mac.mm | 2 +- src/plugins/platforms/openwfd/qopenwfdport.cpp | 2 +- src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index 6fcf4d5746..95143fd8ea 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -135,7 +135,7 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id, } if (!promise.itemId && flavorAsQString == QLatin1String("com.trolltech.qt.MimeTypeName")) { - // we have promised this data, but wont be able to convert, so return null data. + // we have promised this data, but won't be able to convert, so return null data. // This helps in making the application/x-qt-mime-type-name hidden from normal use. QByteArray ba; QCFType data = CFDataCreate(0, (UInt8*)ba.constData(), ba.size()); diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index b822061feb..da3e6277c6 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1025,7 +1025,7 @@ static QTouchDevice *touchDevice = 0; - (NSUInteger)characterIndexForPoint:(NSPoint)aPoint { - // We dont support cursor movements using mouse while composing. + // We don't support cursor movements using mouse while composing. Q_UNUSED(aPoint); return NSNotFound; } diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index a5382c5ef6..54019372bc 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -109,7 +109,7 @@ bool QMacPrintEngine::end() if (d->state == QPrinter::Aborted) return true; // I was just here a function call ago :) if (d->paintEngine->type() == QPaintEngine::CoreGraphics) { - // We dont need the paint engine to call restoreGraphicsState() + // We don't need the paint engine to call restoreGraphicsState() static_cast(d->paintEngine)->d_func()->stackCount = 0; static_cast(d->paintEngine)->d_func()->hd = 0; } diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp index 72137b91bc..14b499f7cf 100644 --- a/src/plugins/platforms/openwfd/qopenwfdport.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdport.cpp @@ -125,7 +125,7 @@ void QOpenWFDPort::attach() } if (mPipeline == WFD_INVALID_HANDLE) { - qWarning("Failed to create pipeline and cant bind it to port"); + qWarning("Failed to create pipeline and can't bind it to port"); } WFDint geomerty[] = { 0, 0, mPixelSize.width(), mPixelSize.height() }; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 94008bf868..406dc636b8 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -247,7 +247,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, value = fontCache.value(faceName); - //Fallback if we havent cached the font yet or the font got removed/renamed iterate again over all fonts + //Fallback if we haven't cached the font yet or the font got removed/renamed iterate again over all fonts if (value.isEmpty() || !QFile::exists(value)) { QSettings settings(QSettings::SystemScope, QStringLiteral("Qt-Project"), QStringLiteral("Qtbase")); settings.beginGroup(QStringLiteral("CEFontCache")); -- cgit v1.2.3 From e02ecba61f3a271c4f2559c82904c4b8d3b03e61 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 28 Jan 2013 15:48:25 +0000 Subject: Delay initialization of QQnxRootWindow until first access. QtWebProcess, for example, doesn't create any QWindow, so it doesn't need any root window. This fixes Webkit2 rendering on QNX. Change-Id: I1d4c0dd20869798ba2bcd15f9d96e5fca4beb48e Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxrootwindow.cpp | 2 +- src/plugins/platforms/qnx/qqnxrootwindow.h | 4 ++-- src/plugins/platforms/qnx/qqnxscreen.cpp | 30 ++++++++++++++++------------ src/plugins/platforms/qnx/qqnxscreen.h | 8 ++++---- 4 files changed, 24 insertions(+), 20 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp index ee05e00394..b01d468647 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrootwindow.cpp @@ -57,7 +57,7 @@ static const int MAGIC_ZORDER_FOR_NO_NAV = 10; -QQnxRootWindow::QQnxRootWindow(QQnxScreen *screen) +QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) : m_screen(screen), m_window(0), m_windowGroupName() diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.h b/src/plugins/platforms/qnx/qqnxrootwindow.h index f9f1dc0810..aae1563c95 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.h +++ b/src/plugins/platforms/qnx/qqnxrootwindow.h @@ -54,7 +54,7 @@ class QQnxScreen; class QQnxRootWindow { public: - QQnxRootWindow(QQnxScreen *screen); + QQnxRootWindow(const QQnxScreen *screen); ~QQnxRootWindow(); screen_window_t nativeHandle() const { return m_window; } @@ -71,7 +71,7 @@ public: private: void createWindowGroup(); - QQnxScreen *m_screen; + const QQnxScreen *m_screen; screen_window_t m_window; QByteArray m_windowGroupName; }; diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 8b413de4fb..1e58f047ab 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -106,7 +106,6 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen) : m_screenContext(screenContext), m_display(display), - m_rootWindow(), m_primaryScreen(primaryScreen), m_posted(false), m_keyboardHeight(0), @@ -145,10 +144,6 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_currentPhysicalSize = m_initialPhysicalSize = screenSize; else m_currentPhysicalSize = m_initialPhysicalSize = screenSize.transposed(); - - // We only create the root window if we are the primary display. - if (primaryScreen) - m_rootWindow = QSharedPointer(new QQnxRootWindow(this)); } QQnxScreen::~QQnxScreen() @@ -248,8 +243,8 @@ void QQnxScreen::setRotation(int rotation) // Check if rotation changed if (m_currentRotation != rotation) { // Update rotation of root window - if (m_rootWindow) - m_rootWindow->setRotation(rotation); + if (rootWindow()) + rootWindow()->setRotation(rotation); const QRect previousScreenGeometry = geometry(); @@ -265,16 +260,16 @@ void QQnxScreen::setRotation(int rotation) // Resize root window if we've rotated 90 or 270 from previous orientation if (isOrthogonal(m_currentRotation, rotation)) { qScreenDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); - if (m_rootWindow) - m_rootWindow->resize(m_currentGeometry.size()); + if (rootWindow()) + rootWindow()->resize(m_currentGeometry.size()); if (m_primaryScreen) resizeWindows(previousScreenGeometry); } else { // TODO: Find one global place to flush display updates // Force immediate display update if no geometry changes required - if (m_rootWindow) - m_rootWindow->flush(); + if (rootWindow()) + rootWindow()->flush(); } // Save new rotation @@ -491,8 +486,8 @@ void QQnxScreen::onWindowPost(QQnxWindow *window) // post app window (so navigator will show it) after first child window // has posted; this only needs to happen once as the app window's content // never changes - if (!m_posted && m_rootWindow) { - m_rootWindow->post(); + if (!m_posted && rootWindow()) { + rootWindow()->post(); m_posted = true; } } @@ -573,4 +568,13 @@ void QQnxScreen::deactivateWindowGroup(const QByteArray &id) QWindowSystemInterface::handleWindowActivated(0); } +QSharedPointer QQnxScreen::rootWindow() const +{ + // We only create the root window if we are the primary display. + if (m_primaryScreen && !m_rootWindow) + m_rootWindow = QSharedPointer(new QQnxRootWindow(this)); + + return m_rootWindow; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index be09eca1f8..2851c13c52 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -80,7 +80,7 @@ public: int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; } screen_display_t nativeDisplay() const { return m_display; } screen_context_t nativeContext() const { return m_screenContext; } - const char *windowGroupName() const { return m_rootWindow->groupName().constData(); } + const char *windowGroupName() const { return rootWindow()->groupName().constData(); } QQnxWindow *findWindow(screen_window_t windowHandle); @@ -93,7 +93,7 @@ public: void onWindowPost(QQnxWindow *window); - QSharedPointer rootWindow() const { return m_rootWindow; } + QSharedPointer rootWindow() const; public Q_SLOTS: void setRotation(int rotation); @@ -114,8 +114,8 @@ private: screen_context_t m_screenContext; screen_display_t m_display; - QSharedPointer m_rootWindow; - bool m_primaryScreen; + mutable QSharedPointer m_rootWindow; + const bool m_primaryScreen; bool m_posted; int m_initialRotation; -- cgit v1.2.3 From 2aef22b77aa15eb0863a9585af77ccab04425dbd Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 10 Dec 2012 11:19:52 +0100 Subject: Mac: make windows not restorable on 10.7 and later MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default value for NSWindow::setRestorable: is true, it means application will have some information for each window stored. After a crash happened and application relaunched, the application tries to restore those windows from the broken file. And then the "Retore Windows" will pop up. There is no workaround for application users or develoeprs. What they can do is to manually remove the the saved application state file for the applicaiton. To avoid that, better to switch it off. Task-number: QTBUG-28281 Change-Id: I8ce3cd94f5ae81d7877a346743ca4e0e188baa02 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 551e51bfa9..463c065c9a 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -710,6 +710,11 @@ NSWindow * QCocoaWindow::createNSWindow() createdWindow = window; } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if ([createdWindow respondsToSelector:@selector(setRestorable:)]) + [createdWindow setRestorable: NO]; +#endif + NSInteger level = windowLevel(flags); [createdWindow setLevel:level]; m_windowModality = window()->modality(); -- cgit v1.2.3 From 70d38f078e2bd853508d073ea88b59b3a857a83a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 18 Dec 2012 10:32:08 +0100 Subject: Mac: Ensure the native filedialog sets file name when saving MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The name field string was not set in native dialog when one was present. Task-number: QTBUG-28342 Change-Id: I243b491c8bc094d45f25be96b3bde8eccbb65acd Reviewed-by: Andy Shaw Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 7992461032..61646041fb 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -250,6 +250,7 @@ static QString strippedText(QString s) [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : nil]; // Call processEvents in case the event dispatcher has been interrupted, and needs to do // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will @@ -275,6 +276,7 @@ static QString strippedText(QString s) [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : nil]; NSWindow *nsparent = static_cast(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent)); [mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){ -- cgit v1.2.3 From 393fcf69dc9efc5f990fc37e2205112ae4620562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 4 Jan 2013 11:11:49 +0100 Subject: Cocoa: prevent scale factor value of 0. Check that the NSWindow pointer is valid before calling backingScaleFactor. Change-Id: Ia23cbb4058b7d0fece008bc437f8bfec6c0ddebe Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index fd0f4529cc..7f022da4c3 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -67,7 +67,7 @@ QPaintDevice *QCocoaBackingStore::paintDevice() #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { QCocoaWindow *cocoaWindow = static_cast(window()->handle()); - if (cocoaWindow && cocoaWindow->m_contentView) { + if (cocoaWindow && cocoaWindow->m_contentView && [cocoaWindow->m_contentView window]) { scaleFactor = int([[cocoaWindow->m_contentView window] backingScaleFactor]); } } -- cgit v1.2.3 From 38f740e4de9a313fd33984bd54834c56dc2316c4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 30 Jan 2013 10:05:55 +0100 Subject: Windows tray icon: Fix reinstalling after restart of Explorer. Use a normal instead of a HWND_MESSAGE-window since the latter do not receive the "TaskbarCreated" message. Provide an invokable slot in the native interface to register a window class for that purpose. Task-number: QTBUG-29160 Change-Id: Ic25222d08d21867f7d882a9e19d8aaf50f3f47cf Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsintegration.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index aac28c36dc..4473b6b8a4 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -107,6 +107,9 @@ public: Q_INVOKABLE void *createMessageWindow(const QString &classNameTemplate, const QString &windowName, void *eventProc) const; + + Q_INVOKABLE QString registerWindowClass(const QString &classNameIn, void *eventProc) const; + bool asyncExpose() const; void setAsyncExpose(bool value); }; @@ -186,6 +189,15 @@ void *QWindowsNativeInterface::createMessageWindow(const QString &classNameTempl return hwnd; } +/*! + \brief Registers a unique window class with a callback function based on \a classNameIn. +*/ + +QString QWindowsNativeInterface::registerWindowClass(const QString &classNameIn, void *eventProc) const +{ + return QWindowsContext::instance()->registerWindowClass(classNameIn, (WNDPROC)eventProc); +} + bool QWindowsNativeInterface::asyncExpose() const { return QWindowsContext::instance()->asyncExpose(); -- cgit v1.2.3 From 539a024819a5f696b8afe899108b409f2b77549c Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 31 Jan 2013 07:02:27 +1000 Subject: update ofono API Task-number: QTBUG-29381 Change-Id: I952b73d86b4e8f497b4ff90d10c1f5312882bd8a Reviewed-by: Thiago Macieira --- src/plugins/bearer/connman/qofonoservice_linux.cpp | 82 ++++++++++++++++------ src/plugins/bearer/connman/qofonoservice_linux_p.h | 8 +++ 2 files changed, 70 insertions(+), 20 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index 085b57d660..f6fb55522e 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -56,6 +56,22 @@ #ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS +QDBusArgument &operator<<(QDBusArgument &argument, const ObjectPathProperties &item) +{ + argument.beginStructure(); + argument << item.path << item.properties; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, ObjectPathProperties &item) +{ + argument.beginStructure(); + argument >> item.path >> item.properties; + argument.endStructure(); + return argument; +} + QT_BEGIN_NAMESPACE QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent) @@ -64,6 +80,8 @@ QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent) OFONO_MANAGER_INTERFACE, QDBusConnection::systemBus(), parent) { + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); } QOfonoManagerInterface::~QOfonoManagerInterface() @@ -72,8 +90,16 @@ QOfonoManagerInterface::~QOfonoManagerInterface() QList QOfonoManagerInterface::getModems() { - QVariant var = getProperty("Modems"); - return qdbus_cast >(var); + QList modemList; + QList argumentList; + QDBusReply reply = this->asyncCallWithArgumentList(QLatin1String("GetModems"), argumentList); + if (reply.isValid()) { + foreach (ObjectPathProperties modem, reply.value()) { + modemList << modem.path; + } + } + + return modemList; } QDBusObjectPath QOfonoManagerInterface::currentModem() @@ -81,7 +107,7 @@ QDBusObjectPath QOfonoManagerInterface::currentModem() QList modems = getModems(); foreach (const QDBusObjectPath &modem, modems) { QOfonoModemInterface device(modem.path()); - if(device.isPowered() && device.isOnline()) + if (device.isPowered() && device.isOnline()) return modem;; } return QDBusObjectPath(); @@ -92,7 +118,7 @@ void QOfonoManagerInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoManagerInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), QLatin1String(OFONO_MANAGER_PATH), QLatin1String(OFONO_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -140,7 +166,7 @@ QVariant QOfonoManagerInterface::getProperty(const QString &property) QVariantMap QOfonoManagerInterface::getProperties() { QDBusReply reply = this->call(QLatin1String("GetProperties")); - if(reply.isValid()) + if (reply.isValid()) return reply.value(); else return QVariantMap(); @@ -234,7 +260,7 @@ QStringList QOfonoModemInterface::getInterfaces() QString QOfonoModemInterface::defaultInterface() { - foreach(const QString &modem,getInterfaces()) { + foreach (const QString &modem,getInterfaces()) { return modem; } return QString(); @@ -245,7 +271,7 @@ void QOfonoModemInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoModemInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_MODEM_INTERFACE), QLatin1String("PropertyChanged"), @@ -363,15 +389,23 @@ QString QOfonoNetworkRegistrationInterface::getBaseStation() QList QOfonoNetworkRegistrationInterface::getOperators() { - QVariant var = getProperty("Operators"); - return qdbus_cast >(var); + QList operatorList; + QList argumentList; + QDBusReply reply = this->asyncCallWithArgumentList(QLatin1String("GetOperators"), + argumentList); + if (reply.isValid()) { + foreach (ObjectPathProperties netop, reply.value()) { + operatorList << netop.path; + } + } + return operatorList; } void QOfonoNetworkRegistrationInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkRegistrationInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE), QLatin1String("PropertyChanged"), @@ -473,7 +507,7 @@ void QOfonoNetworkOperatorInterface::connectNotify(const QMetaMethod &signal) Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkOperatorInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE), // QLatin1String("PropertyChanged"), @@ -581,7 +615,7 @@ void QOfonoSimInterface::connectNotify(const QMetaMethod &signal) Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSimInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_SIM_MANAGER_INTERFACE), // QLatin1String("PropertyChanged"), @@ -648,8 +682,16 @@ QOfonoDataConnectionManagerInterface::~QOfonoDataConnectionManagerInterface() QList QOfonoDataConnectionManagerInterface::getPrimaryContexts() { - QVariant var = getProperty("PrimaryContexts"); - return qdbus_cast >(var); + QList contextList; + QList argumentList; + QDBusReply reply = this->asyncCallWithArgumentList(QLatin1String("GetContexts"), + argumentList); + if (reply.isValid()) { + foreach (ObjectPathProperties context, reply.value()) { + contextList << context.path; + } + } + return contextList; } bool QOfonoDataConnectionManagerInterface::isAttached() @@ -675,7 +717,7 @@ void QOfonoDataConnectionManagerInterface::connectNotify(const QMetaMethod &sign Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoDataConnectionManagerInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE), // QLatin1String("PropertyChanged"), @@ -799,7 +841,7 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal) Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_DATA_CONTEXT_INTERFACE), // QLatin1String("PropertyChanged"), @@ -861,7 +903,7 @@ bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const Q QLatin1String("SetProperty"), args); bool ok = true; - if(reply.type() != QDBusMessage::ReplyMessage) { + if (reply.type() != QDBusMessage::ReplyMessage) { qWarning() << reply.errorMessage(); ok = false; } @@ -885,7 +927,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SMS_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -912,7 +954,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal) static const QMetaMethod immediateMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::immediateMessage); if (signal == immediateMessageSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SMS_MANAGER_INTERFACE), QLatin1String("ImmediateMessage"), @@ -923,7 +965,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal) static const QMetaMethod incomingMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::incomingMessage); if (signal == incomingMessageSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SMS_MANAGER_INTERFACE), QLatin1String("IncomingMessage"), diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h index 85f6602023..00be9aa675 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux_p.h +++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h @@ -88,6 +88,14 @@ QT_BEGIN_NAMESPACE QT_END_NAMESPACE +struct ObjectPathProperties +{ + QDBusObjectPath path; + QVariantMap properties; +}; +typedef QList PathPropertiesList; +Q_DECLARE_METATYPE(ObjectPathProperties) +Q_DECLARE_METATYPE (PathPropertiesList) QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 3dc47622a469ded1c99397fdedc2053b73d57189 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 25 Jan 2013 09:38:47 +0100 Subject: BlackBerry bearer plugin: check whether device is online several times This is supposed to workaround a race condition in the underlying netstatus API: Sometimes we get an event that the Wifi interface changed, but it is not up, e.g. no gateway (yet). In that case we need to check back (currently: 300 ms) whether the interface has come up or not. This commit can be reverted again once the race condition in the netstatus API has been resolved. Task-number: QTBUG-29421 Change-Id: I215ce8aae4848b6e942e77c6425adba90e9cc526 Reviewed-by: Sean Harmer Reviewed-by: Rafael Roquetto --- src/plugins/bearer/blackberry/qbbengine.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/bearer/blackberry/qbbengine.cpp b/src/plugins/bearer/blackberry/qbbengine.cpp index d64a8fe20f..ab1ba9aa19 100644 --- a/src/plugins/bearer/blackberry/qbbengine.cpp +++ b/src/plugins/bearer/blackberry/qbbengine.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -355,6 +356,9 @@ void QBBEngine::updateConfiguration(const char *interface) changed = true; } + const netstatus_ip_status_t oldIpStatus = ptr->oldIpStatus; + ptr->oldIpStatus = ipStatus; + ptrLocker.unlock(); locker.unlock(); @@ -364,7 +368,17 @@ void QBBEngine::updateConfiguration(const char *interface) Q_EMIT configurationChanged(ptr); } else { + // maybe Wifi has changed but gateway not yet ready etc. qBearerDebug() << Q_FUNC_INFO << "configuration has not changed."; + if (oldIpStatus != ipStatus) { // if IP status changed + if (ipStatus != NETSTATUS_IP_STATUS_OK + && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_UP + && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_CONFIGURED) { + // work around race condition in netstatus API by just checking + // again in 300 ms + QTimer::singleShot(300, this, SLOT(doRequestUpdate())); + } + } } return; -- cgit v1.2.3 From 29a78d48d0d3c162fad11b050cb50c951d4a484c Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Wed, 30 Jan 2013 13:58:12 +0000 Subject: QNX: Don't crash if we unplug the primary display. The QPA plugin assumes in several places that we have at least one QScreen. Even if patching the plugin to support 0 screens, Qt itself crashes when dereferencing a null paint device while synching the backing store. Change-Id: I2ac504a447aff811d6c07ab857340a3433557cdc Reviewed-by: Kevin Krammer Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 8b41465add..4412bb34bd 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -42,6 +42,7 @@ #include "qqnxscreeneventhandler.h" #include "qqnxintegration.h" #include "qqnxkeytranslator.h" +#include "qqnxscreen.h" #include #include @@ -487,9 +488,18 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) m_qnxIntegration->createDisplay(nativeDisplay, false /* not primary, we assume */); } } else if (!isAttached) { - // libscreen display is deactivated, let's remove the QQnxScreen / QScreen - qScreenEventDebug() << "removing display"; - m_qnxIntegration->removeDisplay(screen); + // We never remove the primary display, the qpa plugin doesn't support that and it crashes. + // To support it, this would be needed: + // - Adjust all qnx qpa code which uses screens + // - Make QWidgetBackingStore not dereference a null paint device + // - Create platform resources ( QQnxWindow ) for all QWindow because they would be deleted + // when you delete the screen + + if (!screen->isPrimaryScreen()) { + // libscreen display is deactivated, let's remove the QQnxScreen / QScreen + qScreenEventDebug() << "removing display"; + m_qnxIntegration->removeDisplay(screen); + } } } -- cgit v1.2.3 From 328c7ee6b804043a6fe293bcd0afba7d715989f7 Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Tue, 5 Feb 2013 13:01:25 +0800 Subject: Show default shortcut menu when user right click window's caption In windows platform, Qt5 will not show the system default shortcut menu when the user right click in the window's caption. This is a regression from Qt4. This patch will let DefWindowProc() to handle the message WM_CONTEXTMENU if the mouse pointer is in the non-client area of the window. Thus the default Windows shortcut menu will show up. Change-Id: I88638ad1d4f0e73b088204b83c3f7ec0fe2033f0 Reviewed-by: Joerg Bornemann Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 18 +++++++++++++++--- src/plugins/platforms/windows/qwindowscontext.h | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 44f1a438b8..99ef3aacf3 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -874,8 +874,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, #endif #ifndef QT_NO_CONTEXTMENU case QtWindows::ContextMenu: - handleContextMenuEvent(platformWindow->window(), msg); - return true; + return handleContextMenuEvent(platformWindow->window(), msg); #endif default: break; @@ -909,7 +908,7 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et, } #ifndef QT_NO_CONTEXTMENU -void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) +bool QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) { bool mouseTriggered = false; QPoint globalPos; @@ -919,10 +918,23 @@ void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) globalPos.setX(msg.pt.x); globalPos.setY(msg.pt.y); pos = QWindowsGeometryHint::mapFromGlobal(msg.hwnd, globalPos); + + RECT clientRect; + if (GetClientRect(msg.hwnd, &clientRect)) { + if (pos.x() < (int)clientRect.left || pos.x() >= (int)clientRect.right || + pos.y() < (int)clientRect.top || pos.y() >= (int)clientRect.bottom) + { + // This is the case that user has right clicked in the window's caption, + // We should call DefWindowProc() to display a default shortcut menu + // instead of sending a Qt window system event. + return false; + } + } } QWindowSystemInterface::handleContextMenuEvent(window, mouseTriggered, pos, globalPos, QWindowsKeyMapper::queryKeyboardModifiers()); + return true; } #endif diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index bfe56ed246..1fe71e3aff 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -192,7 +192,7 @@ public: private: void handleFocusEvent(QtWindows::WindowsEventType et, QWindowsWindow *w); #ifndef QT_NO_CONTEXTMENU - void handleContextMenuEvent(QWindow *window, const MSG &msg); + bool handleContextMenuEvent(QWindow *window, const MSG &msg); #endif void unregisterWindowClasses(); -- cgit v1.2.3 From 9d7e63e37033741175baa38dc6b9faeebf7d2aa1 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Thu, 31 Jan 2013 19:08:12 +0000 Subject: QNX: Fix one more code path that led to having no QScreens. Qt dereferences QGuiApplication::primaryScreen() inside, for example, QColormapPrivate::initialize(). libscreen always returns at least one display, even it it's not connected, so lets not ignore it if it's primary. Change-Id: I2f14a187c979ca0c7ad39149ceb0b2b7e61e9ba6 Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxintegration.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index bff4dbdc2a..d7370998d5 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -446,6 +446,11 @@ void QQnxIntegration::createDisplays() qFatal("QQnxIntegration: failed to query display count, errno=%d", errno); } + if (displayCount < 1) { + // Never happens, even if there's no display, libscreen returns 1 + qFatal("QQnxIntegration: displayCount=%d", displayCount); + } + // Get all displays errno = 0; screen_display_t *displays = (screen_display_t *)alloca(sizeof(screen_display_t) * displayCount); @@ -454,7 +459,11 @@ void QQnxIntegration::createDisplays() qFatal("QQnxIntegration: failed to query displays, errno=%d", errno); } - for (int i=0; i Date: Mon, 4 Feb 2013 16:04:00 +0100 Subject: Fix lupdate-warnings in simplewidgets.cpp. simplewidgets.cpp:429: Discarding unconsumed meta data simplewidgets.cpp:535: Discarding unconsumed meta data Change-Id: Icd9686392781eb1faa7868dc4c92d26fa44c4f94 Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/simplewidgets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 48f973c30d..a9a43a7875 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -424,7 +424,7 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const /*! \reimp */ QVector > -QAccessibleDisplay::relations(QAccessible::Relation match /*= QAccessible::AllRelations*/) const +QAccessibleDisplay::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const { QVector > rels = QAccessibleWidget::relations(match); if (match & QAccessible::Labelled) { @@ -530,7 +530,7 @@ QAccessible::Role QAccessibleGroupBox::role() const } QVector > -QAccessibleGroupBox::relations(QAccessible::Relation match /*= QAccessible::AllRelations*/) const +QAccessibleGroupBox::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const { QVector > rels = QAccessibleWidget::relations(match); -- cgit v1.2.3 From 655ba5755696df8e2594bca9f7696ab621f5afc3 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 5 Feb 2013 13:39:33 +0100 Subject: Cocoa QPA: Fix compilation error The error appeared with latest clang as of Feb. 5, 2013. Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) Target: x86_64-apple-darwin12.2.0 Change-Id: I8df8cccc941ac03a7a997bdd5afe095b7b6f65d3 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qcocoawindow.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 3b5be0af0f..324a43c8ae 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -49,7 +49,8 @@ #include "qcocoaglcontext.h" #include "qnsview.h" -class QT_PREPEND_NAMESPACE(QCocoaWindow); + +QT_FORWARD_DECLARE_CLASS(QCocoaWindow) @interface QNSWindow : NSWindow { @public QCocoaWindow *m_cocoaPlatformWindow; -- cgit v1.2.3 From 20204fe58b77d7f62d3dac4e574bdef528199518 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 5 Feb 2013 16:43:07 +0100 Subject: Do not crash if the child index is out of range. Task-number: QTBUG-29077 Change-Id: I934101cdc121e9ef99de2e9eeaef154dd4cae0d8 Reviewed-by: Frederik Gladhorn --- .../platforms/windows/accessible/qwindowsmsaaaccessible.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 7cc2b2aeb0..c23902014c 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -577,9 +577,10 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long QRect rect; if (varID.lVal) { - QAIPointer child = QAIPointer(accessible->child(varID.lVal - 1)); - if (child->isValid()) - rect = child->rect(); + QAIPointer child(childPointer(varID)); + if (!child) + return E_FAIL; + rect = child->rect(); } else { rect = accessible->rect(); } -- cgit v1.2.3 From b3820b12fbded1f173837eee7f7559783e92b46b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 6 Feb 2013 11:38:26 +0100 Subject: Windows: Fix setting of layered windows. The setting/clearing of WS_EX_LAYERED in the backing store interfered with the setting/clearing in setWindowOpacity when combining translucent and non-opaque windows. Introduce QWindowsWindow::setWindowLayered to handle it consistently. Task-number: QTBUG-29010 Task-number: QTBUG-28531 Change-Id: Ib6e2740aae417bdf7b3db9ef7deb646be98df1d6 Reviewed-by: Joerg Bornemann --- .../platforms/windows/qwindowsbackingstore.cpp | 6 +-- src/plugins/platforms/windows/qwindowswindow.cpp | 48 ++++++++++++++++------ src/plugins/platforms/windows/qwindowswindow.h | 2 + 3 files changed, 38 insertions(+), 18 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 792eaf0fdc..0a7ff61b7b 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -88,11 +88,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window); #ifndef Q_OS_WINCE - if (rw->format().hasAlpha() && (window->flags() & Qt::FramelessWindowHint)) { - const long wl = GetWindowLong(rw->handle(), GWL_EXSTYLE); - if ((wl & WS_EX_LAYERED) == 0) - SetWindowLong(rw->handle(), GWL_EXSTYLE, wl | WS_EX_LAYERED); - + if (QWindowsWindow::setWindowLayered(rw->handle(), window->flags(), rw->format().hasAlpha(), rw->opacity())) { QRect r = window->frameGeometry(); QPoint frameOffset(window->frameMargins().left(), window->frameMargins().top()); QRect dirtyRect = br.translated(offset + frameOffset); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 42a301cbb2..5d6d4620b7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -209,22 +209,42 @@ static bool shouldShowMaximizeButton(Qt::WindowFlags flags) return flags & Qt::WindowMaximizeButtonHint; } -static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level) +// Set the WS_EX_LAYERED flag on a HWND if required. This is required for +// translucent backgrounds, not fully opaque windows and for +// Qt::WindowTransparentForInput (in combination with WS_EX_TRANSPARENT). +bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity) +{ +#ifndef Q_OS_WINCE // maybe needs revisiting WS_EX_LAYERED + const LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE); + const bool needsLayered = (flags & Qt::WindowTransparentForInput) + || (hasAlpha && (flags & Qt::FramelessWindowHint)) || opacity < 1.0; + const bool isLayered = (exStyle & WS_EX_LAYERED); + if (needsLayered != isLayered) { + if (needsLayered) { + SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_LAYERED); + } else { + SetWindowLong(hwnd, GWL_EXSTYLE, exStyle & ~WS_EX_LAYERED); + } + } + return needsLayered; +#else // !Q_OS_WINCE + Q_UNUSED(hwnd); + Q_UNUSED(flags); + Q_UNUSED(hasAlpha); + Q_UNUSED(opacity); + return false; +#endif // Q_OS_WINCE +} + +static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal level) { #ifdef Q_OS_WINCE // maybe needs revisit WS_EX_LAYERED Q_UNUSED(hwnd); Q_UNUSED(flags); + Q_UNUSED(hasAlpha); Q_UNUSED(level); #else - const long wl = GetWindowLong(hwnd, GWL_EXSTYLE); - const bool isOpaque = level == 1.0 && !(flags & Qt::WindowTransparentForInput); - - if (isOpaque) { - if (wl & WS_EX_LAYERED) - SetWindowLong(hwnd, GWL_EXSTYLE, wl & ~WS_EX_LAYERED); - } else { - if ((wl & WS_EX_LAYERED) == 0) - SetWindowLong(hwnd, GWL_EXSTYLE, wl | WS_EX_LAYERED); + if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) { if (flags & Qt::FramelessWindowHint) { BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA}; QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); @@ -271,7 +291,7 @@ struct WindowCreationData WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0), topLevel(false), popup(false), dialog(false), desktop(false), - tool(false), embedded(false) {} + tool(false), embedded(false), hasAlpha(false) {} void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags = 0); inline WindowData create(const QWindow *w, const QRect &geometry, QString title) const; @@ -290,6 +310,7 @@ struct WindowCreationData bool desktop; bool tool; bool embedded; + bool hasAlpha; }; QDebug operator<<(QDebug debug, const WindowCreationData &d) @@ -308,6 +329,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag unsigned creationFlags) { isGL = w->surfaceType() == QWindow::OpenGLSurface; + hasAlpha = w->format().hasAlpha(); flags = flagsIn; // Sometimes QWindow doesn't have a QWindow parent but does have a native parent window, @@ -526,7 +548,7 @@ void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLe EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED); } - setWindowOpacity(hwnd, flags, opacityLevel); + setWindowOpacity(hwnd, flags, hasAlpha, opacityLevel); } else { // child. SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags); } @@ -1471,7 +1493,7 @@ void QWindowsWindow::setOpacity(qreal level) if (m_opacity != level) { m_opacity = level; if (m_data.hwnd) - setWindowOpacity(m_data.hwnd, m_data.flags, level); + setWindowOpacity(m_data.hwnd, m_data.flags, window()->format().hasAlpha(), level); } } diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index c864ba439f..c30b6e62b0 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -216,6 +216,8 @@ public: static inline void *userDataOf(HWND hwnd); static inline void setUserDataOf(HWND hwnd, void *ud); + static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity); + HDC getDC(); void releaseDC(); #ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO -- cgit v1.2.3 From ca19cba2ac3cf9785b9a2211c4ba7d1e14d87bf2 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 14 Dec 2012 18:25:03 +0100 Subject: Factorize code for formatting window titles into QPlatformWindow. Change-Id: I0dcccd08916fc2ea1b795681e9b98a9550ef51b6 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 13 +------------ src/plugins/platforms/xcb/qxcbwindow.cpp | 12 +----------- 2 files changed, 2 insertions(+), 23 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 5d6d4620b7..2708d7d428 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1216,18 +1216,7 @@ void QWindowsWindow::setWindowTitle(const QString &title) if (QWindowsContext::verboseWindows) qDebug() << __FUNCTION__ << this << window() < Date: Thu, 31 Jan 2013 13:17:08 +0100 Subject: Removed User32.dll usage on WINCE Change-Id: Id65dc0a9a829d66d0a2cc7bd40c5ba3190d9ecba Reviewed-by: Friedemann Kleint Reviewed-by: Janne Anttila --- src/plugins/platforms/windows/qwindowswindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 2708d7d428..2ebc3a06fa 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -238,7 +238,7 @@ bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool has static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal level) { -#ifdef Q_OS_WINCE // maybe needs revisit WS_EX_LAYERED +#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls Q_UNUSED(hwnd); Q_UNUSED(flags); Q_UNUSED(hasAlpha); @@ -756,8 +756,10 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : break; } } +#ifndef Q_OS_WINCE if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0); +#endif // !Q_OS_WINCE setWindowState(aWindow->windowState()); const qreal opacity = qt_window_private(aWindow)->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) @@ -766,8 +768,10 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : QWindowsWindow::~QWindowsWindow() { +#ifndef Q_OS_WINCE if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd); +#endif // !Q_OS_WINCE destroyWindow(); destroyIcon(); } @@ -797,7 +801,7 @@ void QWindowsWindow::destroyWindow() ShowWindow(handle, SW_SHOW); } } -#endif +#endif // !Q_OS_WINCE if (m_data.hwnd != GetDesktopWindow()) DestroyWindow(m_data.hwnd); QWindowsContext::instance()->removeWindow(m_data.hwnd); -- cgit v1.2.3 From e74bf9497c9dc02465f902c03a600da83f117c69 Mon Sep 17 00:00:00 2001 From: Bjoern Breitmeyer Date: Wed, 30 Jan 2013 14:39:53 +0100 Subject: Fixed QT_NO_CURSOR build for windows/CE plugin. Change-Id: I02f13b2af2d8c285fbca46917ff77826720857be Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscursor.cpp | 3 +++ src/plugins/platforms/windows/qwindowsscreen.cpp | 11 ++++++++++- src/plugins/platforms/windows/qwindowsscreen.h | 8 ++++++++ src/plugins/platforms/windows/qwindowswindow.cpp | 10 +++++++++- src/plugins/platforms/windows/qwindowswindow.h | 4 ++++ 5 files changed, 34 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index 0479eb6d58..4dc9af61d8 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#ifndef QT_NO_CURSOR #include "qwindowscursor.h" #include "qwindowscontext.h" #include "qwindowswindow.h" @@ -498,3 +499,5 @@ HCURSOR QWindowsWindowCursor::handle() const } QT_END_NAMESPACE + +#endif // !QT_NO_CURSOR diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 9bb16793cc..f616972aa0 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -168,8 +168,10 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d) // Return the cursor to be shared by all screens (virtual desktop). static inline QSharedPointer sharedCursor() { +#ifndef QT_NO_CURSOR if (const QScreen *primaryScreen = QGuiApplication::primaryScreen()) return static_cast(primaryScreen->handle())->windowsCursor(); +#endif return QSharedPointer(new QWindowsCursor); } @@ -182,7 +184,10 @@ static inline QSharedPointer sharedCursor() */ QWindowsScreen::QWindowsScreen(const QWindowsScreenData &data) : - m_data(data), m_cursor(sharedCursor()) + m_data(data) +#ifndef QT_NO_CURSOR + ,m_cursor(sharedCursor()) +#endif { } @@ -250,7 +255,11 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags) QWindow *QWindowsScreen::windowUnderMouse(unsigned flags) { +#ifndef QT_NO_CURSOR return QWindowsScreen::windowAt(QWindowsCursor::mousePosition(), flags); +#else + return 0; +#endif } QWindowsScreen *QWindowsScreen::screenOf(const QWindow *w) diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 7da1a4d207..216973125b 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -79,7 +79,9 @@ struct QWindowsScreenData class QWindowsScreen : public QPlatformScreen { public: +#ifndef QT_NO_CURSOR typedef QSharedPointer WindowsCursorPtr; +#endif explicit QWindowsScreen(const QWindowsScreenData &data); @@ -106,14 +108,20 @@ public: inline void handleChanges(const QWindowsScreenData &newData); +#ifndef QT_NO_CURSOR QPlatformCursor *cursor() const { return m_cursor.data(); } const WindowsCursorPtr &windowsCursor() const { return m_cursor; } +#else + QPlatformCursor *cursor() const { return 0; } +#endif // !QT_NO_CURSOR const QWindowsScreenData &data() const { return m_data; } private: QWindowsScreenData m_data; +#ifndef QT_NO_CURSOR const WindowsCursorPtr m_cursor; +#endif }; class QWindowsScreenManager diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 2ebc3a06fa..3530f0af68 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -44,7 +44,9 @@ #include "qwindowscontext.h" #include "qwindowsdrag.h" #include "qwindowsscreen.h" -#include "qwindowscursor.h" +#ifdef QT_NO_CURSOR +# include "qwindowscursor.h" +#endif #ifdef QT_OPENGL_ES_2 # include "qwindowseglcontext.h" @@ -726,7 +728,9 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : m_hdc(0), m_windowState(Qt::WindowNoState), m_opacity(1.0), +#ifndef QT_NO_CURSOR m_cursor(QWindowsScreen::screenOf(aWindow)->windowsCursor()->standardWindowCursor()), +#endif m_dropTarget(0), m_savedStyle(0), m_format(aWindow->format()), @@ -1649,11 +1653,14 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const void QWindowsWindow::applyCursor() { +#ifndef QT_NO_CURSOR SetCursor(m_cursor.handle()); +#endif } void QWindowsWindow::setCursor(const QWindowsWindowCursor &c) { +#ifndef QT_NO_CURSOR if (c.handle() != m_cursor.handle()) { const bool underMouse = QWindowsContext::instance()->windowUnderMouse() == window(); if (QWindowsContext::verboseWindows) @@ -1663,6 +1670,7 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c) if (underMouse) applyCursor(); } +#endif } /*! diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index c30b6e62b0..f3b480b0af 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -224,7 +224,9 @@ public: void getSizeHints(MINMAXINFO *mmi) const; #endif +#ifndef QT_NO_CURSOR QWindowsWindowCursor cursor() const { return m_cursor; } +#endif void setCursor(const QWindowsWindowCursor &c); void applyCursor(); @@ -270,7 +272,9 @@ private: HDC m_hdc; Qt::WindowState m_windowState; qreal m_opacity; +#ifndef QT_NO_CURSOR QWindowsWindowCursor m_cursor; +#endif QWindowsOleDropTarget *m_dropTarget; unsigned m_savedStyle; QRect m_savedFrameGeometry; -- cgit v1.2.3 From b06363886d17cef736610f9274c784db37d3e500 Mon Sep 17 00:00:00 2001 From: Bjoern Breitmeyer Date: Thu, 31 Jan 2013 11:47:56 +0100 Subject: Fixed QT_NO_DRAGANDDROP build for the windows plugin Change-Id: Ieb987105bdcc08118a1b83cf3b74a93fa402264a Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsintegration.cpp | 13 +++++++++---- src/plugins/platforms/windows/qwindowsintegration.h | 4 +++- src/plugins/platforms/windows/qwindowswindow.cpp | 8 ++++++++ src/plugins/platforms/windows/windows.pro | 12 ++++++++++-- 4 files changed, 30 insertions(+), 7 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 4473b6b8a4..da4519199f 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -59,8 +59,10 @@ #include "qwindowsguieventdispatcher.h" #ifndef QT_NO_CLIPBOARD # include "qwindowsclipboard.h" +# ifndef QT_NO_DRAGANDDROP +# include "qwindowsdrag.h" +# endif #endif -#include "qwindowsdrag.h" #include "qwindowsinputcontext.h" #include "qwindowskeymapper.h" # ifndef QT_NO_ACCESSIBILITY @@ -266,8 +268,10 @@ struct QWindowsIntegrationPrivate QWindowsNativeInterface m_nativeInterface; #ifndef QT_NO_CLIPBOARD QWindowsClipboard m_clipboard; -#endif +# ifndef QT_NO_DRAGANDDROP QWindowsDrag m_drag; +# endif +#endif QWindowsGuiEventDispatcher *m_eventDispatcher; #if defined(QT_OPENGL_ES_2) QEGLStaticContextPtr m_staticEGLContext; @@ -529,12 +533,13 @@ QPlatformClipboard * QWindowsIntegration::clipboard() const { return &d->m_clipboard; } -#endif // !QT_NO_CLIPBOARD - +# ifndef QT_NO_DRAGANDDROP QPlatformDrag *QWindowsIntegration::drag() const { return &d->m_drag; } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD QPlatformInputContext * QWindowsIntegration::inputContext() const { diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 2593c3b946..24dc01f0bd 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -75,8 +75,10 @@ public: virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const; #ifndef QT_NO_CLIPBOARD virtual QPlatformClipboard *clipboard() const; -#endif +# ifndef QT_NO_DRAGANDDROP virtual QPlatformDrag *drag() const; +# endif +#endif !QT_NO_CLIPBOARD virtual QPlatformInputContext *inputContext() const; #ifndef QT_NO_ACCESSIBILITY virtual QPlatformAccessibility *accessibility() const; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 3530f0af68..2a26e092eb 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -815,21 +815,29 @@ void QWindowsWindow::destroyWindow() void QWindowsWindow::registerDropSite() { +#ifndef QT_NO_CLIPBOARD +# ifndef QT_NO_DRAGANDDROP if (m_data.hwnd && !m_dropTarget) { m_dropTarget = new QWindowsOleDropTarget(window()); RegisterDragDrop(m_data.hwnd, m_dropTarget); CoLockObjectExternal(m_dropTarget, true, true); } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD } void QWindowsWindow::unregisterDropSite() { +#ifndef QT_NO_CLIPBOARD +# ifndef QT_NO_DRAGANDDROP if (m_data.hwnd && m_dropTarget) { m_dropTarget->Release(); CoLockObjectExternal(m_dropTarget, false, true); RevokeDragDrop(m_data.hwnd); m_dropTarget = 0; } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD } // Returns topmost QWindowsWindow ancestor even if there are embedded windows in the chain. diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 7f73465135..ff162e2d41 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -45,7 +45,6 @@ SOURCES += \ qwindowsguieventdispatcher.cpp \ qwindowsole.cpp \ qwindowsmime.cpp \ - qwindowsdrag.cpp \ qwindowsinternalmimedata.cpp \ qwindowscursor.cpp \ qwindowsinputcontext.cpp \ @@ -69,7 +68,6 @@ HEADERS += \ qtwindows_additional.h \ qwindowsole.h \ qwindowsmime.h \ - qwindowsdrag.h \ qwindowsinternalmimedata.h \ qwindowscursor.h \ array.h \ @@ -94,6 +92,16 @@ contains(QT_CONFIG, opengles2) { HEADERS += qwindowsclipboard.h } +# drag and drop on windows only works if a clipboard is available +!contains( DEFINES, QT_NO_DRAGANDDROP ) { + !win32:SOURCES += qwindowsdrag.cpp + !win32:HEADERS += qwindowsdrag.h + win32:!contains( DEFINES, QT_NO_CLIPBOARD ) { + HEADERS += qwindowsdrag.h + SOURCES += qwindowsdrag.cpp + } +} + # Enable access to HB_Face in harfbuzz includes included by qfontengine_p.h. DEFINES *= QT_COMPILES_IN_HARFBUZZ -- cgit v1.2.3 From 391b5a465eb20758fe36528c32da51f95888a9da Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Feb 2013 10:19:42 +0100 Subject: Do not force top level flag on embedded windows. Regression introduced by cd7ba89a07f794b17fc66ba29515b104c4d21f27. Task-number: QTBUG-29564 Task-number: QTBUG-28872 Change-Id: I6402a971af89321d18afb42dc25e54b1c88df129 Reviewed-by: Miikka Heikkinen Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 2a26e092eb..07dc668b3f 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -345,10 +345,12 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag if (creationFlags & ForceChild) { topLevel = false; - } else if (creationFlags & ForceTopLevel) { - topLevel = true; + } else if (embedded) { + // Embedded native windows (for example Active X server windows) are by + // definition never toplevel, even though they do not have QWindow parents. + topLevel = false; } else { - topLevel = w->isTopLevel(); + topLevel = (creationFlags & ForceTopLevel) ? true : w->isTopLevel(); } if (topLevel && flags == 1) { -- cgit v1.2.3 From 67bed5616bf4743b432566130d1f3cfb6a2dc0c1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 7 Feb 2013 15:58:31 +0100 Subject: Fix broken fading of menus. Breakage introduced by b3820b12fbded1f173837eee7f7559783e92b46b Set layered in backing store for frameless windows as was before. Task-number: QTBUG-29010 Task-number: QTBUG-28531 Change-Id: I13f8f0d58d71b6612430c7048056f672e23b8095 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsbackingstore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 0a7ff61b7b..b40aefa225 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -88,7 +88,8 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window); #ifndef Q_OS_WINCE - if (QWindowsWindow::setWindowLayered(rw->handle(), window->flags(), rw->format().hasAlpha(), rw->opacity())) { + const Qt::WindowFlags flags = window->flags(); + if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, rw->format().hasAlpha(), rw->opacity())) { QRect r = window->frameGeometry(); QPoint frameOffset(window->frameMargins().left(), window->frameMargins().top()); QRect dirtyRect = br.translated(offset + frameOffset); @@ -97,7 +98,6 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA}; - if (QWindowsContext::user32dll.updateLayeredWindowIndirect) { RECT dirty = {dirtyRect.x(), dirtyRect.y(), dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; -- cgit v1.2.3 From 2be39c68320ab058ac5428ed1a9f0bb69a6c5893 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 6 Feb 2013 16:29:58 +0100 Subject: Cocoa: Make tool window receive mouse events also when its parent is modal We need to check for the Cocoa window class because of the way currently QDockWidget works. Change-Id: If69c7327c168518614fe884defa79deb358e260d Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoawindow.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 463c065c9a..14d62c9fca 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -301,9 +301,11 @@ void QCocoaWindow::setVisible(bool visible) [m_nsWindow orderFront: nil]; } - // We want the events to properly reach the popup and dialog - if (window()->type() == Qt::Popup || window()->type() == Qt::Dialog) + // We want the events to properly reach the popup, dialog, and tool + if ((window()->type() == Qt::Popup || window()->type() == Qt::Dialog || window()->type() == Qt::Tool) + && [m_nsWindow isKindOfClass:[NSPanel class]]) { [(NSPanel *)m_nsWindow setWorksWhenModal:YES]; + } } } else { [m_contentView setHidden:NO]; -- cgit v1.2.3 From 6b8d0b3092180dff54bfb68ab7765de40515c31d Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Fri, 8 Feb 2013 20:04:58 +0200 Subject: QNX: Add support for QInputMethod::keyboardRectangle() Change-Id: Ie23aa06fed5778e228abf0f35fc1136a86661771 Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp | 12 +++++++++++- src/plugins/platforms/qnx/qqnxinputcontext_imf.h | 6 +++++- src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp | 12 +++++++++++- src/plugins/platforms/qnx/qqnxinputcontext_noimf.h | 5 ++++- src/plugins/platforms/qnx/qqnxintegration.cpp | 2 +- 5 files changed, 32 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 30ca8a5c48..0d8f430c73 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -42,6 +42,8 @@ #include "qqnxinputcontext_imf.h" #include "qqnxeventthread.h" #include "qqnxabstractvirtualkeyboard.h" +#include "qqnxintegration.h" +#include "qqnxscreen.h" #include #include @@ -645,12 +647,13 @@ static bool imfAvailable() QT_BEGIN_NAMESPACE -QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard): +QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard) : QPlatformInputContext(), m_lastCaretPos(0), m_isComposing(false), m_inputPanelVisible(false), m_inputPanelLocale(QLocale::c()), + m_integration(integration), m_virtualKeyboad(keyboard) { qInputContextDebug() << Q_FUNC_INFO; @@ -857,6 +860,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) } } +QRectF QQnxInputContext::keyboardRect() const +{ + QRect screenGeometry = m_integration->primaryDisplay()->geometry(); + return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(), + screenGeometry.width(), m_virtualKeyboard.height()); +} + void QQnxInputContext::reset() { qInputContextDebug() << Q_FUNC_INFO; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h index 72c52300bb..1980a99ed9 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h @@ -54,21 +54,24 @@ QT_BEGIN_NAMESPACE class QQnxAbstractVirtualKeyboard; +class QQnxIntegration; class QQnxInputContext : public QPlatformInputContext { Q_OBJECT public: - explicit QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard); + explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard); ~QQnxInputContext(); bool isValid() const; bool filterEvent(const QEvent *event); + QRectF keyboardRect() const; void reset(); void update(Qt::InputMethodQueries); bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); + void showInputPanel(); void hideInputPanel(); bool isInputPanelVisible() const; @@ -125,6 +128,7 @@ private: QString m_composingText; bool m_inputPanelVisible; QLocale m_inputPanelLocale; + QQnxIntegration *m_integration; QQnxAbstractVirtualKeyboard &m_virtualKeyboad; }; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 23d1f75539..98beb8ce43 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -41,6 +41,8 @@ #include "qqnxinputcontext_noimf.h" #include "qqnxabstractvirtualkeyboard.h" +#include "qqnxintegration.h" +#include "qqnxscreen.h" #include #include @@ -53,10 +55,11 @@ QT_BEGIN_NAMESPACE -QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard) : +QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard) : QPlatformInputContext(), m_inputPanelVisible(false), m_inputPanelLocale(QLocale::c()), + m_integration(integration), m_virtualKeyboard(keyboard) { connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool))); @@ -105,6 +108,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) } +QRectF QQnxInputContext::keyboardRect() const +{ + QRect screenGeometry = m_integration->primaryDisplay()->geometry(); + return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(), + screenGeometry.width(), m_virtualKeyboard.height()); +} + bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap) { Q_UNUSED(flags); diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h index c037b6afd0..3e9e929923 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h @@ -49,18 +49,20 @@ QT_BEGIN_NAMESPACE class QQnxAbstractVirtualKeyboard; +class QQnxIntegration; class QQnxInputContext : public QPlatformInputContext { Q_OBJECT public: - explicit QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard); + explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard); ~QQnxInputContext(); bool isValid() const; void reset(); bool filterEvent( const QEvent *event ); + QRectF keyboardRect() const; bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); void showInputPanel(); @@ -79,6 +81,7 @@ private: bool m_inputPanelVisible; QLocale m_inputPanelLocale; + QQnxIntegration *m_integration; QQnxAbstractVirtualKeyboard &m_virtualKeyboard; }; diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index d7370998d5..f3cfdab9c6 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -214,7 +214,7 @@ QQnxIntegration::QQnxIntegration() #if defined(QQNX_PPS) // Set up the input context - m_inputContext = new QQnxInputContext(*m_virtualKeyboard); + m_inputContext = new QQnxInputContext(this, *m_virtualKeyboard); #endif } -- cgit v1.2.3 From 5a46251de36e568513bca70b82a1d6cc9c9cb0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 29 Jan 2013 09:11:21 +0100 Subject: Fix devicePixelRatio getter for embedded QWindows. m_nsWindow is not set for non-toplevel QWindows, causing devicePixelRatio to always return 1. Use [m_contentView window] instead. Change-Id: I6689a70812c9484f103b5e706fe4c1b76406b750 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 14d62c9fca..45100f9906 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -837,11 +837,9 @@ QCocoaMenuBar *QCocoaWindow::menubar() const qreal QCocoaWindow::devicePixelRatio() const { - if (!m_nsWindow) - return 1.0; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { - return qreal([m_nsWindow backingScaleFactor]); + return qreal([[m_contentView window] backingScaleFactor]); } else #endif { -- cgit v1.2.3 From 784b9655597d2c23a00d57181b1853e6df07fdf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 7 Jan 2013 22:38:10 +0100 Subject: Cocoa: Export QImage <-> CGImage conversion funcs. For implementing to/fromMacCGImageRef in QtMacExtras. These do not depend on internal Qt state. The main reason for exporting them is to keep the implementation in one place to ease maintenance. Refactor qt_mac_cg_context to support QImage. Add qt_mac_toQImage. Change-Id: Ia9c226ed52d087b2c6b47aa8210ed8f2645b9cf2 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoahelpers.h | 3 +- src/plugins/platforms/cocoa/qcocoahelpers.mm | 55 ++++++++++++++-------- .../platforms/cocoa/qcocoanativeinterface.h | 6 +++ .../platforms/cocoa/qcocoanativeinterface.mm | 16 +++++++ src/plugins/platforms/cocoa/qcocoatheme.mm | 4 +- 5 files changed, 61 insertions(+), 23 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index b065c72e68..831ab579f5 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -158,8 +158,9 @@ public: } }; -CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); +CGContextRef qt_mac_cg_context(QPaintDevice *pdev); CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy); +QImage qt_mac_toQImage(CGImageRef image); QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 0c5d26054c..91a6f5a4c7 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -719,35 +719,38 @@ QString qt_mac_removeAmpersandEscapes(QString s) \warning This function is only available on Mac OS X. \warning This function is duplicated in qmacstyle_mac.mm */ -CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) +CGContextRef qt_mac_cg_context(QPaintDevice *pdev) { - if (pdev->devType() == QInternal::Pixmap) { - const QPixmap *pm = static_cast(pdev); - CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev); - uint flags = kCGImageAlphaPremultipliedFirst; - flags |= kCGBitmapByteOrder32Host; - CGContextRef ret = 0; + // In Qt 5, QWidget and QPixmap (and QImage) paint devices are all QImages under the hood. + QImage *image = 0; + if (pdev->devType() == QInternal::Image) { + image = static_cast(pdev); + } else if (pdev->devType() == QInternal::Pixmap) { + const QPixmap *pm = static_cast(pdev); QPlatformPixmap *data = const_cast(pm)->data_ptr().data(); if (data && data->classId() == QPlatformPixmap::RasterClass) { - QImage *image = data->buffer(); - ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), - 8, image->bytesPerLine(), colorspace, flags); + image = data->buffer(); } else { qDebug() << "qt_mac_cg_context: Unsupported pixmap class"; } - - CGContextTranslateCTM(ret, 0, pm->height()); - CGContextScaleCTM(ret, 1, -1); - return ret; } else if (pdev->devType() == QInternal::Widget) { - //CGContextRef ret = static_cast(static_cast(pdev)->macCGHandle()); - ///CGContextRetain(ret); - //return ret; + // TODO test: image = static_cast(static_cast(pdev)->backingStore()->paintDevice()); qDebug() << "qt_mac_cg_context: not implemented: Widget class"; - return 0; } - return 0; + + if (!image) + return 0; // Context type not supported. + + CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev); + uint flags = kCGImageAlphaPremultipliedFirst; + flags |= kCGBitmapByteOrder32Host; + CGContextRef ret = 0; + ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), + 8, image->bytesPerLine(), colorspace, flags); + CGContextTranslateCTM(ret, 0, image->height()); + CGContextScaleCTM(ret, 1, -1); + return ret; } CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) @@ -841,4 +844,18 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) return cgImage; } +QImage qt_mac_toQImage(CGImageRef image) +{ + const size_t w = CGImageGetWidth(image), + h = CGImageGetHeight(image); + QImage ret(w, h, QImage::Format_ARGB32_Premultiplied); + ret.fill(Qt::transparent); + CGRect rect = CGRectMake(0, 0, w, h); + CGContextRef ctx = qt_mac_cg_context(&ret); + qt_mac_drawCGImage(ctx, &rect, image); + CGContextRelease(ctx); + return ret; +} + + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index 592ede4617..9506f86238 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -42,6 +42,8 @@ #ifndef QCOCOANATIVEINTERFACE_H #define QCOCOANATIVEINTERFACE_H +#include + #include QT_BEGIN_NAMESPACE @@ -96,6 +98,10 @@ private: // Dock menu support static void setDockMenu(QPlatformMenu *platformMenu); + + // QImage <-> CGImage conversion functions + static CGImageRef qImageToCGImage(const QImage &image); + static QImage cgImageToQImage(CGImageRef image); }; #endif // QCOCOANATIVEINTERFACE_H diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 14bb82bc7e..bd3a909137 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -45,6 +45,7 @@ #include "qcocoamenu.h" #include "qcocoamenubar.h" #include "qmacmime.h" +#include "qcocoahelpers.h" #include #include @@ -108,6 +109,10 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerDraggedTypes); if (resource.toLower() == "setdockmenu") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setDockMenu); + if (resource.toLower() == "qimagetocgimage") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::qImageToCGImage); + if (resource.toLower() == "cgimagetoqimage") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::cgImageToQImage); return 0; } @@ -183,4 +188,15 @@ void QCocoaNativeInterface::setDockMenu(QPlatformMenu *platformMenu) [NSApp setDockMenu: menu]; } +CGImageRef QCocoaNativeInterface::qImageToCGImage(const QImage &image) +{ + return qt_mac_toCGImage(image, false, 0); +} + +QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image) +{ + return qt_mac_toQImage(image); +} + + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 0845ab8e94..beaa50da6d 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -53,6 +53,7 @@ #include "qcocoamenuitem.h" #include "qcocoamenu.h" #include "qcocoamenubar.h" +#include "qcocoahelpers.h" #include #include @@ -137,9 +138,6 @@ const QFont *QCocoaTheme::font(Font type) const return m_fonts.value(type, 0); } -// Defined in qpaintengine_mac.mm -extern CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); - //! \internal QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height) { -- cgit v1.2.3 From 3fb356f531159c3ce09e13ea7e9e2a9aaf1be465 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Tue, 12 Feb 2013 15:53:59 +0000 Subject: QNX: Fix qFatal() statements. "QQNXQBBWindow" doesn't make sense. Change-Id: I0e56d5be4a9bb7a0336f71ea3348621be730dee1 Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxglcontext.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index aa748fc852..1c2ec23fa9 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -150,13 +150,13 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) // Select EGL config based on requested window format m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format); if (m_eglConfig == 0) { - qFatal("QQNXQBBWindow: failed to find EGL config"); + qFatal("QQnxGLContext: failed to find EGL config"); } m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttrs()); if (m_eglContext == EGL_NO_CONTEXT) { checkEGLError("eglCreateContext"); - qFatal("QQNXQBBWindow: failed to create EGL context, err=%d", eglGetError()); + qFatal("QQnxGLContext: failed to create EGL context, err=%d", eglGetError()); } // Query/cache window format of selected EGL config @@ -184,13 +184,13 @@ void QQnxGLContext::initialize() ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (ms_eglDisplay == EGL_NO_DISPLAY) { checkEGLError("eglGetDisplay"); - qFatal("QQNXQBBWindow: failed to obtain EGL display"); + qFatal("QQnxGLContext: failed to obtain EGL display"); } EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0); if (eglResult != EGL_TRUE) { checkEGLError("eglInitialize"); - qFatal("QQNXQBBWindow: failed to initialize EGL display, err=%d", eglGetError()); + qFatal("QQnxGLContext: failed to initialize EGL display, err=%d", eglGetError()); } } @@ -217,7 +217,7 @@ bool QQnxGLContext::makeCurrent(QPlatformSurface *surface) // Set current rendering API EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); if (eglResult != EGL_TRUE) { - qFatal("QQNXQBBWindow: failed to set EGL API, err=%d", eglGetError()); + qFatal("QQnxGLContext: failed to set EGL API, err=%d", eglGetError()); } if (m_newSurfaceRequested.testAndSetOrdered(true, false)) { -- cgit v1.2.3 From 3a2276c6f3fb4a38ae5946eab5baf32ee99f4231 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Tue, 12 Feb 2013 16:11:47 +0200 Subject: QNX: Fix QInputMethod::keyboardRectangleChanged() signal Change-Id: Iad3ee07ba85854d2eb0cf36710643b75993bf61c Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp | 6 ++++++ src/plugins/platforms/qnx/qqnxinputcontext_noimf.h | 1 + 2 files changed, 7 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 98beb8ce43..71b925357a 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -62,6 +62,7 @@ QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVir m_integration(integration), m_virtualKeyboard(keyboard) { + connect(&keyboard, SIGNAL(heightChanged(int)), this, SLOT(keyboardHeightChanged())); connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool))); connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale))); keyboardVisibilityChanged(keyboard.isVisible()); @@ -147,6 +148,11 @@ QLocale QQnxInputContext::locale() const return m_inputPanelLocale; } +void QQnxInputContext::keyboardHeightChanged() +{ + emitKeyboardRectChanged(); +} + void QQnxInputContext::keyboardVisibilityChanged(bool visible) { qInputContextDebug() << Q_FUNC_INFO << "visible=" << visible; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h index 3e9e929923..1ecf7cc94e 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h @@ -73,6 +73,7 @@ public: void setFocusObject(QObject *object); private Q_SLOTS: + void keyboardHeightChanged(); void keyboardVisibilityChanged(bool visible); void keyboardLocaleChanged(const QLocale &locale); -- cgit v1.2.3 From 82eaff97d1e7227e7a566b8576ca76f9dd447c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Mon, 4 Feb 2013 15:51:35 +0100 Subject: Don't ignore QSurfaceFormat::Options in the XCB plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The XCB plugin requested a forward-compatible context regardless of whether QSurfaceFormat::DeprecatedFunctions was set, and also ignored the QSurfaceFormat::DebugContext option. Change-Id: I81c737447b554b3b6f61c2725bce7583e0e887ab Reviewed-by: Sean Harmer Reviewed-by: Giuseppe D'Angelo Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qglxintegration.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 80fcbbebc6..23bec15b48 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -305,14 +305,24 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat // If asking for OpenGL 3.2 or newer we should also specify a profile if (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1)) { - if (m_format.profile() == QSurfaceFormat::CoreProfile) { - contextAttributes << GLX_CONTEXT_FLAGS_ARB << GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB - << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - } else { + if (m_format.profile() == QSurfaceFormat::CoreProfile) + contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + else contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - } } + int flags = 0; + + if (m_format.testOption(QSurfaceFormat::DebugContext)) + flags |= GLX_CONTEXT_DEBUG_BIT_ARB; + + // A forward-compatible context may be requested for 3.0 and later + if (m_format.majorVersion() >= 3 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions)) + flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + + if (flags != 0) + contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags; + contextAttributes << None; m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data()); -- cgit v1.2.3