From 168f32f3f42a2407858105aff10143eebabbd5a6 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 30 Nov 2012 10:59:07 +0100 Subject: Removed temporary backwards-compat properties and accessors in QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I718b877e3b6c0b1191a932d934599d5c2f5aa958 Reviewed-by: Shawn Rutledge Reviewed-by: Samuel Rødal --- src/plugins/platforms/eglfs/qeglfswindow.cpp | 2 +- src/plugins/platforms/qnx/qqnxscreen.cpp | 2 +- src/plugins/platforms/qnx/qqnxwindow.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index 32d20e6aaa..df665cea84 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -75,7 +75,7 @@ void QEglFSWindow::create() if (m_window) return; - if (window()->windowType() == Qt::Desktop) { + if (window()->type() == Qt::Desktop) { QRect rect(QPoint(), hooks->screenSize()); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 593bec8458..8b413de4fb 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -425,7 +425,7 @@ void QQnxScreen::addWindow(QQnxWindow *window) // Such a situation would strangely break focus handling due to the // invisible desktop widget window being layered on top of normal // windows - if (window->window()->windowType() == Qt::Desktop) + if (window->window()->type() == Qt::Desktop) m_childWindows.push_front(window); else m_childWindows.push_back(window); diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index e4505c6c60..787f371ca6 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -511,8 +511,8 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) Q_FOREACH (QQnxWindow *childWindow, m_childWindows) { // Only subwindows and tooltips need necessarily be moved to another display with the window. - if ((window()->windowType() & Qt::WindowType_Mask) == Qt::SubWindow || - (window()->windowType() & Qt::WindowType_Mask) == Qt::ToolTip) + if ((window()->type() & Qt::WindowType_Mask) == Qt::SubWindow || + (window()->type() & Qt::WindowType_Mask) == Qt::ToolTip) childWindow->setScreen(platformScreen); } -- cgit v1.2.3 From 5021c1d977c7f29379c049e57316364236f91aab Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 12 Oct 2012 17:33:51 +0200 Subject: xcb: notify when the logical DPI changes; add Q_MM_PER_INCH constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I15696bf45ae99cc5b0fd95dab4884fc85cbfc6da Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbscreen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 6452186bbf..4f0c3ba6bb 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -50,6 +50,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -242,8 +243,8 @@ QImage::Format QXcbScreen::format() const QDpi QXcbScreen::logicalDpi() const { - return QDpi(25.4 * m_virtualSize.width() / m_virtualSizeMillimeters.width(), - 25.4 * m_virtualSize.height() / m_virtualSizeMillimeters.height()); + return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), + Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); } QPlatformCursor *QXcbScreen::cursor() const @@ -315,6 +316,9 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry()); QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), availableGeometry()); QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation); + QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QPlatformScreen::screen(), + Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), + Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); } void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) -- cgit v1.2.3 From edb4e66f5f81f2b62ed0664bf9654c36ebbf315c Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Fri, 30 Nov 2012 11:27:34 +0100 Subject: Mac: fix regression to make dialog resizable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-28254 Change-Id: I8623a68d589bec17042935ad308f85ddc953540d Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f786e6969f..8ef489e28e 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -372,9 +372,9 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) if (flags == Qt::Window) { styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask); } else if ((flags & Qt::Dialog) && (window()->modality() != Qt::NonModal)) { - styleMask = NSTitledWindowMask; + styleMask = NSResizableWindowMask | NSTitledWindowMask; } else if (!(flags & Qt::FramelessWindowHint)) { - if (flags & Qt::WindowMaximizeButtonHint) + if ((flags & Qt::Dialog) || (flags & Qt::WindowMaximizeButtonHint)) styleMask |= NSResizableWindowMask; if (flags & Qt::WindowTitleHint) styleMask |= NSTitledWindowMask; -- cgit v1.2.3 From 2dc2f1a28eaf96e933d573c8bde1858c185b69db Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Mon, 3 Dec 2012 18:43:44 -0200 Subject: QNX: Fix plugin compilation Fix the plugin compilation after cd34da54269e6cd7fa5c18242d982736f022a14a renamed the QWindow API. Change-Id: I3ec4ce9ae2df9a66f6bf24a18277bc59c05d2e8e Reviewed-by: Lars Knoll Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 787f371ca6..af7a89a399 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -269,7 +269,7 @@ void QQnxWindow::setVisible(bool visible) root->updateVisibility(root->m_visible); - window()->requestActivateWindow(); + window()->requestActivate(); if (window()->isTopLevel() && visible) QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); -- cgit v1.2.3 From 5ea41a2efa67c2ca1fe13a00992a8b7cb29a00cf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 3 Dec 2012 21:15:02 +0100 Subject: properly syncqt-ize harfbuzz headers we were already installing them into QtCore/private, so turn them into proper private headers to start with. this cleans up our project files. Change-Id: I0795f79e03b60b5854de9e4dc339e9b5a5e6fd87 Reviewed-by: Lars Knoll Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/windows.pro | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 794bd3aa35..248c0992bf 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -7,8 +7,6 @@ QT *= core-private QT *= gui-private QT *= platformsupport-private -INCLUDEPATH += ../../../3rdparty/harfbuzz/src - # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. LIBS *= -lole32 !wince*:LIBS *= -lgdi32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32 -- cgit v1.2.3 From f6cc1f3aeae795e7ed67338b17b860df9f5146a7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 3 Dec 2012 22:03:53 +0100 Subject: Ensure ctrl + click sends a right mouse button press in Cocoa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Mac's typically just have one button for their mice then pressing Control then clicking the button should end it as a right mouse button event. Task-number: QTBUG-28350 Change-Id: Iabcac5b315c36cb8cd062c27d7b1506bc066f5bb Reviewed-by: Liang Qi Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.h | 1 + src/plugins/platforms/cocoa/qnsview.mm | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index f93fd86205..9cdfe6f5bb 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -66,6 +66,7 @@ QT_END_NAMESPACE QString m_composingText; bool m_sendKeyEvent; QStringList *currentCustomDragTypes; + bool m_sendUpAsRightButton; Qt::KeyboardModifiers currentWheelModifiers; bool m_subscribesForGlobalFrameNotifications; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index b608989e43..eea65cf8c0 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -84,6 +84,7 @@ static QTouchDevice *touchDevice = 0; m_sendKeyEvent = false; m_subscribesForGlobalFrameNotifications = false; currentCustomDragTypes = 0; + m_sendUpAsRightButton = false; if (!touchDevice) { touchDevice = new QTouchDevice; @@ -427,6 +428,7 @@ static QTouchDevice *touchDevice = 0; - (void)mouseDown:(NSEvent *)theEvent { + m_sendUpAsRightButton = false; if (m_platformWindow->m_activePopupWindow) { QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow); QWindowSystemInterface::flushWindowSystemEvents(); @@ -438,7 +440,12 @@ static QTouchDevice *touchDevice = 0; [inputManager handleMouseEvent:theEvent]; } } else { - m_buttons |= Qt::LeftButton; + if ([self convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) { + m_buttons |= Qt::RightButton; + m_sendUpAsRightButton = true; + } else { + m_buttons |= Qt::LeftButton; + } [self handleMouseEvent:theEvent]; } } @@ -452,7 +459,12 @@ static QTouchDevice *touchDevice = 0; - (void)mouseUp:(NSEvent *)theEvent { - m_buttons &= QFlag(~int(Qt::LeftButton)); + if (m_sendUpAsRightButton) { + m_buttons &= QFlag(~int(Qt::RightButton)); + m_sendUpAsRightButton = false; + } else { + m_buttons &= QFlag(~int(Qt::LeftButton)); + } [self handleMouseEvent:theEvent]; } -- cgit v1.2.3 From 3b5537765e13a981ca6029c322d08afb785e0dbe Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 4 Dec 2012 18:05:09 +0100 Subject: QWindowsFontDatabase: provide better fallbackFamilies. Borrowed some code from QWindowsFontDatabase::createEngine that will help ensure our fallback options are thorough enough to display say chinese glyphs when using the QRawFont + QTextLayout combination that QtWebKit relies on. Task-number: QTWEBKIT-383 Change-Id: Ie4c1d5ef7d58588afaa436c89a9575ffd646c314 Reviewed-by: Simon Hausmann --- .../platforms/windows/qwindowsfontdatabase.cpp | 161 +++++++++++---------- 1 file changed, 87 insertions(+), 74 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 76fe5f1a43..262b610745 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1300,43 +1300,6 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal return fontEngine; } -QStringList QWindowsFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const -{ - QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); - if (!result.isEmpty()) - return result; - - switch (styleHint) { - case QFont::Times: - result << QString::fromLatin1("Times New Roman"); - break; - case QFont::Courier: - result << QString::fromLatin1("Courier New"); - break; - case QFont::Monospace: - result << QString::fromLatin1("Courier New"); - break; - case QFont::Cursive: - result << QString::fromLatin1("Comic Sans MS"); - break; - case QFont::Fantasy: - result << QString::fromLatin1("Impact"); - break; - case QFont::Decorative: - result << QString::fromLatin1("Old English"); - break; - case QFont::Helvetica: - case QFont::System: - default: - result << QString::fromLatin1("Arial"); - } - - if (QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << family << style << styleHint - << script << result << m_families.size(); - return result; -} - static QList getTrueTypeFontOffsets(const uchar *fontData) { QList offsets; @@ -1688,6 +1651,82 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) return lf; } +static QStringList extraTryFontsForFamily(const QString& family) +{ + QStringList result; + QFontDatabase db; + if (!db.writingSystems(family).contains(QFontDatabase::Symbol)) { + if (!tryFonts) { + LANGID lid = GetUserDefaultLangID(); + switch (lid&0xff) { + case LANG_CHINESE: // Chinese (Taiwan) + if ( lid == 0x0804 ) // Taiwan + tryFonts = ch_TW_tryFonts; + else + tryFonts = ch_CN_tryFonts; + break; + case LANG_JAPANESE: + tryFonts = jp_tryFonts; + break; + case LANG_KOREAN: + tryFonts = kr_tryFonts; + break; + default: + tryFonts = other_tryFonts; + break; + } + } + QStringList fm = QFontDatabase().families(); + const char **tf = tryFonts; + while (tf && *tf) { + if (fm.contains(QLatin1String(*tf))) + result << QLatin1String(*tf); + ++tf; + } + } + return result; +} + +QStringList QWindowsFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const +{ + QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); + if (!result.isEmpty()) + return result; + + switch (styleHint) { + case QFont::Times: + result << QString::fromLatin1("Times New Roman"); + break; + case QFont::Courier: + result << QString::fromLatin1("Courier New"); + break; + case QFont::Monospace: + result << QString::fromLatin1("Courier New"); + break; + case QFont::Cursive: + result << QString::fromLatin1("Comic Sans MS"); + break; + case QFont::Fantasy: + result << QString::fromLatin1("Impact"); + break; + case QFont::Decorative: + result << QString::fromLatin1("Old English"); + break; + case QFont::Helvetica: + case QFont::System: + default: + result << QString::fromLatin1("Arial"); + } + + result.append(extraTryFontsForFamily(family)); + + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << family << style << styleHint + << script << result << m_families.size(); + return result; +} + + QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &request, HDC fontHdc, int dpi, bool rawMode, const QStringList &family_list, @@ -1850,43 +1889,17 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ directWriteFont->Release(); #endif - if(script == QUnicodeTables::Common - && !(request.styleStrategy & QFont::NoFontMerging)) { - QFontDatabase db; - if (!db.writingSystems(request.family).contains(QFontDatabase::Symbol)) { - if(!tryFonts) { - LANGID lid = GetUserDefaultLangID(); - switch( lid&0xff ) { - case LANG_CHINESE: // Chinese (Taiwan) - if ( lid == 0x0804 ) // Taiwan - tryFonts = ch_TW_tryFonts; - else - tryFonts = ch_CN_tryFonts; - break; - case LANG_JAPANESE: - tryFonts = jp_tryFonts; - break; - case LANG_KOREAN: - tryFonts = kr_tryFonts; - break; - default: - tryFonts = other_tryFonts; - break; - } - } - QStringList fm = QFontDatabase().families(); - QStringList list = family_list; - const char **tf = tryFonts; - while(tf && *tf) { - if(fm.contains(QLatin1String(*tf))) - list << QLatin1String(*tf); - ++tf; - } - QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list); - mfe->setObjectName(QStringLiteral("QWindowsMultiFontEngine_") + request.family); - mfe->fontDef = fe->fontDef; - fe = mfe; - } + if (script == QUnicodeTables::Common + && !(request.styleStrategy & QFont::NoFontMerging)) { + QStringList extraFonts = extraTryFontsForFamily(request.family); + if (extraFonts.size()) { + QStringList list = family_list; + list.append(extraFonts); + QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list); + mfe->setObjectName(QStringLiteral("QWindowsMultiFontEngine_") + request.family); + mfe->fontDef = fe->fontDef; + fe = mfe; + } } return fe; } -- cgit v1.2.3 From fd4106e2d110a361208a6289cee18c5847377cb1 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 5 Dec 2012 11:36:25 +0100 Subject: Cocoa: fix unresponsive dialogs causes application to hang The reason for this bug seems to be related to how we wait for more events in the event dispatcher. We use the nextEventMatchingMask function, which already in Qt4 showed to have problems when telling it to not dequeue the event. The solution back then was to tell it to dequeue the event, and instead repost in front again. Why this was changed in Qt5 is uncertain (other than it being tempting) but moving the same code back in will solve the bug. Note that this bug might also stem from the fact that the run loop sources we add in the event dispatcher fires before the application is really ready to show modal dialogs. E.g refusing to execute a modal dialog before NSAppDelegate applicationWillFinishLaunching is called will also fix the problem. But this code change is to big atm, and can easily introduce other unforeseen regressions. Task-number: QTBUG-28283 Change-Id: I07cd109568c2b9c782cf5120a9eb2ac71128cada Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 7aa365df67..80c9e227d2 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -510,14 +510,16 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRunLoopMode) { - // If no event exist in the cocoa event que, wait - // (and free up cpu time) until at least one event occur. - // This implementation is a bit on the edge, but seems to - // work fine: - [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate distantFuture] - inMode:runLoopMode - dequeue:NO]; + // If no event exist in the cocoa event que, wait (and free up cpu time) until + // at least one event occur. Setting 'dequeuing' to 'no' in the following call + // causes it to hang under certain circumstances (QTBUG-28283), so we tell it + // to dequeue instead, just to repost the event again: + NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantFuture] + inMode:runLoopMode + dequeue:YES]; + if (event) + [NSApp postEvent:event atStart:YES]; } bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) -- cgit v1.2.3 From 0c5e2328284e97a293e1153c6ad1bcd2706e044a Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Wed, 5 Dec 2012 11:42:58 +0100 Subject: Compile with QT_NO_CURSOR. Mostly straightforward, the a11y changes might look a bit drastic, but the base class QAccessibleTextWidget was already disabled in this case, so we have to obviously take out its sub-classes as well. Change-Id: I682ace20d6938688ddb1da23c3463f3c025fab8e Reviewed-by: Marc Mutz Reviewed-by: Tasuku Suzuki Reviewed-by: Frederik Gladhorn Reviewed-by: Lars Knoll Reviewed-by: Nicolas Arnaud-Cormos --- src/plugins/platforms/directfb/qdirectfbcursor.cpp | 4 ++++ src/plugins/platforms/directfb/qdirectfbcursor.h | 4 ++++ src/plugins/platforms/eglfs/qeglfscursor.cpp | 4 ++++ src/plugins/platforms/eglfs/qeglfscursor.h | 4 ++++ src/plugins/platforms/xcb/qxcbcursor.cpp | 2 ++ src/plugins/platforms/xcb/qxcbcursor.h | 6 ++++++ 6 files changed, 24 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp index 1ff71f3e63..b04848ec40 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -47,9 +47,12 @@ QT_BEGIN_NAMESPACE QDirectFBCursor::QDirectFBCursor(QPlatformScreen *screen) : m_screen(screen) { +#ifndef QT_NO_CURSOR m_image.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0)); +#endif } +#ifndef QT_NO_CURSOR void QDirectFBCursor::changeCursor(QCursor *cursor, QWindow *) { int xSpot; @@ -82,5 +85,6 @@ void QDirectFBCursor::changeCursor(QCursor *cursor, QWindow *) layer->SetCursorShape(layer, surface, xSpot, ySpot); layer->SetCooperativeLevel(layer, DLSCL_SHARED); } +#endif QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h index bd11b97467..21f205a5a1 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.h +++ b/src/plugins/platforms/directfb/qdirectfbcursor.h @@ -56,10 +56,14 @@ class QDirectFBCursor : public QPlatformCursor { public: QDirectFBCursor(QPlatformScreen *screen); +#ifndef QT_NO_CURSOR void changeCursor(QCursor *cursor, QWindow *window); +#endif private: +#ifndef QT_NO_CURSOR QScopedPointer m_image; +#endif QPlatformScreen *m_screen; }; diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/qeglfscursor.cpp index 85bc8679f2..b29849226f 100644 --- a/src/plugins/platforms/eglfs/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/qeglfscursor.cpp @@ -55,8 +55,10 @@ QEglFSCursor::QEglFSCursor(QEglFSScreen *screen) initCursorAtlas(); // initialize the cursor +#ifndef QT_NO_CURSOR QCursor cursor(Qt::ArrowCursor); setCurrentCursor(&cursor); +#endif } QEglFSCursor::~QEglFSCursor() @@ -183,6 +185,7 @@ void QEglFSCursor::initCursorAtlas() m_cursorAtlas.image = image; } +#ifndef QT_NO_CURSOR void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window) { Q_UNUSED(window); @@ -221,6 +224,7 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) return true; } +#endif void QEglFSCursor::update(const QRegion &rgn) { diff --git a/src/plugins/platforms/eglfs/qeglfscursor.h b/src/plugins/platforms/eglfs/qeglfscursor.h index 9a91b73894..1c82abdb44 100644 --- a/src/plugins/platforms/eglfs/qeglfscursor.h +++ b/src/plugins/platforms/eglfs/qeglfscursor.h @@ -57,7 +57,9 @@ public: QEglFSCursor(QEglFSScreen *screen); ~QEglFSCursor(); +#ifndef QT_NO_CURSOR void changeCursor(QCursor *cursor, QWindow *widget) Q_DECL_OVERRIDE; +#endif void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE; QPoint pos() const Q_DECL_OVERRIDE; @@ -68,7 +70,9 @@ public: virtual void paintOnScreen(); protected: +#ifndef QT_NO_CURSOR bool setCurrentCursor(QCursor *cursor); +#endif void draw(const QRectF &rect); void update(const QRegion ®ion); diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index c1cfbd02d6..e1dfe3d6c0 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -291,6 +291,7 @@ QXcbCursor::~QXcbCursor() xcb_close_font(xcb_connection(), cursorFont); } +#ifndef QT_NO_CURSOR void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget) { QXcbWindow *w = 0; @@ -507,6 +508,7 @@ xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor) } return c; } +#endif void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask) { diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index 4c74034988..a4f3bf11ee 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -52,20 +52,26 @@ class QXcbCursor : public QXcbObject, public QPlatformCursor public: QXcbCursor(QXcbConnection *conn, QXcbScreen *screen); ~QXcbCursor(); +#ifndef QT_NO_CURSOR void changeCursor(QCursor *cursor, QWindow *widget); +#endif QPoint pos() const; void setPos(const QPoint &pos); static void queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint *pos, int *keybMask = 0); private: +#ifndef QT_NO_CURSOR xcb_cursor_t createFontCursor(int cshape); xcb_cursor_t createBitmapCursor(QCursor *cursor); xcb_cursor_t createNonStandardCursor(int cshape); +#endif QXcbScreen *m_screen; +#ifndef QT_NO_CURSOR QMap m_shapeCursorMap; QMap m_bitmapCursorMap; +#endif }; QT_END_NAMESPACE -- cgit v1.2.3 From e84e86dc8cdab602ed19c18829e57230687a427c Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Thu, 6 Dec 2012 17:46:07 +0100 Subject: Update QNSView geometry on window resize. Ideally this should not be required since NSWindow should resize the content view automatically. However, in the case of modal QDialogs this does not happen. Add call to updateGeometry in windowDidResize as a workaround, and remove code which called QNSView::setFrameSize with the current size. This will cause duplicate handleGeometryChange calls in the non-qdialog case, add a test to see if the geometry really has changed to prevent that. Change-Id: I29bea23b2ab72f923aeadf8db8cb9131ae177a28 Reviewed-by: Liang Qi --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +--- src/plugins/platforms/cocoa/qnsview.mm | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 8ef489e28e..ffee8528f0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -590,9 +590,7 @@ void QCocoaWindow::windowDidResize() if (!m_nsWindow) return; - NSRect rect = [[m_nsWindow contentView]frame]; - // Call setFrameSize which will trigger a frameDidChangeNotification on QNSView. - [[m_nsWindow contentView] setFrameSize:rect.size]; + [m_contentView updateGeometry]; } void QCocoaWindow::windowWillClose() diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index eea65cf8c0..1f19b07904 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -185,6 +185,9 @@ static QTouchDevice *touchDevice = 0; geometry = qt_mac_toQRect([self frame]); } + if (geometry == m_platformWindow->geometry()) + return; + #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG qDebug() << "QNSView::udpateGeometry" << m_platformWindow << geometry; #endif -- cgit v1.2.3 From 9650a5aa25b5750c571326380490c191c62fd6a1 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Tue, 4 Dec 2012 15:19:27 +0100 Subject: Avoid backing store color space conversions. We want the Qt backing store to be in the device color space by default. This will avoid colour space conversions when blitting it to screen, at the cost of a potential loss in color accuracy. As it turns out, CGColorSpaceCreateDeviceRGB no longer crates a device color space but rather a generic color space. (Since 10.4). Create the color space with a system profile instead. Accurate color representation needs to be supported at some point, but this fast path should be the default. Change-Id: I7ebb77b36f81f66119d8c2ef464723401ec1d1e8 Reviewed-by: Gabriel de Dietrich Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 008d9da2cf..0d0d2eb106 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -789,7 +789,21 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) NULL, false); } else { - CGColorSpaceRef cgColourSpaceRef = CGColorSpaceCreateDeviceRGB(); + // Try get a device color space. Using the device color space means + // that the CGImage can be drawn to screen without per-pixel color + // space conversion, at the cost of less color accuracy. + CGColorSpaceRef cgColourSpaceRef = 0; + CMProfileRef sysProfile; + if (CMGetSystemProfile(&sysProfile) == noErr) + { + cgColourSpaceRef = CGColorSpaceCreateWithPlatformColorSpace(sysProfile); + CMCloseProfile(sysProfile); + } + + // Fall back to Generic RGB if a profile was not found. + if (!cgColourSpaceRef) + cgColourSpaceRef = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); + cgImage = CGImageCreate(width, height, colorBufferSize, -- cgit v1.2.3 From 2e142143579c0db098d966d40ddc871c9c7119f9 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Tue, 4 Dec 2012 15:26:02 +0100 Subject: Use the "copy" blend mode for backingstore drawing The default is a "source over", but we want to completely replace the destination pixels. (Which is slightly faster). Change-Id: I4916765258a2236f70f58a8e20b06f80739183c1 Reviewed-by: Gabriel de Dietrich Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qnsview.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 1f19b07904..f0ece54d20 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -316,6 +316,7 @@ static QTouchDevice *touchDevice = 0; ); CGImageRef bsCGImage = m_backingStore->getBackingStoreCGImage(); CGImageRef cleanImg = CGImageCreateWithImageInRect(bsCGImage, backingStoreRect); + CGContextSetBlendMode(cgContext, kCGBlendModeCopy); CGContextDrawImage(cgContext, dirtyWindowRect, cleanImg); // Clean-up: -- cgit v1.2.3 From 13fcd1c342b7d60640fb82956149d00f1ee2f3c7 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Tue, 4 Dec 2012 17:02:59 +0100 Subject: Set CGImage format when converting from QImage. Set the CGImage format based on QImage::format(). Handle8-bit per component (A)RGB. Change-Id: I041b0ee53d3943a0aaf9e813eb0a235c4de619dd Reviewed-by: Gabriel de Dietrich Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 0d0d2eb106..c1146612a6 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -804,13 +804,34 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) if (!cgColourSpaceRef) cgColourSpaceRef = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); + // Create a CGBitmapInfo contiaining the image format. + // Support the 8-bit per component (A)RGB formats. + CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Little; + switch (qImage.format()) { + case QImage::Format_ARGB32_Premultiplied : + bitmapInfo |= kCGImageAlphaPremultipliedFirst; + break; + case QImage::Format_ARGB32 : + bitmapInfo |= kCGImageAlphaFirst; + break; + case QImage::Format_RGB32 : + bitmapInfo |= kCGImageAlphaNoneSkipFirst; + break; + case QImage::Format_RGB888 : + bitmapInfo |= kCGImageAlphaNone; + break; + default: + qWarning() << "qt_mac_toCGImage: Unsupported image format" << qImage.format(); + break; + } + cgImage = CGImageCreate(width, height, colorBufferSize, bitDepth, bytesPrLine, cgColourSpaceRef, - kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, + bitmapInfo, cgDataProviderRef, NULL, false, -- cgit v1.2.3 From b9321a1a5f1b255e5e5860edb42c63a4e4da6804 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Mon, 22 Oct 2012 10:41:28 +0200 Subject: Implement Cocoa KeyMapper. Port Qt 4 implementation. Shortcuts such as shift-5 should now work. Change-Id: I1d8c4c6c4a903142361996b558ee31c8549fcef6 Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff Reviewed-by: Lars Knoll --- src/plugins/platforms/cocoa/cocoa.pro | 2 + src/plugins/platforms/cocoa/qcocoaintegration.h | 4 + src/plugins/platforms/cocoa/qcocoaintegration.mm | 6 + src/plugins/platforms/cocoa/qcocoakeymapper.h | 111 ++++++ src/plugins/platforms/cocoa/qcocoakeymapper.mm | 468 +++++++++++++++++++++++ src/plugins/platforms/cocoa/qnsview.mm | 15 +- 6 files changed, 604 insertions(+), 2 deletions(-) create mode 100644 src/plugins/platforms/cocoa/qcocoakeymapper.h create mode 100644 src/plugins/platforms/cocoa/qcocoakeymapper.mm (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 78fcf20afc..f709bef633 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -38,6 +38,7 @@ OBJECTIVE_SOURCES += main.mm \ qcocoaservices.mm \ qcocoasystemtrayicon.mm \ qcocoaintrospection.mm \ + qcocoakeymapper.mm \ HEADERS += qcocoaintegration.h \ qcocoatheme.h \ @@ -72,6 +73,7 @@ HEADERS += qcocoaintegration.h \ qcocoaservices.h \ qcocoasystemtrayicon.h \ qcocoaintrospection.h \ + qcocoakeymapper.h \ RESOURCES += qcocoaresources.qrc diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 1bb46ea3ea..e455a3552e 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -49,6 +49,7 @@ #include "qcocoaclipboard.h" #include "qcocoadrag.h" #include "qcocoaservices.h" +#include "qcocoakeymapper.h" #include #include @@ -121,6 +122,8 @@ public: QPlatformServices *services() const; QVariant styleHint(StyleHint hint) const; + QList possibleKeys(const QKeyEvent *event) const; + void updateScreens(); private: @@ -138,6 +141,7 @@ private: QScopedPointer mCocoaDrag; QScopedPointer mNativeInterface; QScopedPointer mServices; + QScopedPointer mKeyboardMapper; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 393c471c25..e096096e99 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -199,6 +199,7 @@ QCocoaIntegration::QCocoaIntegration() , mCocoaDrag(new QCocoaDrag) , mNativeInterface(new QCocoaNativeInterface) , mServices(new QCocoaServices) + , mKeyboardMapper(new QCocoaKeyMapper) { initResources(); QCocoaAutoReleasePool pool; @@ -414,4 +415,9 @@ QVariant QCocoaIntegration::styleHint(StyleHint hint) const return QPlatformIntegration::styleHint(hint); } +QList QCocoaIntegration::possibleKeys(const QKeyEvent *event) const +{ + return mKeyboardMapper->possibleKeys(event); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.h b/src/plugins/platforms/cocoa/qcocoakeymapper.h new file mode 100644 index 0000000000..693539dd4e --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoakeymapper.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOCOAKEYMAPPER_H +#define QCOCOAKEYMAPPER_H + +#include + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +/* + \internal + A Mac KeyboardLayoutItem has 8 possible states: + 1. Unmodified + 2. Shift + 3. Control + 4. Control + Shift + 5. Alt + 6. Alt + Shift + 7. Alt + Control + 8. Alt + Control + Shift + 9. Meta + 10. Meta + Shift + 11. Meta + Control + 12. Meta + Control + Shift + 13. Meta + Alt + 14. Meta + Alt + Shift + 15. Meta + Alt + Control + 16. Meta + Alt + Control + Shift +*/ +struct KeyboardLayoutItem { + bool dirty; + quint32 qtKey[16]; // Can by any Qt::Key_, or unicode character +}; + + +class QCocoaKeyMapper +{ +public: + QCocoaKeyMapper(); + ~QCocoaKeyMapper(); + QList possibleKeys(const QKeyEvent *event) const; + bool updateKeyboard(); + void deleteLayouts(); + void updateKeyMap(unsigned short macVirtualKey, QChar unicodeKey); + void clearMappings(); + +private: + QCFType currentInputSource; + + QLocale keyboardInputLocale; + Qt::LayoutDirection keyboardInputDirection; + enum { NullMode, UnicodeMode, OtherMode } keyboard_mode; + union { + const UCKeyboardLayout *unicode; + void *other; + } keyboard_layout_format; + KeyboardLayoutRef currentKeyboardLayout; + KeyboardLayoutKind keyboard_kind; + UInt32 keyboard_dead; + KeyboardLayoutItem *keyLayout[256]; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm new file mode 100644 index 0000000000..6df0466355 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm @@ -0,0 +1,468 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcocoakeymapper.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +// QCocoaKeyMapper debug facilities +//#define DEBUG_KEY_BINDINGS +//#define DEBUG_KEY_BINDINGS_MODIFIERS +//#define DEBUG_KEY_MAPS + +// Possible modifier states. +// NOTE: The order of these states match the order in updatePossibleKeyCodes()! +static const Qt::KeyboardModifiers ModsTbl[] = { + Qt::NoModifier, // 0 + Qt::ShiftModifier, // 1 + Qt::ControlModifier, // 2 + Qt::ControlModifier | Qt::ShiftModifier, // 3 + Qt::AltModifier, // 4 + Qt::AltModifier | Qt::ShiftModifier, // 5 + Qt::AltModifier | Qt::ControlModifier, // 6 + Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7 + Qt::MetaModifier, // 8 + Qt::MetaModifier | Qt::ShiftModifier, // 9 + Qt::MetaModifier | Qt::ControlModifier, // 10 + Qt::MetaModifier | Qt::ControlModifier | Qt::ShiftModifier,// 11 + Qt::MetaModifier | Qt::AltModifier, // 12 + Qt::MetaModifier | Qt::AltModifier | Qt::ShiftModifier, // 13 + Qt::MetaModifier | Qt::AltModifier | Qt::ControlModifier, // 14 + Qt::MetaModifier | Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 15 +}; + +bool qt_mac_eat_unicode_key = false; + +Q_GUI_EXPORT void qt_mac_secure_keyboard(bool b) +{ + static bool secure = false; + if (b != secure){ + b ? EnableSecureEventInput() : DisableSecureEventInput(); + secure = b; + } +} + +/* key maps */ +struct qt_mac_enum_mapper +{ + int mac_code; + int qt_code; +#if defined(DEBUG_KEY_BINDINGS) +# define QT_MAC_MAP_ENUM(x) x, #x + const char *desc; +#else +# define QT_MAC_MAP_ENUM(x) x +#endif +}; + +//modifiers +static qt_mac_enum_mapper qt_mac_modifier_symbols[] = { + { shiftKey, QT_MAC_MAP_ENUM(Qt::ShiftModifier) }, + { rightShiftKey, QT_MAC_MAP_ENUM(Qt::ShiftModifier) }, + { controlKey, QT_MAC_MAP_ENUM(Qt::MetaModifier) }, + { rightControlKey, QT_MAC_MAP_ENUM(Qt::MetaModifier) }, + { cmdKey, QT_MAC_MAP_ENUM(Qt::ControlModifier) }, + { optionKey, QT_MAC_MAP_ENUM(Qt::AltModifier) }, + { rightOptionKey, QT_MAC_MAP_ENUM(Qt::AltModifier) }, + { kEventKeyModifierNumLockMask, QT_MAC_MAP_ENUM(Qt::KeypadModifier) }, + { 0, QT_MAC_MAP_ENUM(0) } +}; +Qt::KeyboardModifiers qt_mac_get_modifiers(int keys) +{ +#ifdef DEBUG_KEY_BINDINGS_MODIFIERS + qDebug("Qt: internal: **Mapping modifiers: %d (0x%04x)", keys, keys); +#endif + Qt::KeyboardModifiers ret = Qt::NoModifier; + for (int i = 0; qt_mac_modifier_symbols[i].qt_code; i++) { + if (keys & qt_mac_modifier_symbols[i].mac_code) { +#ifdef DEBUG_KEY_BINDINGS_MODIFIERS + qDebug("Qt: internal: got modifier: %s", qt_mac_modifier_symbols[i].desc); +#endif + ret |= Qt::KeyboardModifier(qt_mac_modifier_symbols[i].qt_code); + } + } + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { + Qt::KeyboardModifiers oldModifiers = ret; + ret &= ~(Qt::MetaModifier | Qt::ControlModifier); + if (oldModifiers & Qt::ControlModifier) + ret |= Qt::MetaModifier; + if (oldModifiers & Qt::MetaModifier) + ret |= Qt::ControlModifier; + } + return ret; +} +static int qt_mac_get_mac_modifiers(Qt::KeyboardModifiers keys) +{ +#ifdef DEBUG_KEY_BINDINGS_MODIFIERS + qDebug("Qt: internal: **Mapping modifiers: %d (0x%04x)", (int)keys, (int)keys); +#endif + int ret = 0; + for (int i = 0; qt_mac_modifier_symbols[i].qt_code; i++) { + if (keys & qt_mac_modifier_symbols[i].qt_code) { +#ifdef DEBUG_KEY_BINDINGS_MODIFIERS + qDebug("Qt: internal: got modifier: %s", qt_mac_modifier_symbols[i].desc); +#endif + ret |= qt_mac_modifier_symbols[i].mac_code; + } + } + + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { + int oldModifiers = ret; + ret &= ~(controlKeyBit | cmdKeyBit); + if (oldModifiers & controlKeyBit) + ret |= cmdKeyBit; + if (oldModifiers & cmdKeyBit) + ret |= controlKeyBit; + } + return ret; +} + +//keyboard keys (non-modifiers) +static qt_mac_enum_mapper qt_mac_keyboard_symbols[] = { + { kHomeCharCode, QT_MAC_MAP_ENUM(Qt::Key_Home) }, + { kEnterCharCode, QT_MAC_MAP_ENUM(Qt::Key_Enter) }, + { kEndCharCode, QT_MAC_MAP_ENUM(Qt::Key_End) }, + { kBackspaceCharCode, QT_MAC_MAP_ENUM(Qt::Key_Backspace) }, + { kTabCharCode, QT_MAC_MAP_ENUM(Qt::Key_Tab) }, + { kPageUpCharCode, QT_MAC_MAP_ENUM(Qt::Key_PageUp) }, + { kPageDownCharCode, QT_MAC_MAP_ENUM(Qt::Key_PageDown) }, + { kReturnCharCode, QT_MAC_MAP_ENUM(Qt::Key_Return) }, + { kEscapeCharCode, QT_MAC_MAP_ENUM(Qt::Key_Escape) }, + { kLeftArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Left) }, + { kRightArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Right) }, + { kUpArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Up) }, + { kDownArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Down) }, + { kHelpCharCode, QT_MAC_MAP_ENUM(Qt::Key_Help) }, + { kDeleteCharCode, QT_MAC_MAP_ENUM(Qt::Key_Delete) }, +//ascii maps, for debug + { ':', QT_MAC_MAP_ENUM(Qt::Key_Colon) }, + { ';', QT_MAC_MAP_ENUM(Qt::Key_Semicolon) }, + { '<', QT_MAC_MAP_ENUM(Qt::Key_Less) }, + { '=', QT_MAC_MAP_ENUM(Qt::Key_Equal) }, + { '>', QT_MAC_MAP_ENUM(Qt::Key_Greater) }, + { '?', QT_MAC_MAP_ENUM(Qt::Key_Question) }, + { '@', QT_MAC_MAP_ENUM(Qt::Key_At) }, + { ' ', QT_MAC_MAP_ENUM(Qt::Key_Space) }, + { '!', QT_MAC_MAP_ENUM(Qt::Key_Exclam) }, + { '"', QT_MAC_MAP_ENUM(Qt::Key_QuoteDbl) }, + { '#', QT_MAC_MAP_ENUM(Qt::Key_NumberSign) }, + { '$', QT_MAC_MAP_ENUM(Qt::Key_Dollar) }, + { '%', QT_MAC_MAP_ENUM(Qt::Key_Percent) }, + { '&', QT_MAC_MAP_ENUM(Qt::Key_Ampersand) }, + { '\'', QT_MAC_MAP_ENUM(Qt::Key_Apostrophe) }, + { '(', QT_MAC_MAP_ENUM(Qt::Key_ParenLeft) }, + { ')', QT_MAC_MAP_ENUM(Qt::Key_ParenRight) }, + { '*', QT_MAC_MAP_ENUM(Qt::Key_Asterisk) }, + { '+', QT_MAC_MAP_ENUM(Qt::Key_Plus) }, + { ',', QT_MAC_MAP_ENUM(Qt::Key_Comma) }, + { '-', QT_MAC_MAP_ENUM(Qt::Key_Minus) }, + { '.', QT_MAC_MAP_ENUM(Qt::Key_Period) }, + { '/', QT_MAC_MAP_ENUM(Qt::Key_Slash) }, + { '[', QT_MAC_MAP_ENUM(Qt::Key_BracketLeft) }, + { ']', QT_MAC_MAP_ENUM(Qt::Key_BracketRight) }, + { '\\', QT_MAC_MAP_ENUM(Qt::Key_Backslash) }, + { '_', QT_MAC_MAP_ENUM(Qt::Key_Underscore) }, + { '`', QT_MAC_MAP_ENUM(Qt::Key_QuoteLeft) }, + { '{', QT_MAC_MAP_ENUM(Qt::Key_BraceLeft) }, + { '}', QT_MAC_MAP_ENUM(Qt::Key_BraceRight) }, + { '|', QT_MAC_MAP_ENUM(Qt::Key_Bar) }, + { '~', QT_MAC_MAP_ENUM(Qt::Key_AsciiTilde) }, + { '^', QT_MAC_MAP_ENUM(Qt::Key_AsciiCircum) }, + { 0, QT_MAC_MAP_ENUM(0) } +}; + +static qt_mac_enum_mapper qt_mac_keyvkey_symbols[] = { //real scan codes + { 122, QT_MAC_MAP_ENUM(Qt::Key_F1) }, + { 120, QT_MAC_MAP_ENUM(Qt::Key_F2) }, + { 99, QT_MAC_MAP_ENUM(Qt::Key_F3) }, + { 118, QT_MAC_MAP_ENUM(Qt::Key_F4) }, + { 96, QT_MAC_MAP_ENUM(Qt::Key_F5) }, + { 97, QT_MAC_MAP_ENUM(Qt::Key_F6) }, + { 98, QT_MAC_MAP_ENUM(Qt::Key_F7) }, + { 100, QT_MAC_MAP_ENUM(Qt::Key_F8) }, + { 101, QT_MAC_MAP_ENUM(Qt::Key_F9) }, + { 109, QT_MAC_MAP_ENUM(Qt::Key_F10) }, + { 103, QT_MAC_MAP_ENUM(Qt::Key_F11) }, + { 111, QT_MAC_MAP_ENUM(Qt::Key_F12) }, + { 105, QT_MAC_MAP_ENUM(Qt::Key_F13) }, + { 107, QT_MAC_MAP_ENUM(Qt::Key_F14) }, + { 113, QT_MAC_MAP_ENUM(Qt::Key_F15) }, + { 106, QT_MAC_MAP_ENUM(Qt::Key_F16) }, + { 0, QT_MAC_MAP_ENUM(0) } +}; + +static qt_mac_enum_mapper qt_mac_private_unicode[] = { + { 0xF700, QT_MAC_MAP_ENUM(Qt::Key_Up) }, //NSUpArrowFunctionKey + { 0xF701, QT_MAC_MAP_ENUM(Qt::Key_Down) }, //NSDownArrowFunctionKey + { 0xF702, QT_MAC_MAP_ENUM(Qt::Key_Left) }, //NSLeftArrowFunctionKey + { 0xF703, QT_MAC_MAP_ENUM(Qt::Key_Right) }, //NSRightArrowFunctionKey + { 0xF727, QT_MAC_MAP_ENUM(Qt::Key_Insert) }, //NSInsertFunctionKey + { 0xF728, QT_MAC_MAP_ENUM(Qt::Key_Delete) }, //NSDeleteFunctionKey + { 0xF729, QT_MAC_MAP_ENUM(Qt::Key_Home) }, //NSHomeFunctionKey + { 0xF72B, QT_MAC_MAP_ENUM(Qt::Key_End) }, //NSEndFunctionKey + { 0xF72C, QT_MAC_MAP_ENUM(Qt::Key_PageUp) }, //NSPageUpFunctionKey + { 0xF72D, QT_MAC_MAP_ENUM(Qt::Key_PageDown) }, //NSPageDownFunctionKey + { 0xF72F, QT_MAC_MAP_ENUM(Qt::Key_ScrollLock) }, //NSScrollLockFunctionKey + { 0xF730, QT_MAC_MAP_ENUM(Qt::Key_Pause) }, //NSPauseFunctionKey + { 0xF731, QT_MAC_MAP_ENUM(Qt::Key_SysReq) }, //NSSysReqFunctionKey + { 0xF735, QT_MAC_MAP_ENUM(Qt::Key_Menu) }, //NSMenuFunctionKey + { 0xF738, QT_MAC_MAP_ENUM(Qt::Key_Print) }, //NSPrintFunctionKey + { 0xF73A, QT_MAC_MAP_ENUM(Qt::Key_Clear) }, //NSClearDisplayFunctionKey + { 0xF73D, QT_MAC_MAP_ENUM(Qt::Key_Insert) }, //NSInsertCharFunctionKey + { 0xF73E, QT_MAC_MAP_ENUM(Qt::Key_Delete) }, //NSDeleteCharFunctionKey + { 0xF741, QT_MAC_MAP_ENUM(Qt::Key_Select) }, //NSSelectFunctionKey + { 0xF742, QT_MAC_MAP_ENUM(Qt::Key_Execute) }, //NSExecuteFunctionKey + { 0xF746, QT_MAC_MAP_ENUM(Qt::Key_Help) }, //NSHelpFunctionKey + { 0xF747, QT_MAC_MAP_ENUM(Qt::Key_Mode_switch) }, //NSModeSwitchFunctionKey + { 0, QT_MAC_MAP_ENUM(0) } +}; + +static int qt_mac_get_key(int modif, const QChar &key, int virtualKey) +{ +#ifdef DEBUG_KEY_BINDINGS + qDebug("**Mapping key: %d (0x%04x) - %d (0x%04x)", key.unicode(), key.unicode(), virtualKey, virtualKey); +#endif + + if (key == kClearCharCode && virtualKey == 0x47) + return Qt::Key_Clear; + + if (key.isDigit()) { +#ifdef DEBUG_KEY_BINDINGS + qDebug("%d: got key: %d", __LINE__, key.digitValue()); +#endif + return key.digitValue() + Qt::Key_0; + } + + if (key.isLetter()) { +#ifdef DEBUG_KEY_BINDINGS + qDebug("%d: got key: %d", __LINE__, (key.toUpper().unicode() - 'A')); +#endif + return (key.toUpper().unicode() - 'A') + Qt::Key_A; + } + if (key.isSymbol()) { +#ifdef DEBUG_KEY_BINDINGS + qDebug("%d: got key: %d", __LINE__, (key.unicode())); +#endif + return key.unicode(); + } + + for (int i = 0; qt_mac_keyboard_symbols[i].qt_code; i++) { + if (qt_mac_keyboard_symbols[i].mac_code == key) { + /* To work like Qt for X11 we issue Backtab when Shift + Tab are pressed */ + if (qt_mac_keyboard_symbols[i].qt_code == Qt::Key_Tab && (modif & Qt::ShiftModifier)) { +#ifdef DEBUG_KEY_BINDINGS + qDebug("%d: got key: Qt::Key_Backtab", __LINE__); +#endif + return Qt::Key_Backtab; + } + +#ifdef DEBUG_KEY_BINDINGS + qDebug("%d: got key: %s", __LINE__, qt_mac_keyboard_symbols[i].desc); +#endif + return qt_mac_keyboard_symbols[i].qt_code; + } + } + + //last ditch try to match the scan code + for (int i = 0; qt_mac_keyvkey_symbols[i].qt_code; i++) { + if (qt_mac_keyvkey_symbols[i].mac_code == virtualKey) { +#ifdef DEBUG_KEY_BINDINGS + qDebug("%d: got key: %s", __LINE__, qt_mac_keyvkey_symbols[i].desc); +#endif + return qt_mac_keyvkey_symbols[i].qt_code; + } + } + + // check if they belong to key codes in private unicode range + if (key >= 0xf700 && key <= 0xf747) { + if (key >= 0xf704 && key <= 0xf726) { + return Qt::Key_F1 + (key.unicode() - 0xf704) ; + } + for (int i = 0; qt_mac_private_unicode[i].qt_code; i++) { + if (qt_mac_private_unicode[i].mac_code == key) { + return qt_mac_private_unicode[i].qt_code; + } + } + + } + + //oh well +#ifdef DEBUG_KEY_BINDINGS + qDebug("Unknown case.. %s:%d %d[%d] %d", __FILE__, __LINE__, key.unicode(), key.toLatin1(), virtualKey); +#endif + return Qt::Key_unknown; +} + +QCocoaKeyMapper::QCocoaKeyMapper() +{ + memset(keyLayout, 0, sizeof(keyLayout)); + keyboard_layout_format.unicode = 0; + currentInputSource = 0; +} + +QCocoaKeyMapper::~QCocoaKeyMapper() +{ + deleteLayouts(); +} + +bool QCocoaKeyMapper::updateKeyboard() +{ + const UCKeyboardLayout *uchrData = 0; + QCFType source = TISCopyCurrentKeyboardInputSource(); + if (keyboard_mode != NullMode && source == currentInputSource) { + return false; + } + Q_ASSERT(source != 0); + CFDataRef data = static_cast(TISGetInputSourceProperty(source, + kTISPropertyUnicodeKeyLayoutData)); + uchrData = data ? reinterpret_cast(CFDataGetBytePtr(data)) : 0; + + keyboard_kind = LMGetKbdType(); + if (uchrData) { + keyboard_layout_format.unicode = uchrData; + keyboard_mode = UnicodeMode; + } + currentInputSource = source; + keyboard_dead = 0; + CFStringRef iso639Code; + + CFArrayRef array = static_cast(TISGetInputSourceProperty(currentInputSource, kTISPropertyInputSourceLanguages)); + iso639Code = static_cast(CFArrayGetValueAtIndex(array, 0)); // Actually a RFC3066bis, but it's close enough + + if (iso639Code) { + keyboardInputLocale = QLocale(QCFString::toQString(iso639Code)); + keyboardInputDirection = keyboardInputLocale.textDirection(); + } else { + keyboardInputLocale = QLocale::c(); + keyboardInputDirection = Qt::LeftToRight; + } + return true; +} + +void QCocoaKeyMapper::deleteLayouts() +{ + keyboard_mode = NullMode; + for (int i = 0; i < 255; ++i) { + if (keyLayout[i]) { + delete keyLayout[i]; + keyLayout[i] = 0; + } + } +} + +void QCocoaKeyMapper::clearMappings() +{ + deleteLayouts(); + updateKeyboard(); +} + +void QCocoaKeyMapper::updateKeyMap(unsigned short macVirtualKey, QChar unicodeKey) +{ + if (updateKeyboard()) { + // ### Qt 4 did this: + // QKeyMapper::changeKeyboard(); + } + if (keyLayout[macVirtualKey]) + return; + + UniCharCount buffer_size = 10; + UniChar buffer[buffer_size]; + keyLayout[macVirtualKey] = new KeyboardLayoutItem; + for (int i = 0; i < 16; ++i) { + UniCharCount out_buffer_size = 0; + keyLayout[macVirtualKey]->qtKey[i] = 0; + + const UInt32 keyModifier = ((qt_mac_get_mac_modifiers(ModsTbl[i]) >> 8) & 0xFF); + OSStatus err = UCKeyTranslate(keyboard_layout_format.unicode, macVirtualKey, kUCKeyActionDown, keyModifier, + keyboard_kind, 0, &keyboard_dead, buffer_size, &out_buffer_size, buffer); + if (err == noErr && out_buffer_size) { + const QChar unicode(buffer[0]); + int qtkey = qt_mac_get_key(keyModifier, unicode, macVirtualKey); + if (qtkey == Qt::Key_unknown) + qtkey = unicode.unicode(); + keyLayout[macVirtualKey]->qtKey[i] = qtkey; + } else { + int qtkey = qt_mac_get_key(keyModifier, unicodeKey, macVirtualKey); + if (qtkey == Qt::Key_unknown) + qtkey = unicodeKey.unicode(); + keyLayout[macVirtualKey]->qtKey[i] = qtkey; + } + } +#ifdef DEBUG_KEY_MAPS + qDebug("updateKeyMap for virtual key = 0x%02x!", (uint)macVirtualKey); + for (int i = 0; i < 16; ++i) { + qDebug(" [%d] (%d,0x%02x,'%c')", i, + keyLayout[macVirtualKey]->qtKey[i], + keyLayout[macVirtualKey]->qtKey[i], + keyLayout[macVirtualKey]->qtKey[i]); + } +#endif +} + +QList QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const +{ + QList ret; + const_cast(this)->updateKeyMap(event->nativeVirtualKey(), QChar(event->key())); + + KeyboardLayoutItem *kbItem = keyLayout[event->nativeVirtualKey()]; + + if (!kbItem) // Key is not in any keyboard layout (e.g. eisu-key on Japanese keyboard) + return ret; + + int baseKey = kbItem->qtKey[0]; + Qt::KeyboardModifiers keyMods = event->modifiers(); + + ret << int(baseKey + keyMods); // The base key is _always_ valid, of course + + for (int i = 1; i < 8; ++i) { + Qt::KeyboardModifiers neededMods = ModsTbl[i]; + int key = kbItem->qtKey[i]; + if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) { + ret << int(key + (keyMods & ~neededMods)); + } + } + return ret; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index f0ece54d20..cfd12cfb61 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -756,9 +756,19 @@ static QTouchDevice *touchDevice = 0; - (void)handleKeyEvent:(NSEvent *)nsevent eventType:(int)eventType { ulong timestamp = [nsevent timestamp] * 1000; - Qt::KeyboardModifiers modifiers = [self convertKeyModifiers:[nsevent modifierFlags]]; + ulong nativeModifiers = [nsevent modifierFlags]; + Qt::KeyboardModifiers modifiers = [self convertKeyModifiers: nativeModifiers]; NSString *charactersIgnoringModifiers = [nsevent charactersIgnoringModifiers]; + // [from Qt 4 impl] There is no way to get the scan code from carbon. But we cannot + // use the value 0, since it indicates that the event originates from somewhere + // else than the keyboard. + quint32 nativeScanCode = 1; + + UInt32 nativeVirtualKey = 0; + EventRef eventRef = EventRef([nsevent eventRef]); + GetEventParameter(eventRef, kEventParamKeyCode, typeUInt32, 0, sizeof(nativeVirtualKey), 0, &nativeVirtualKey); + QChar ch; int keyCode; if ([charactersIgnoringModifiers length] > 0) { @@ -799,7 +809,8 @@ static QTouchDevice *touchDevice = 0; } if (m_sendKeyEvent && m_composingText.isEmpty()) - QWindowSystemInterface::handleKeyEvent(m_window, timestamp, QEvent::Type(eventType), keyCode, modifiers, text); + QWindowSystemInterface::handleExtendedKeyEvent(m_window, timestamp, QEvent::Type(eventType), keyCode, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text); m_sendKeyEvent = false; } -- cgit v1.2.3 From 1eabbc0908160de7879a9ee7fa43916f0f9f8d49 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Fri, 7 Dec 2012 10:49:19 +0000 Subject: Blackberry: Fix crash when opening file dialog without parent. If parent is null, we now use qqnxintegration->primaryScreen() This simplifies ctors of QQnxTheme and QQnxFileDialogHelper which now receive a QQnxIntegration pointer instead of receiving a font database and a bps event filter. Change-Id: I3b1ed4d99f738b980a4f19a98618341a14e0c222 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp | 15 ++++++++++----- src/plugins/platforms/qnx/qqnxfiledialoghelper.h | 6 +++--- src/plugins/platforms/qnx/qqnxintegration.cpp | 2 +- src/plugins/platforms/qnx/qqnxintegration.h | 2 +- src/plugins/platforms/qnx/qqnxtheme.cpp | 14 +++++++------- src/plugins/platforms/qnx/qqnxtheme.h | 9 +++------ 6 files changed, 25 insertions(+), 23 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp index 262bdb16f4..79d7c7d9ca 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp @@ -43,6 +43,7 @@ #include "qqnxbpseventfilter.h" #include "qqnxscreen.h" +#include "qqnxintegration.h" #include #include @@ -58,9 +59,9 @@ QT_BEGIN_NAMESPACE -QQnxFileDialogHelper::QQnxFileDialogHelper(QQnxBpsEventFilter *eventFilter) +QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration) : QPlatformFileDialogHelper(), - m_eventFilter(eventFilter), + m_integration(integration), m_dialog(0), m_acceptMode(QFileDialogOptions::AcceptOpen), m_selectedFilter(), @@ -144,8 +145,9 @@ bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modali Q_UNUSED(flags); qFileDialogHelperDebug() << Q_FUNC_INFO; + QQnxBpsEventFilter *eventFilter = m_integration->bpsEventFilter(); // We *really* need the bps event filter ;) - if (!m_eventFilter) + if (!eventFilter) return false; // Native dialogs can only handle application modal use cases so far @@ -208,12 +210,15 @@ bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modali m_acceptMode = opts->acceptMode(); // Set the libscreen window group and common properties - QQnxScreen *nativeScreen = static_cast(parent->screen()->handle()); + + QQnxScreen *nativeScreen = parent ? static_cast(parent->screen()->handle()) : + m_integration->primaryDisplay(); + Q_ASSERT(nativeScreen); dialog_set_group_id(m_dialog, nativeScreen->windowGroupName()); dialog_set_title_text(m_dialog, opts->windowTitle().toLocal8Bit().constData()); // Register ourselves for dialog domain events from bps - m_eventFilter->registerForDialogEvents(this); + eventFilter->registerForDialogEvents(this); // Show the dialog dialog_show(m_dialog); diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h index 352709c763..e17ea80501 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h @@ -48,13 +48,13 @@ QT_BEGIN_NAMESPACE -class QQnxBpsEventFilter; +class QQnxIntegration; class QQnxFileDialogHelper : public QPlatformFileDialogHelper { Q_OBJECT public: - explicit QQnxFileDialogHelper(QQnxBpsEventFilter *eventFilter); + explicit QQnxFileDialogHelper(const QQnxIntegration *); ~QQnxFileDialogHelper(); bool handleEvent(bps_event_t *event); @@ -81,7 +81,7 @@ Q_SIGNALS: private: void setNameFilter(const QString &filter); - QQnxBpsEventFilter *m_eventFilter; + const QQnxIntegration *m_integration; dialog_instance_t m_dialog; QFileDialogOptions::AcceptMode m_acceptMode; QString m_selectedFilter; diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index e594ea952d..bff4dbdc2a 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -406,7 +406,7 @@ QPlatformTheme *QQnxIntegration::createPlatformTheme(const QString &name) const { qIntegrationDebug() << Q_FUNC_INFO << "name =" << name; if (name == QQnxTheme::name()) - return new QQnxTheme(m_fontDatabase, m_bpsEventFilter); + return new QQnxTheme(this); return QPlatformIntegration::createPlatformTheme(name); } #endif diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index 97a5e631e8..e3eb9e06ba 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -128,10 +128,10 @@ public: void createDisplay(screen_display_t display, bool isPrimary); void removeDisplay(QQnxScreen *screen); + QQnxScreen *primaryDisplay() const; private: void createDisplays(); void destroyDisplays(); - QQnxScreen *primaryDisplay() const; static void addWindow(screen_window_t qnxWindow, QWindow *window); static void removeWindow(screen_window_t qnxWindow); diff --git a/src/plugins/platforms/qnx/qqnxtheme.cpp b/src/plugins/platforms/qnx/qqnxtheme.cpp index be62c3e410..ae9acd845e 100644 --- a/src/plugins/platforms/qnx/qqnxtheme.cpp +++ b/src/plugins/platforms/qnx/qqnxtheme.cpp @@ -43,13 +43,11 @@ #include "qqnxfiledialoghelper.h" #include "qqnxsystemsettings.h" +#include "qqnxintegration.h" QT_BEGIN_NAMESPACE -QQnxTheme::QQnxTheme(QPlatformFontDatabase *fontDatabase, - QQnxBpsEventFilter *eventFilter) - : m_fontDatabase(fontDatabase), - m_eventFilter(eventFilter) +QQnxTheme::QQnxTheme(const QQnxIntegration *integration) : m_integration(integration) { } @@ -77,7 +75,7 @@ QPlatformDialogHelper *QQnxTheme::createPlatformDialogHelper(DialogType type) co { switch (type) { case QPlatformTheme::FileDialog: - return new QQnxFileDialogHelper(m_eventFilter); + return new QQnxFileDialogHelper(m_integration); #ifndef QT_NO_COLORDIALOG case QPlatformTheme::ColorDialog: #endif @@ -91,8 +89,10 @@ QPlatformDialogHelper *QQnxTheme::createPlatformDialogHelper(DialogType type) co const QFont *QQnxTheme::font(Font type) const { - if (m_fonts.isEmpty() && m_fontDatabase) - m_fonts = qt_qnx_createRoleFonts(m_fontDatabase); + QPlatformFontDatabase *fontDatabase = m_integration->fontDatabase(); + + if (fontDatabase && m_fonts.isEmpty()) + m_fonts = qt_qnx_createRoleFonts(fontDatabase); return m_fonts.value(type, 0); } diff --git a/src/plugins/platforms/qnx/qqnxtheme.h b/src/plugins/platforms/qnx/qqnxtheme.h index ea44d1cee2..17b2eab142 100644 --- a/src/plugins/platforms/qnx/qqnxtheme.h +++ b/src/plugins/platforms/qnx/qqnxtheme.h @@ -51,14 +51,12 @@ QT_BEGIN_NAMESPACE -class QQnxBpsEventFilter; - -class QPlatformFontDatabase; +class QQnxIntegration; class QQnxTheme : public QPlatformTheme { public: - QQnxTheme(QPlatformFontDatabase *fontDatabase, QQnxBpsEventFilter *eventFilter); + explicit QQnxTheme(const QQnxIntegration *); ~QQnxTheme(); static QString name() { return QStringLiteral("blackberry"); } @@ -69,9 +67,8 @@ public: const QFont *font(Font type = SystemFont) const; private: - QPlatformFontDatabase *m_fontDatabase; - QQnxBpsEventFilter *m_eventFilter; mutable QHash m_fonts; + const QQnxIntegration *m_integration; }; QT_END_NAMESPACE -- cgit v1.2.3 From c9d40ef2c1ff9e701cd052dadfc0e515ff6b523f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 10 Dec 2012 11:49:09 +0200 Subject: Add PLUGIN_CLASS_NAME to qtbase plugins Needed for automating static plugin loading. Task-number: QTBUG-28131 Change-Id: Icd993c0fc8335f29aeec30e853a408d888069399 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/cocoa/cocoa.pro | 1 + src/plugins/platforms/directfb/directfb.pro | 1 + src/plugins/platforms/eglfs/eglfs.pro | 1 + src/plugins/platforms/kms/kms.pro | 1 + src/plugins/platforms/linuxfb/linuxfb.pro | 1 + src/plugins/platforms/minimal/minimal.pro | 1 + src/plugins/platforms/minimalegl/minimalegl.pro | 1 + src/plugins/platforms/openwfd/openwf.pro | 1 + src/plugins/platforms/qnx/qnx.pro | 1 + src/plugins/platforms/windows/windows.pro | 1 + src/plugins/platforms/xcb/xcb-plugin.pro | 1 + 11 files changed, 11 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index f709bef633..5533650809 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -1,6 +1,7 @@ TARGET = qcocoa PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QCocoaIntegrationPlugin load(qt_plugin) OBJECTIVE_SOURCES += main.mm \ diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 29c5ebd99b..ec4a612b52 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -1,6 +1,7 @@ TARGET = qdirectfb PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QDirectFbIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro index 1223b6b133..45059a9cb9 100644 --- a/src/plugins/platforms/eglfs/eglfs.pro +++ b/src/plugins/platforms/eglfs/eglfs.pro @@ -1,6 +1,7 @@ TARGET = qeglfs PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private diff --git a/src/plugins/platforms/kms/kms.pro b/src/plugins/platforms/kms/kms.pro index 57191d8d97..c0300e0960 100644 --- a/src/plugins/platforms/kms/kms.pro +++ b/src/plugins/platforms/kms/kms.pro @@ -1,6 +1,7 @@ TARGET = qkms PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QKmsIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private opengl-private diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 2482a64469..9e9f9b29b7 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -1,6 +1,7 @@ TARGET = qlinuxfb PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QLinuxFbIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 9c3d37269c..3131b16232 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -1,6 +1,7 @@ TARGET = qminimal PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro index 23a6ad9708..00c83eb1ca 100644 --- a/src/plugins/platforms/minimalegl/minimalegl.pro +++ b/src/plugins/platforms/minimalegl/minimalegl.pro @@ -1,6 +1,7 @@ TARGET = qminimalegl PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QMinimalEglIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro index 1b177cba04..2dbcb282db 100644 --- a/src/plugins/platforms/openwfd/openwf.pro +++ b/src/plugins/platforms/openwfd/openwf.pro @@ -1,6 +1,7 @@ TARGET = qopenwf PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 30c95b1620..32dea13d52 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -137,4 +137,5 @@ include (../../../platformsupport/eglconvenience/eglconvenience.pri) include (../../../platformsupport/fontdatabases/fontdatabases.pri) PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QQnxIntegrationPlugin load(qt_plugin) diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 248c0992bf..4f80d7739f 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -1,6 +1,7 @@ TARGET = windows PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QWindowsIntegrationPlugin load(qt_plugin) QT *= core-private diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index b7b5650eea..27fac3538f 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -1,6 +1,7 @@ TARGET = xcb PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QXcbIntegrationPlugin load(qt_plugin) QT += core-private gui-private platformsupport-private -- cgit v1.2.3 From 2bf14740a72eb3b85c887f85b1586515582319f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 11 Dec 2012 09:32:24 +0100 Subject: Consistently prefix all platform plugin libraries with "q". This means the xcb plugin library will be named libqxcb.so instead of libxcb.so, which doesn't clash with the system's libxcb.so. We need to consistently apply this on all platforms for static linking to work. Change-Id: I1640a7cae7b9846bbe62b19ab1c2c5bad7d02b4c Reviewed-by: Miikka Heikkinen Reviewed-by: Sean Harmer Reviewed-by: Friedemann Kleint Reviewed-by: Rafael Roquetto Reviewed-by: Lars Knoll --- src/plugins/platforms/qnx/qnx.pro | 2 +- src/plugins/platforms/windows/windows.pro | 2 +- src/plugins/platforms/xcb/xcb-plugin.pro | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 32dea13d52..8367513fc5 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -1,4 +1,4 @@ -TARGET = qnx +TARGET = qqnx QT += platformsupport platformsupport-private diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 4f80d7739f..7f73465135 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -1,4 +1,4 @@ -TARGET = windows +TARGET = qwindows PLUGIN_TYPE = platforms PLUGIN_CLASS_NAME = QWindowsIntegrationPlugin diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 27fac3538f..20ec5701b9 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -1,4 +1,4 @@ -TARGET = xcb +TARGET = qxcb PLUGIN_TYPE = platforms PLUGIN_CLASS_NAME = QXcbIntegrationPlugin -- cgit v1.2.3 From ced154500de1dde42033579a7b29494934d8a02d Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 7 Dec 2012 15:29:06 +0100 Subject: a11y: Do not refer to destructed QObject in Windows bridge The crash could happen if a QWidget in the UI got deleted, and the AT client later tried to access the widget through the cache (qAccessibleRecentSentEvents()). Solution: Use a QPointer as a guard. Task-number: QTBUG-26187 Change-Id: I1aa716766626cf171757e76ba255a6d5ae4fd854 Reviewed-by: Frederik Gladhorn --- .../windows/accessible/qwindowsaccessibility.cpp | 30 +++++++++++++++------- .../windows/accessible/qwindowsmsaaaccessible.cpp | 2 +- 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index db2d5f949f..b94fef56ba 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -87,10 +88,9 @@ // This stuff is used for widgets/items with no window handle: -typedef QMap > NotifyMap; +typedef QMap,int> > NotifyMap; Q_GLOBAL_STATIC(NotifyMap, qAccessibleRecentSentEvents) - QT_BEGIN_NAMESPACE @@ -193,14 +193,25 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window); static int eventNum = 0; - if (event->type() != QAccessible::MenuCommand) { // MenuCommand is faked - // See comment "SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE" + if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked + event->type() != QAccessible::ObjectDestroyed) { + /* In some rare occasions, the server (Qt) might get a ::get_accChild call with a + childId that references an entry in the cache where there was a dangling + QObject-pointer. Previously we crashed on this. + + There is no point in actually notifying the AT client that the object got destroyed, + because the AT client won't query for get_accChild if the event is ObjectDestroyed + anyway, and we have no other way of mapping the eventId argument to the actual + child/descendant object. (Firefox seems to simply completely ignore + EVENT_OBJECT_DESTROY). + + We therefore guard each QObject in the cache with a QPointer, and only notify the AT + client if the type is not ObjectDestroyed. + */ eventNum %= 50; //[0..49] int eventId = - (eventNum - 1); - - qAccessibleRecentSentEvents()->insert(eventId, qMakePair(event->object(), event->child())); - ptrNotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, eventId ); - + qAccessibleRecentSentEvents()->insert(eventId, qMakePair(QPointer(event->object()), event->child())); + ptrNotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, eventId); ++eventNum; } #endif // Q_OS_WINCE @@ -244,7 +255,8 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc) */ QPair QWindowsAccessibility::getCachedObject(int entryId) { - return qAccessibleRecentSentEvents()->value(entryId); + QPair, int> pair = qAccessibleRecentSentEvents()->value(entryId); + return qMakePair(pair.first.data(), pair.second); } /* diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 328053604e..f1bdc77303 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -757,7 +757,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI acc = res; } } else { - qWarning("get_accChild got a negative varChildID, but did not find it in cache"); + qWarning("get_accChild got a negative varChildID (%d), but did not find it in cache", childIndex); } } else { if (childIndex) { -- cgit v1.2.3 From 4afc88b381128302c383a1d82ed93e6274bac9f1 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Tue, 11 Dec 2012 13:37:40 +0100 Subject: Partially revert e84e86dc. Make tst_qquickview::resizemodeitem pass. Returning on equal geometry breaks for non-top-level windows. Change-Id: I3b361655e25b6cf2d5e29410dc1f3567ab8f54d9 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index cfd12cfb61..678f88baa0 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -185,7 +185,7 @@ static QTouchDevice *touchDevice = 0; geometry = qt_mac_toQRect([self frame]); } - if (geometry == m_platformWindow->geometry()) + if (m_platformWindow->m_nsWindow && geometry == m_platformWindow->geometry()) return; #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG -- cgit v1.2.3 From 968b11737564572ef5939400ed70f281556d167b Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Mon, 10 Dec 2012 11:29:54 +0100 Subject: Improve Cocoa platform plugin loading. Loading both the debug and release version of the cocoa plugins causes the objective-c runtime to print "duplicate class definitions" warnings. Fix this by directing the plugin loader to only load one of the cocoa plugins if both are available. Implement this as a special case directly in QFactoryLoader. Define QT_NO_DEBUG_PLUGIN_CHECK to allow mixing debug and release builds. Task-number: QTBUG-28155 Change-Id: Ie1927b219cc501a821f91b7e4b56f0589e0acbf5 Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/plugins/platforms/cocoa/cocoa.pro | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 5533650809..85e3f0007c 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -98,13 +98,6 @@ QT += core-private gui-private platformsupport-private OTHER_FILES += cocoa.json -# Build the release libqcocoa.dylib only, skip the debug version. -# The Qt plugin loader will dlopen both if found, causing duplicate -# Objective-c class definitions for the classes defined in the plugin. -contains(QT_CONFIG,release):CONFIG -= debug -contains(QT_CONFIG,debug_and_release):CONFIG -= debug_and_release -contains(QT_CONFIG,build_all):CONFIG -= build_all - # Acccessibility debug support # DEFINES += QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR # include ($$PWD/../../../../util/accessibilityinspector/accessibilityinspector.pri) -- cgit v1.2.3 From 2efaee43f7c916919507860ab17e9b1d86b2f508 Mon Sep 17 00:00:00 2001 From: Alejandro Exojo Date: Tue, 20 Nov 2012 10:12:32 +0100 Subject: Add directory to xcb-static.pro's INCLUDEPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In src/3rdparty/xcb/xcb-util-image/xcb_image.c, the includes require all this directories, or otherwise compiliation fails when -qt-xcb is used in the configure step. Change-Id: I8566bea662eced144cb9a2b1ce1dbfdb65654dea Reviewed-by: Kai Koehne Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/xcb-static/xcb-static.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro index d7530fe42e..01667d41db 100644 --- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro +++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro @@ -8,7 +8,7 @@ CONFIG += staticlib XCB_DIR = ../../../../3rdparty/xcb -INCLUDEPATH += $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude +INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude # ignore compiler warnings in 3rdparty code QMAKE_CFLAGS_STATIC_LIB+=-w -- cgit v1.2.3 From 0549a4b6f52e6929daec4b0c97df2085739bc719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 12 Dec 2012 09:15:14 +0100 Subject: Made QWidget::setWindowOpacity work with the XCB platform plugin. Ported the rather trivial implementation from Qt 4. Task-number: QTBUG-28477 Change-Id: I44e14a3c150af43c6b9b880242b655fe06084fd7 Reviewed-by: Lars Knoll Reviewed-by: Friedemann Kleint --- src/plugins/platforms/xcb/qxcbwindow.cpp | 17 +++++++++++++++++ src/plugins/platforms/xcb/qxcbwindow.h | 2 ++ 2 files changed, 19 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 5e4e749c83..0db4176607 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1786,6 +1786,23 @@ static inline xcb_rectangle_t qRectToXCBRectangle(const QRect &r) return result; } +void QXcbWindow::setOpacity(qreal level) +{ + if (!m_window) + return; + + quint32 value = qRound64(qBound(qreal(0), level, qreal(1)) * 0xffffffff); + + Q_XCB_CALL(xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_window, + atom(QXcbAtom::_NET_WM_WINDOW_OPACITY), + XCB_ATOM_CARDINAL, + 32, + 1, + (uchar *)&value)); +} + void QXcbWindow::setMask(const QRegion ®ion) { if (!connection()->hasXShape()) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index bd4d18a175..07ac0e0fcb 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -109,6 +109,8 @@ public: bool startSystemResize(const QPoint &pos, Qt::Corner corner); + void setOpacity(qreal level); + #if !defined(QT_NO_SHAPE) void setMask(const QRegion ®ion); #endif // !QT_NO_SHAPE -- cgit v1.2.3 From 225a8357776dea2fc469bc51fe8b04092b7e84dd Mon Sep 17 00:00:00 2001 From: Erik van Pienbroek Date: Tue, 11 Dec 2012 23:58:19 +0100 Subject: DirectWrite support on MinGW needs _WIN32_WINNT to be set to 0x0600 The file qwindowsfontenginedirectwrite.cpp uses the Win32 API function GetUserDefaultLocaleName which requires _WIN32_WINNT to be set to 0x0600 as it only became available in Windows Vista Change-Id: I704705d3fc729bb0167121de991d01c957e1e7e4 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index add36c78cf..83f9e1db74 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -41,6 +41,11 @@ #ifndef QT_NO_DIRECTWRITE +#if _WIN32_WINNT < 0x0600 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif + #include "qwindowsfontenginedirectwrite.h" #include "qwindowsfontdatabase.h" #include "qwindowscontext.h" -- cgit v1.2.3 From 76ce3e6419f9b816359c0995ac7f1828e9291d7e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 12 Dec 2012 17:16:54 +0100 Subject: Fix QWidget::setWindowOpacity() when called before show(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass opacity from the QWidget to QWindow and to the platform windows. Task-number: QTBUG-28477 Change-Id: If5a85d9183bd1ca33dac2052936ecd1e6c0b5f6c Reviewed-by: Samuel Rødal --- src/plugins/platforms/cocoa/qcocoawindow.mm | 5 +++++ src/plugins/platforms/windows/qwindowswindow.cpp | 3 +++ src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++++ 3 files changed, 12 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ffee8528f0..b545844a24 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -649,6 +650,10 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow) NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); [m_contentView setFrame:frame]; } + + const qreal opacity = qt_window_private(window())->opacity; + if (!qFuzzyCompare(opacity, qreal(1.0))) + setOpacity(opacity); } NSWindow * QCocoaWindow::createNSWindow() diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 1f6253438f..2f2588bc4a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -731,6 +731,9 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0); setWindowState(aWindow->windowState()); + const qreal opacity = qt_window_private(aWindow)->opacity; + if (!qFuzzyCompare(opacity, qreal(1.0))) + setOpacity(opacity); } QWindowsWindow::~QWindowsWindow() diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 0db4176607..23e59f0735 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -385,6 +385,10 @@ void QXcbWindow::create() #ifndef QT_NO_DRAGANDDROP connection()->drag()->dndEnable(this, true); #endif + + const qreal opacity = qt_window_private(window())->opacity; + if (!qFuzzyCompare(opacity, qreal(1.0))) + setOpacity(opacity); } QXcbWindow::~QXcbWindow() -- cgit v1.2.3 From 1a653225f6c73d7ca32aa6cdcde45ba9462a7b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 12 Dec 2012 15:47:32 +0100 Subject: Fixed incorrect handling of extra mouse buttons in XCB platform plugin. translateMouseButtons() was only able to correctly handle the left, right, and mid mouse buttons. Thus, if any buttons outside of those were pressed, the motion notify event would basically unset the mouse button mask, leading to a release event being sent instead. Later on, when the actual release event arrives, that button gets xor'ed into the empty button mask generating another press, and later another motion event will generate a release. In the end that means two press-release sequences are sent for any extra mouse buttons. Instead of getting the mask of the buttons currently being pressed from the event, we need to keep track of the mask ourselves. Task-number: QTBUG-28561 Change-Id: Iaa67e784a13d792deef8fc29dbd5456a5471a861 Reviewed-by: Oliver Wolff Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge Reviewed-by: Rick Stockton Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbconnection.cpp | 70 ++++++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 6 +++ src/plugins/platforms/xcb/qxcbwindow.cpp | 68 ++++----------------------- src/plugins/platforms/xcb/qxcbwindow.h | 2 +- 4 files changed, 87 insertions(+), 59 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 4c4df137a3..b4f1a278a2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -257,6 +257,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char , has_shape_extension(false) , has_randr_extension(false) , has_input_shape(false) + , m_buttons(0) { #ifdef XCB_USE_XLIB Display *dpy = XOpenDisplay(m_displayName.constData()); @@ -662,6 +663,73 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error) #endif } +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & XCB_BUTTON_MASK_1) + ret |= Qt::LeftButton; + if (s & XCB_BUTTON_MASK_2) + ret |= Qt::MidButton; + if (s & XCB_BUTTON_MASK_3) + ret |= Qt::RightButton; + return ret; +} + +static Qt::MouseButton translateMouseButton(xcb_button_t s) +{ + switch (s) { + case 1: return Qt::LeftButton; + case 2: return Qt::MidButton; + case 3: return Qt::RightButton; + // Button values 4-7 were already handled as Wheel events, and won't occur here. + case 8: return Qt::BackButton; // Also known as Qt::ExtraButton1 + case 9: return Qt::ForwardButton; // Also known as Qt::ExtraButton2 + case 10: return Qt::ExtraButton3; + case 11: return Qt::ExtraButton4; + case 12: return Qt::ExtraButton5; + case 13: return Qt::ExtraButton6; + case 14: return Qt::ExtraButton7; + case 15: return Qt::ExtraButton8; + case 16: return Qt::ExtraButton9; + case 17: return Qt::ExtraButton10; + case 18: return Qt::ExtraButton11; + case 19: return Qt::ExtraButton12; + case 20: return Qt::ExtraButton13; + case 21: return Qt::ExtraButton14; + case 22: return Qt::ExtraButton15; + case 23: return Qt::ExtraButton16; + case 24: return Qt::ExtraButton17; + case 25: return Qt::ExtraButton18; + case 26: return Qt::ExtraButton19; + case 27: return Qt::ExtraButton20; + case 28: return Qt::ExtraButton21; + case 29: return Qt::ExtraButton22; + case 30: return Qt::ExtraButton23; + case 31: return Qt::ExtraButton24; + default: return Qt::NoButton; + } +} + +void QXcbConnection::handleButtonPress(xcb_generic_event_t *ev) +{ + xcb_button_press_event_t *event = (xcb_button_press_event_t *)ev; + + // the event explicitly contains the state of the three first buttons, + // the rest we need to manage ourselves + m_buttons = (m_buttons & ~0x7) | translateMouseButtons(event->state); + m_buttons |= translateMouseButton(event->detail); +} + +void QXcbConnection::handleButtonRelease(xcb_generic_event_t *ev) +{ + xcb_button_release_event_t *event = (xcb_button_release_event_t *)ev; + + // the event explicitly contains the state of the three first buttons, + // the rest we need to manage ourselves + m_buttons = (m_buttons & ~0x7) | translateMouseButtons(event->state); + m_buttons &= ~translateMouseButton(event->detail); +} + void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) { #ifdef Q_XCB_DEBUG @@ -686,8 +754,10 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) case XCB_EXPOSE: HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); case XCB_BUTTON_PRESS: + handleButtonPress(event); HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent); case XCB_BUTTON_RELEASE: + handleButtonRelease(event); HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); case XCB_MOTION_NOTIFY: HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index c67acb3218..f1e707e0cd 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -380,6 +380,8 @@ public: xcb_timestamp_t getTimestamp(); + Qt::MouseButtons buttons() const { return m_buttons; } + private slots: void processXcbEvents(); @@ -400,6 +402,8 @@ private: QXcbScreen* findOrCreateScreen(QList& newScreens, int screenNumber, xcb_screen_t* xcbScreen, xcb_randr_get_output_info_reply_t *output = NULL); void updateScreens(); + void handleButtonPress(xcb_generic_event_t *event); + void handleButtonRelease(xcb_generic_event_t *event); bool m_xi2Enabled; int m_xi2Minor; @@ -501,6 +505,8 @@ private: bool has_shape_extension; bool has_randr_extension; bool has_input_shape; + + Qt::MouseButtons m_buttons; }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 23e59f0735..05d7dc4da9 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1464,53 +1464,6 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) } } -static Qt::MouseButtons translateMouseButtons(int s) -{ - Qt::MouseButtons ret = 0; - if (s & XCB_BUTTON_MASK_1) - ret |= Qt::LeftButton; - if (s & XCB_BUTTON_MASK_2) - ret |= Qt::MidButton; - if (s & XCB_BUTTON_MASK_3) - ret |= Qt::RightButton; - return ret; -} - -static Qt::MouseButton translateMouseButton(xcb_button_t s) -{ - switch (s) { - case 1: return Qt::LeftButton; - case 2: return Qt::MidButton; - case 3: return Qt::RightButton; - // Button values 4-7 were already handled as Wheel events, and won't occur here. - case 8: return Qt::BackButton; // Also known as Qt::ExtraButton1 - case 9: return Qt::ForwardButton; // Also known as Qt::ExtraButton2 - case 10: return Qt::ExtraButton3; - case 11: return Qt::ExtraButton4; - case 12: return Qt::ExtraButton5; - case 13: return Qt::ExtraButton6; - case 14: return Qt::ExtraButton7; - case 15: return Qt::ExtraButton8; - case 16: return Qt::ExtraButton9; - case 17: return Qt::ExtraButton10; - case 18: return Qt::ExtraButton11; - case 19: return Qt::ExtraButton12; - case 20: return Qt::ExtraButton13; - case 21: return Qt::ExtraButton14; - case 22: return Qt::ExtraButton15; - case 23: return Qt::ExtraButton16; - case 24: return Qt::ExtraButton17; - case 25: return Qt::ExtraButton18; - case 26: return Qt::ExtraButton19; - case 27: return Qt::ExtraButton20; - case 28: return Qt::ExtraButton21; - case 29: return Qt::ExtraButton22; - case 30: return Qt::ExtraButton23; - case 31: return Qt::ExtraButton24; - default: return Qt::NoButton; - } -} - void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { updateNetWmUserTime(event->time); @@ -1532,7 +1485,7 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) return; } - handleMouseEvent(event->detail, event->state, event->time, local, global, modifiers); + handleMouseEvent(event->time, local, global, modifiers); } void QXcbWindow::handleButtonReleaseEvent(const xcb_button_release_event_t *event) @@ -1541,7 +1494,12 @@ void QXcbWindow::handleButtonReleaseEvent(const xcb_button_release_event_t *even QPoint global(event->root_x, event->root_y); Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state); - handleMouseEvent(event->detail, event->state, event->time, local, global, modifiers); + if (event->detail >= 4 && event->detail <= 7) { + // mouse wheel, handled in handleButtonPressEvent() + return; + } + + handleMouseEvent(event->time, local, global, modifiers); } void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) @@ -1550,19 +1508,13 @@ void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) QPoint global(event->root_x, event->root_y); Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state); - handleMouseEvent(event->detail, event->state, event->time, local, global, modifiers); + handleMouseEvent(event->time, local, global, modifiers); } -void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers) +void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers) { connection()->setTime(time); - - Qt::MouseButtons buttons = translateMouseButtons(state); - Qt::MouseButton button = translateMouseButton(detail); - - buttons ^= button; // X event uses state *before*, Qt uses state *after* - - QWindowSystemInterface::handleMouseEvent(window(), time, local, global, buttons, modifiers); + QWindowSystemInterface::handleMouseEvent(window(), time, local, global, connection()->buttons(), modifiers); } class EnterEventChecker diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 07ac0e0fcb..c624841a17 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -134,7 +134,7 @@ public: void handleFocusOutEvent(const xcb_focus_out_event_t *event); void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event); - void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers); + void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers); void updateSyncRequestCounter(); void updateNetWmUserTime(xcb_timestamp_t timestamp); -- cgit v1.2.3 From 92bd9aecfb69ebe525ba88dc78ce85e3ca7ed9c2 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 30 Nov 2012 19:37:02 +0100 Subject: Fix empty window title regression, add application display name to window title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This increases consistency a lot: all windows and dialogs from a Qt application will show the app display name in the caption, on Windows and X11. This helps identifying which app a dialog belongs to, which is especially useful when the dialog is very generic and shows up unexpectedly. For compatibility reasons, the app name is added to the caption only if setApplicationDisplayName() was called -- or if the caption would be completely empty. The standard Qt4 case (setWindowTitle + no display name) is unchanged. Change-Id: Ib284c62c1f4c0bc923e5bc2d10247d95e9aa76c1 Reviewed-by: Samuel Rødal --- src/plugins/platforms/windows/qwindowswindow.cpp | 18 ++++++++++++++++-- src/plugins/platforms/xcb/qxcbwindow.cpp | 13 ++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 2f2588bc4a..40e0cf7dda 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -1188,8 +1189,21 @@ void QWindowsWindow::setWindowTitle(const QString &title) { if (QWindowsContext::verboseWindows) qDebug() << __FUNCTION__ << this << window() < Date: Tue, 4 Dec 2012 16:57:17 +0100 Subject: XCB: add support for getting and setting appTime and appUserTime. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QX11Info class needs this. This required adding the missing nativeResourceFunctionForScreen in QPlatformNativeInterface. Change-Id: I2c6e91c7f122f3ecdf769a177deafd2aa3896e2f Reviewed-by: Richard J. Moore Reviewed-by: Alberto Mardegan Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbconnection.cpp | 1 + src/plugins/platforms/xcb/qxcbconnection.h | 4 ++ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 46 +++++++++++++++++++++-- src/plugins/platforms/xcb/qxcbnativeinterface.h | 11 +++++- src/plugins/platforms/xcb/qxcbwindow.cpp | 1 + src/plugins/platforms/xcb/qxcbwindow.h | 1 - 6 files changed, 58 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index b4f1a278a2..1192894693 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -313,6 +313,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char initializeAllAtoms(); m_time = XCB_CURRENT_TIME; + m_netWmUserTime = XCB_CURRENT_TIME; initializeXRandr(); updateScreens(); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index f1e707e0cd..464d918adf 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -370,6 +370,9 @@ public: inline xcb_timestamp_t time() const { return m_time; } inline void setTime(xcb_timestamp_t t) { if (t > m_time) m_time = t; } + inline xcb_timestamp_t netWmUserTime() const { return m_netWmUserTime; } + inline void setNetWmUserTime(xcb_timestamp_t t) { if (t > m_netWmUserTime) m_netWmUserTime = t; } + bool hasGLX() const { return has_glx_extension; } bool hasXFixes() const { return xfixes_first_event > 0; } bool hasXShape() const { return has_shape_extension; } @@ -452,6 +455,7 @@ private: xcb_atom_t m_allAtoms[QXcbAtom::NAtoms]; xcb_timestamp_t m_time; + xcb_timestamp_t m_netWmUserTime; QByteArray m_displayName; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index a44e7fb959..9c360df900 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -71,6 +71,8 @@ public: insert("screen",QXcbNativeInterface::Screen); insert("eglcontext",QXcbNativeInterface::EglContext); insert("glxcontext",QXcbNativeInterface::GLXContext); + insert("apptime",QXcbNativeInterface::AppTime); + insert("appusertime",QXcbNativeInterface::AppUserTime); } }; @@ -109,18 +111,24 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q const QXcbResourceMap::const_iterator it = qXcbResourceMap()->constFind(resource.toLower()); if (it == qXcbResourceMap()->constEnd() || !screen->handle()) return 0; + void *result = 0; const QXcbScreen *xcbScreen = static_cast(screen->handle()); switch (it.value()) { case Display: #ifdef XCB_USE_XLIB - return xcbScreen->connection()->xlib_display(); -#else - break; + result = xcbScreen->connection()->xlib_display(); #endif + break; + case AppTime: + result = appTime(xcbScreen); + break; + case AppUserTime: + result = appUserTime(xcbScreen); + break; default: break; } - return 0; + return result; } void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) @@ -151,6 +159,36 @@ void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr return result; } +QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterface::nativeResourceFunctionForScreen(const QByteArray &resource) +{ + const QByteArray lowerCaseResource = resource.toLower(); + if (lowerCaseResource == "setapptime") + return NativeResourceForScreenFunction(setAppTime); + else if (lowerCaseResource == "setappusertime") + return NativeResourceForScreenFunction(setAppUserTime); + return 0; +} + +void *QXcbNativeInterface::appTime(const QXcbScreen *screen) +{ + return reinterpret_cast(quintptr(screen->connection()->time())); +} + +void *QXcbNativeInterface::appUserTime(const QXcbScreen *screen) +{ + return reinterpret_cast(quintptr(screen->connection()->netWmUserTime())); +} + +void QXcbNativeInterface::setAppTime(QScreen* screen, xcb_timestamp_t time) +{ + static_cast(screen->handle())->connection()->setTime(time); +} + +void QXcbNativeInterface::setAppUserTime(QScreen* screen, xcb_timestamp_t time) +{ + static_cast(screen->handle())->connection()->setNetWmUserTime(time); +} + QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource) { QByteArray lowerCaseResource = resource.toLower(); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index a7e0a207cb..e2e03fce8f 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -43,11 +43,13 @@ #define QXCBNATIVEINTERFACE_H #include +#include QT_BEGIN_NAMESPACE class QWidget; class QXcbScreen; +class QXcbConnection; class QXcbNativeInterface : public QPlatformNativeInterface { @@ -59,7 +61,9 @@ public: Screen, GraphicsDevice, EglContext, - GLXContext + GLXContext, + AppTime, + AppUserTime }; QXcbNativeInterface(); @@ -69,6 +73,7 @@ public: void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource); + NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) Q_DECL_OVERRIDE; inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; } @@ -77,6 +82,10 @@ public: void *connectionForWindow(QWindow *window); void *screenForWindow(QWindow *window); void *graphicsDeviceForWindow(QWindow *window); + void *appTime(const QXcbScreen *screen); + void *appUserTime(const QXcbScreen *screen); + static void setAppTime(QScreen *screen, xcb_timestamp_t time); + static void setAppUserTime(QScreen *screen, xcb_timestamp_t time); static void *eglContextForContext(QOpenGLContext *context); static void *glxContextForContext(QOpenGLContext *context); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 21254e4b3b..528c4c6580 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1028,6 +1028,7 @@ void QXcbWindow::updateNetWmStateBeforeMap() void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp) { xcb_window_t wid = m_window; + connection()->setNetWmUserTime(timestamp); const bool isSupportedByWM = connection()->wmSupport()->isSupportedByWM(atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW)); if (m_netWmUserTimeWindow || isSupportedByWM) { diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index c624841a17..b2c637281d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -138,7 +138,6 @@ public: void updateSyncRequestCounter(); void updateNetWmUserTime(xcb_timestamp_t timestamp); - void netWmUserTime() const; #if defined(XCB_USE_EGL) QXcbEGLSurface *eglSurface() const; -- cgit v1.2.3 From 3c09f6bc9aee0c97427fe8da6efdc73b4ac473aa Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 30 Oct 2012 14:01:12 +0100 Subject: Mac: fix bugs for font selection in QFontDialog Use localized family name and style name when selecting font with non-English locale Task-number: QTBUG-27415 Change-Id: Ie81507ed011fc096e0f5edad146e97c392e86494 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 5ccd019a9b..ff3ba63931 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -92,20 +92,16 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) QFont newFont; if (cocoaFont) { int pSize = qRound([cocoaFont pointSize]); - QString family(QCFString::toQString([cocoaFont familyName])); - QString typeface(QCFString::toQString([cocoaFont fontName])); - - int hyphenPos = typeface.indexOf(QLatin1Char('-')); - if (hyphenPos != -1) { - typeface.remove(0, hyphenPos + 1); - } else { - typeface = QLatin1String("Normal"); - } + CTFontDescriptorRef font = CTFontCopyFontDescriptor((CTFontRef)cocoaFont); + // QCoreTextFontDatabase::populateFontDatabase() is using localized names + QString family = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontFamilyNameAttribute, NULL)); + QString style = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontStyleNameAttribute, NULL)); - newFont = QFontDatabase().font(family, typeface, pSize); + newFont = QFontDatabase().font(family, style, pSize); newFont.setUnderline(resolveFont.underline()); newFont.setStrikeOut(resolveFont.strikeOut()); + CFRelease(font); } return newFont; } -- cgit v1.2.3 From fa7661d8b25fa338649a301010e1b5a2b63da731 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 11 Jul 2012 14:39:54 +0200 Subject: Fix styleName support in QPA font database Font styleName support was disconnected since Qt switched to QPA fontdatabase. Now add the code from Qt 4.8 back to enable this in QPA. Change-Id: Iab2cbfd5468f87542183348c2123ca4b2c270692 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 8 ++++---- src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 262b610745..1a899c848e 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1033,17 +1033,17 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, writingSystems.setSupported(ws); } - QPlatformFontDatabase::registerFont(familyName, foundryName, weight, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, 0); // add fonts windows can generate for us: if (weight <= QFont::DemiBold) - QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, style, stretch, antialias, scalable, size, fixed, writingSystems, 0); if (style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(familyName, foundryName, weight, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0); if (weight <= QFont::DemiBold && style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0); if (!englishName.isEmpty()) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 4c3d412b8e..7d09166473 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -279,20 +279,20 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, if (!QDir::isAbsolutePath(value)) value.prepend(QString::fromLocal8Bit(qgetenv("windir") + "\\Fonts\\")); - QPlatformFontDatabase::registerFont(faceName, foundryName, weight, style, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); // add fonts windows can generate for us: if (weight <= QFont::DemiBold) - QPlatformFontDatabase::registerFont(faceName, foundryName, QFont::Bold, style, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(faceName, foundryName, weight, QFont::StyleItalic, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (weight <= QFont::DemiBold && style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(faceName, foundryName, QFont::Bold, QFont::StyleItalic, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (!englishName.isEmpty()) -- cgit v1.2.3 From 22929c5dfc98901a86a231a84dde90b19b94f8e5 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 30 Oct 2012 14:01:12 +0100 Subject: Mac: fix bugs for font selection in QFontDialog Use localized family name and style name when selecting font with non-English locale Task-number: QTBUG-27415 Change-Id: Ie81507ed011fc096e0f5edad146e97c392e86494 Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit 3c09f6bc9aee0c97427fe8da6efdc73b4ac473aa) --- src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 5ccd019a9b..ff3ba63931 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -92,20 +92,16 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) QFont newFont; if (cocoaFont) { int pSize = qRound([cocoaFont pointSize]); - QString family(QCFString::toQString([cocoaFont familyName])); - QString typeface(QCFString::toQString([cocoaFont fontName])); - - int hyphenPos = typeface.indexOf(QLatin1Char('-')); - if (hyphenPos != -1) { - typeface.remove(0, hyphenPos + 1); - } else { - typeface = QLatin1String("Normal"); - } + CTFontDescriptorRef font = CTFontCopyFontDescriptor((CTFontRef)cocoaFont); + // QCoreTextFontDatabase::populateFontDatabase() is using localized names + QString family = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontFamilyNameAttribute, NULL)); + QString style = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontStyleNameAttribute, NULL)); - newFont = QFontDatabase().font(family, typeface, pSize); + newFont = QFontDatabase().font(family, style, pSize); newFont.setUnderline(resolveFont.underline()); newFont.setStrikeOut(resolveFont.strikeOut()); + CFRelease(font); } return newFont; } -- cgit v1.2.3 From 133bbf6ea9b9e6dff82361bf2101a35d42f0fbe0 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 11 Jul 2012 14:39:54 +0200 Subject: Fix styleName support in QPA font database Font styleName support was disconnected since Qt switched to QPA fontdatabase. Now add the code from Qt 4.8 back to enable this in QPA. Change-Id: Iab2cbfd5468f87542183348c2123ca4b2c270692 Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit fa7661d8b25fa338649a301010e1b5a2b63da731) --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 8 ++++---- src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 262b610745..1a899c848e 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1033,17 +1033,17 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, writingSystems.setSupported(ws); } - QPlatformFontDatabase::registerFont(familyName, foundryName, weight, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, 0); // add fonts windows can generate for us: if (weight <= QFont::DemiBold) - QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, style, stretch, antialias, scalable, size, fixed, writingSystems, 0); if (style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(familyName, foundryName, weight, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0); if (weight <= QFont::DemiBold && style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold, + QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0); if (!englishName.isEmpty()) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 4c3d412b8e..7d09166473 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -279,20 +279,20 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, if (!QDir::isAbsolutePath(value)) value.prepend(QString::fromLocal8Bit(qgetenv("windir") + "\\Fonts\\")); - QPlatformFontDatabase::registerFont(faceName, foundryName, weight, style, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); // add fonts windows can generate for us: if (weight <= QFont::DemiBold) - QPlatformFontDatabase::registerFont(faceName, foundryName, QFont::Bold, style, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(faceName, foundryName, weight, QFont::StyleItalic, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (weight <= QFont::DemiBold && style != QFont::StyleItalic) - QPlatformFontDatabase::registerFont(faceName, foundryName, QFont::Bold, QFont::StyleItalic, stretch, + QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); if (!englishName.isEmpty()) -- cgit v1.2.3 From 9a6366cead1c787f0c29b721bdbf07585199e9ca Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Fri, 14 Dec 2012 14:05:08 +0100 Subject: Don't use NSAccessibilityUnignoredChildren. The function is massively ineffective on deep hierarchies and not strictly needed. (It's supposed to filter out "Ignored" children - VoiceOver will do that anyway based on accessibilityIsIgnored()) Change-Id: I9a74b5f5e9b7880e0d46d5330f7192472eac7a36 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 2 +- src/plugins/platforms/cocoa/qnsviewaccessibility.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index df6b64443d..7d46ad5cde 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -139,7 +139,7 @@ static QAccessibleInterface *acast(void *ptr) [kids addObject:[QCocoaAccessibleElement elementWithInterface:(void*)childInterface parent:self]]; } - return NSAccessibilityUnignoredChildren(kids); + return kids; } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { // Just check if the app thinks we're focused. id focusedElement = [NSApp accessibilityAttributeValue:NSAccessibilityFocusedUIElementAttribute]; diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 6824f19489..da714d3326 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -80,7 +80,7 @@ [kids addObject:[QCocoaAccessibleElement elementWithInterface: m_accessibleRoot->child(i) parent:self ]]; } - return NSAccessibilityUnignoredChildren(kids); + return kids; } else { return [super accessibilityAttributeValue:attribute]; } -- cgit v1.2.3 From 457829da52183d406164f8e8f13c4a35b3caf8d8 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Thu, 13 Dec 2012 11:37:19 +0100 Subject: Fix memory leak in cocoa accessibility. Autorelease ("delete later") the created attribute name array. Change-Id: I2d7af9eb1fd899f04c8acb90204600a2dd43fa20 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 7d46ad5cde..c722ffb3bf 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -122,7 +122,7 @@ static QAccessibleInterface *acast(void *ptr) [attributes addObject : NSAccessibilityValueAttribute]; } - return attributes; + return [attributes autorelease]; } - (id)accessibilityAttributeValue:(NSString *)attribute { -- cgit v1.2.3 From d75d86190bca85841db2040d50184f4c6886ef89 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Sat, 8 Dec 2012 01:55:11 +0100 Subject: Ensure the native filedialog starts up with the right directory On Mac it was not starting the dialog with the specified directory when one was present. If a filename was given as well then it would start up fine. Task-number: QTBUG-28161 Change-Id: I7cce0d065dd57e6433ce62380d4263d6e20b6e7c Reviewed-by: Liang Qi --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index f9122f56d1..5747cc01e9 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -223,7 +223,7 @@ static QString strippedText(QString s) - (void)showModelessPanel { if (mOpenPanel){ - QFileInfo info(*mCurrentSelection); + QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; @@ -241,7 +241,7 @@ static QString strippedText(QString s) - (BOOL)runApplicationModalPanel { - QFileInfo info(*mCurrentSelection); + QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; @@ -266,7 +266,7 @@ static QString strippedText(QString s) - (void)showWindowModalSheet:(QWindow *)parent { - QFileInfo info(*mCurrentSelection); + QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; -- cgit v1.2.3 From f55ce226282ce1ff1c7c998b6d5552b908897d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 28 Nov 2012 13:22:54 +0100 Subject: Cocoa: make accessibility hit test not crash Check if the accessibility element is valid before calling childAt. Change-Id: Id63c11f18b262c3c3a839db8ee2d11c0d7adc822 Reviewed-by: J-P Nurmi Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index c722ffb3bf..d5841c1983 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -239,6 +239,10 @@ static QAccessibleInterface *acast(void *ptr) if (!accessibleInterface) return NSAccessibilityUnignoredAncestor(self); + + if (!acast(accessibleInterface)->isValid()) + return NSAccessibilityUnignoredAncestor(self); + QAccessibleInterface *childInterface = acast(accessibleInterface)->childAt(point.x, qt_mac_flipYCoordinate(point.y)); // No child found, meaning we hit this element. -- cgit v1.2.3 From acbb6f18978e5d8bd69c6772fc117e48f672a2c0 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Sun, 16 Dec 2012 13:48:52 +1100 Subject: Windows: Remove warning when creating QWindow Change-Id: I63c76710ab84c88ba8b4b6f24e6161ae2db77a5f Reviewed-by: Miikka Heikkinen Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 40e0cf7dda..3831c6b10e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -322,7 +322,6 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag topLevel = ((creationFlags & ForceChild) || embedded) ? false : w->isTopLevel(); if (topLevel && flags == 1) { - qWarning("Remove me: fixing toplevel window flags"); flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint |Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint; } -- cgit v1.2.3 From 826c4f60b65532033045e76d34fb718957a26fa9 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 17 Dec 2012 11:43:10 +0200 Subject: Rename conflicting symbol QVariantToVARIANT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It appears this method has been copied from ActiveQt. When building Qt statically, linking Windows platform plugin into any application that also uses ActiveQt will cause error about duplicate symbol. Renamed QVariantToVARIANT to QVariant2VARIANT to avoid conflicts. Renaming is done here rather than ActiveQt, as that symbol is in exported header in ActiveQt. Task-number: QTBUG-28645 Change-Id: Id0d7fc51d4455b463515e7c6178798ad61217c35 Reviewed-by: Friedemann Kleint Reviewed-by: Jan Arve Sæther --- .../platforms/windows/accessible/comutils.cpp | 20 ++++++++++---------- src/plugins/platforms/windows/accessible/comutils.h | 3 ++- .../platforms/windows/accessible/iaccessible2.cpp | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp index 5e5a1ebd0f..a67e2c4534 100644 --- a/src/plugins/platforms/windows/accessible/comutils.cpp +++ b/src/plugins/platforms/windows/accessible/comutils.cpp @@ -88,7 +88,7 @@ inline uint QColorToOLEColor(const QColor &col) return qRgba(col.blue(), col.green(), col.red(), 0x00); } -bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out) +bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out) { QVariant qvar = var; // "type" is the expected type, so coerce if necessary @@ -107,12 +107,12 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type } if (out && arg.vt == (VT_VARIANT|VT_BYREF) && arg.pvarVal) { - return QVariantToVARIANT(var, *arg.pvarVal, typeName, false); + return QVariant2VARIANT(var, *arg.pvarVal, typeName, false); } if (out && proptype == QVariant::UserType && typeName == "QVariant") { VARIANT *pVariant = new VARIANT; - QVariantToVARIANT(var, *pVariant, QByteArray(), false); + QVariant2VARIANT(var, *pVariant, QByteArray(), false); arg.vt = VT_VARIANT|VT_BYREF; arg.pvarVal = pVariant; return true; @@ -409,7 +409,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type for (LONG j = 0; j < columnCount; ++j) { QVariant elem = columns.at(j); VariantInit(&variant); - QVariantToVARIANT(elem, variant, elem.typeName()); + QVariant2VARIANT(elem, variant, elem.typeName()); rgIndices[1] = j; SafeArrayPutElement(array, rgIndices, pElement); clearVARIANT(&variant); @@ -425,7 +425,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type if (listType != QVariant::LastType) elem.convert(listType); VariantInit(&variant); - QVariantToVARIANT(elem, variant, elem.typeName()); + QVariant2VARIANT(elem, variant, elem.typeName()); SafeArrayPutElement(array, &index, pElement); clearVARIANT(&variant); } @@ -555,7 +555,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type arg.pRecInfo = recordInfo, arg.pvRecord = record; if (out) { - qWarning("QVariantToVARIANT: out-parameter not supported for records"); + qWarning("QVariant2VARIANT: out-parameter not supported for records"); return false; } } @@ -574,7 +574,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type if (arg.pdispVal) arg.pdispVal->AddRef(); if (out) { - qWarning("QVariantToVARIANT: out-parameter not supported for IDispatch"); + qWarning("QVariant2VARIANT: out-parameter not supported for IDispatch"); return false; } } else if (!qstrcmp(qvar.typeName(), "IDispatch**")) { @@ -588,7 +588,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type if (arg.punkVal) arg.punkVal->AddRef(); if (out) { - qWarning("QVariantToVARIANT: out-parameter not supported for IUnknown"); + qWarning("QVariant2VARIANT: out-parameter not supported for IUnknown"); return false; } #ifdef QAX_SERVER @@ -602,7 +602,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type qAxFactory()->createObjectWrapper(static_cast(user), &arg.pdispVal); } if (out) { - qWarning("QVariantToVARIANT: out-parameter not supported for subtype"); + qWarning("QVariant2VARIANT: out-parameter not supported for subtype"); return false; } #else @@ -612,7 +612,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type arg.vt = VT_DISPATCH; object->queryInterface(IID_IDispatch, (void**)&arg.pdispVal); if (out) { - qWarning("QVariantToVARIANT: out-parameter not supported for subtype"); + qWarning("QVariant2VARIANT: out-parameter not supported for subtype"); return false; } #endif diff --git a/src/plugins/platforms/windows/accessible/comutils.h b/src/plugins/platforms/windows/accessible/comutils.h index c9ed2b1224..8593f68d76 100644 --- a/src/plugins/platforms/windows/accessible/comutils.h +++ b/src/plugins/platforms/windows/accessible/comutils.h @@ -52,7 +52,8 @@ QT_BEGIN_NAMESPACE class QVariant; -bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out); +// Originally QVariantToVARIANT copied from ActiveQt - renamed to avoid conflicts in static builds. +bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out); inline QString BSTRToQString(const BSTR &bstr) { diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp index 03bb94db8f..838cd055ab 100644 --- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp +++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp @@ -1425,7 +1425,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_currentValue(VARIANT *curre return E_FAIL; if (QAccessibleValueInterface *valueIface = valueInterface()) { const QVariant var = valueIface->currentValue(); - if (QVariantToVARIANT(var, *currentValue, QByteArray(), false)) + if (QVariant2VARIANT(var, *currentValue, QByteArray(), false)) return S_OK; } @@ -1456,7 +1456,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_maximumValue(VARIANT *maxim return E_FAIL; if (QAccessibleValueInterface *valueIface = valueInterface()) { const QVariant var = valueIface->maximumValue(); - if (QVariantToVARIANT(var, *maximumValue, QByteArray(), false)) + if (QVariant2VARIANT(var, *maximumValue, QByteArray(), false)) return S_OK; } maximumValue->vt = VT_EMPTY; @@ -1470,7 +1470,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_minimumValue(VARIANT *minim return E_FAIL; if (QAccessibleValueInterface *valueIface = valueInterface()) { const QVariant var = valueIface->minimumValue(); - if (QVariantToVARIANT(var, *minimumValue, QByteArray(), false)) + if (QVariant2VARIANT(var, *minimumValue, QByteArray(), false)) return S_OK; } minimumValue->vt = VT_EMPTY; -- cgit v1.2.3 From dde9569d389b4382e8869ac48f942adb3c51ade7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 17 Dec 2012 22:46:45 +0100 Subject: Initalize the printinfo on Mac if it requests and it needs initalizing When the print panel was closed then it would clean up the printinfo and if it was requested for the same QPrinter then it would not be recreated in time. Therefore we check if it is initalized and if not we re-initalize it. Task-number: QTBUG-28657 Change-Id: I7dc9011b80e03cfa3eae8fee2fcf6cc8021a8566 Reviewed-by: Lars Knoll --- src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index f0b1bd330a..271c9d2894 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -107,8 +107,10 @@ QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport() void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine) { #ifndef QT_NO_WIDGETS - QMacPrintEngine *macPrintEngine = static_cast(printEngine); - return macPrintEngine->d_func()->printInfo; + QMacPrintEnginePrivate *macPrintEnginePriv = static_cast(printEngine)->d_func(); + if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized()) + macPrintEnginePriv->initialize(); + return macPrintEnginePriv->printInfo; #else qFatal("Printing is not supported when Qt is configured with -no-widgets"); return 0; -- cgit v1.2.3 From 019f9158e64ae24aaebb72d600ad9e90407d20ff Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Fri, 14 Dec 2012 17:15:47 +0000 Subject: Blackberry: Reset virtual keyboard when shown. The keyboard mode is shared between applications. You can reproduce this bug by clicking on a spin box, it will open a number only keyboard, then close the application and run an application that shows a text edit: a number only keyboard will appear. PPS keyboard already does this. Change-Id: Ia22e96ce13ad0cec1fd3b43fcdf4d03abfc25134 Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp index 059dcb574b..3d2f49aa6c 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp @@ -86,6 +86,11 @@ bool QQnxVirtualKeyboardBps::handleEvent(bps_event_t *event) bool QQnxVirtualKeyboardBps::showKeyboard() { qVirtualKeyboardDebug() << Q_FUNC_INFO << "current visibility=" << isVisible(); + + // They keyboard's mode is global between applications, we have to set it each time + if ( !isVisible() ) + applyKeyboardMode(keyboardMode()); + virtualkeyboard_show(); return true; } -- cgit v1.2.3 From 3a75e2f227810d75adc22d426fcab1355611adee Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 17 Dec 2012 22:46:45 +0100 Subject: Initalize the printinfo on Mac if it requests and it needs initalizing When the print panel was closed then it would clean up the printinfo and if it was requested for the same QPrinter then it would not be recreated in time. Therefore we check if it is initalized and if not we re-initalize it. Task-number: QTBUG-28657 Change-Id: I7dc9011b80e03cfa3eae8fee2fcf6cc8021a8566 Reviewed-by: Lars Knoll (cherry picked from commit dde9569d389b4382e8869ac48f942adb3c51ade7) Reviewed-by: Sergio Ahumada --- src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index f0b1bd330a..271c9d2894 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -107,8 +107,10 @@ QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport() void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine) { #ifndef QT_NO_WIDGETS - QMacPrintEngine *macPrintEngine = static_cast(printEngine); - return macPrintEngine->d_func()->printInfo; + QMacPrintEnginePrivate *macPrintEnginePriv = static_cast(printEngine)->d_func(); + if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized()) + macPrintEnginePriv->initialize(); + return macPrintEnginePriv->printInfo; #else qFatal("Printing is not supported when Qt is configured with -no-widgets"); return 0; -- cgit v1.2.3 From 3bf50a7db9a1add66fb66b7a1f9c1d3b038c5e7f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 18 Dec 2012 14:05:45 +0100 Subject: Fix font sizes when X11 has a forced dpi setting On X11, the X resource system can override the physical DPI of the screen for resolving font sizes etc. Correctly load the setting and adjust the logicalDpi() accordingly. Change-Id: Id60d03d1d214fb99e9de17a65976abd170bb7cca Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/xcb/qxcbscreen.cpp | 44 ++++++++++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ 2 files changed, 46 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 4f0c3ba6bb..fc80662c46 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -66,6 +66,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_orientation(Qt::PrimaryOrientation) , m_number(number) , m_refreshRate(60) + , m_forcedDpi(-1) { if (connection->hasXRandr()) xcb_randr_select_input(xcb_connection(), screen()->root, true); @@ -82,6 +83,9 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, if (m_availableGeometry.isEmpty()) m_availableGeometry = QRect(QPoint(), m_virtualSize); + readXResources(); + + #ifdef Q_XCB_DEBUG qDebug(); qDebug("Screen output %s of xcb screen %d:", m_outputName.toUtf8().constData(), m_number); @@ -243,6 +247,9 @@ QImage::Format QXcbScreen::format() const QDpi QXcbScreen::logicalDpi() const { + if (m_forcedDpi > 0) + return QDpi(m_forcedDpi, m_forcedDpi); + return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); } @@ -474,4 +481,41 @@ QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) return result; } +void QXcbScreen::readXResources() +{ + int offset = 0; + QByteArray resources; + while(1) { + xcb_get_property_reply_t *reply = + xcb_get_property_reply(xcb_connection(), + xcb_get_property_unchecked(xcb_connection(), false, screen()->root, + XCB_ATOM_RESOURCE_MANAGER, + XCB_ATOM_STRING, offset/4, 8192), NULL); + bool more = false; + if (reply && reply->format == 8 && reply->type == XCB_ATOM_STRING) { + resources += QByteArray((const char *)xcb_get_property_value(reply), xcb_get_property_value_length(reply)); + offset += xcb_get_property_value_length(reply); + more = reply->bytes_after != 0; + } + + if (reply) + free(reply); + + if (!more) + break; + } + + QList split = resources.split('\n'); + for (int i = 0; i < split.size(); ++i) { + const QByteArray &r = split.at(i); + if (r.startsWith("Xft.dpi:\t")) { + bool ok; + int dpi = r.mid(sizeof("Xft.dpi:")).toInt(&ok); + if (ok) + m_forcedDpi = dpi; + break; + } + } +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index d9eee464dc..96d30cde8b 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -96,6 +96,7 @@ public: void updateGeometry(xcb_timestamp_t timestamp); void updateRefreshRate(); + void readXResources(); private: xcb_screen_t *m_screen; xcb_randr_crtc_t m_crtc; @@ -114,6 +115,7 @@ private: QMap m_visuals; QXcbCursor *m_cursor; int m_refreshRate; + int m_forcedDpi; }; QT_END_NAMESPACE -- cgit v1.2.3 From 9f28f8bcbbf72d737616bcf57820c1e4bef3be95 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 17 Dec 2012 11:53:55 +0100 Subject: Prevent a crash if the pixmap passed in is null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the pixmap passed in is null then we should not try to create a NSImage for it, so we just return 0 instead. Change-Id: Idae7ba304c97878e0aa8ae1eead5f4bb644a73de Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index c1146612a6..e242b4e366 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -138,6 +138,8 @@ NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image) NSImage *qt_mac_create_nsimage(const QPixmap &pm) { + if (pm.isNull()) + return 0; QImage image = pm.toImage(); CGImageRef cgImage = qt_mac_image_to_cgimage(image); NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage); -- cgit v1.2.3 From 21e809a486874b96b15735c94df6f6576ccd5368 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 21 Dec 2012 10:36:10 +0100 Subject: fix linker command line gcc is apparently tolerant against this abuse. icc is not. Task-number: QTBUG-28775 Change-Id: I872d32177562f076ca8aecd263bc4bb3c7e8edc0 Reviewed-by: Kai Koehne --- src/plugins/platforms/xcb/xcb-plugin.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 20ec5701b9..5823e97f36 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -110,7 +110,7 @@ contains(QT_CONFIG, xcb-qt) { DEFINES += XCB_USE_RENDER XCB_DIR = ../../../3rdparty/xcb INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude - LIBS += -lxcb -L ./xcb-static -l xcb-static + LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static } else { LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr !contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape -- cgit v1.2.3 From 7706c31eaa686299d7e22da809fec00c0db47c86 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 21 Dec 2012 15:51:50 +0100 Subject: Fix some typos Change-Id: I4e8d9bd8ea66ec810e4f1fbfd8ddbf25c4b3d980 Reviewed-by: Mitch Curtis --- src/plugins/platforms/directfb/qdirectfbblitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index cac250fb9d..ec6ecd540c 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -133,7 +133,7 @@ void QDirectFbBlitter::alphaFillRect(const QRectF &rect, const QColor &color, QP int x, y, w, h; DFBResult result; - // check paramters + // check parameters rect.toRect().getRect(&x, &y ,&w, &h); if ((w <= 0) || (h <= 0)) return; -- cgit v1.2.3 From 586adeabe4d58a7c8a71bbb1be79c3533ab858ff Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 21 Dec 2012 12:09:56 +0100 Subject: add and use qtHaveModule() function this is much more elegant than the so far propagated !isEmpty(QT.foo.name). also replace feature-specific tests (no-gui and no-widgets) and the obsolete contains(QT_CONFIG, foo) syntax. Change-Id: Ia4b3c8febcabf9eeca67b1f9173a523820b1038b Reviewed-by: Sergio Ahumada Reviewed-by: Tasuku Suzuki Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/cocoa/cocoa.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 85e3f0007c..83e2a88e6a 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -82,7 +82,7 @@ LIBS += -framework Cocoa -framework IOKit QT += core-private gui-private platformsupport-private -!contains(QT_CONFIG, no-widgets) { +qtHaveModule(widgets) { OBJECTIVE_SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ -- cgit v1.2.3 From 3262ba8de68a4af7169e884f36f3ba26ad00806f Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 11 Dec 2012 12:34:46 +0100 Subject: Cocoa: Re-enable per class palette on QPA plugin Task-number: QTBUG-28443 Change-Id: If66604e8d002be6cf4c308378199c96be7422e06 Reviewed-by: Jake Petroules Reviewed-by: Jens Bache-Wiig --- .../platforms/cocoa/qcocoasystemsettings.mm | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index aacf47ec43..692e504432 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -96,6 +96,8 @@ QColor qt_mac_colorForThemeTextColor(ThemeTextColor themeColor) case kThemeTextColorTabFrontInactive: case kThemeTextColorBevelButtonInactive: return QColor(127, 127, 127, 255); + case kThemeTextColorMenuItemSelected: + return Qt::white; default: return QColor(0, 0, 0, 255); // ### TODO: Sample color like Qt 4. } @@ -153,21 +155,19 @@ struct QMacPaletteMap { }; static QMacPaletteMap mac_widget_colors[] = { -// TODO (msorvig): Fix/match palette behavior with Qt 4 and enable. -// -// QMacPaletteMap(QPlatformTheme::ToolButtonPalette, kThemeTextColorBevelButtonActive, kThemeTextColorBevelButtonInactive), -// QMacPaletteMap(QPlatformTheme::ButtonPalette, kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive), -// QMacPaletteMap(QPlatformTheme::HeaderPalette, kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive), -// QMacPaletteMap(QPlatformTheme::ComboBoxPalette, kThemeTextColorPopupButtonActive, kThemeTextColorPopupButtonInactive), -// QMacPaletteMap(QPlatformTheme::ItemViewPalette, kThemeTextColorListView, kThemeTextColorDialogInactive), -// QMacPaletteMap(QPlatformTheme::MessageBoxLabelPelette, kThemeTextColorAlertActive, kThemeTextColorAlertInactive), -// QMacPaletteMap(QPlatformTheme::TabBarPalette, kThemeTextColorTabFrontActive, kThemeTextColorTabFrontInactive), -// QMacPaletteMap(QPlatformTheme::LabelPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), -// QMacPaletteMap(QPlatformTheme::GroupBoxPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), -// QMacPaletteMap(QPlatformTheme::MenuPalette, kThemeTextColorPopupLabelActive, kThemeTextColorPopupLabelInactive), -// ### TODO: The zeros below gives white-on-black text. -// QMacPaletteMap(QPlatformTheme::TextEditPalette, 0, 0), -// QMacPaletteMap(QPlatformTheme::TextLineEditPalette, 0, 0), + QMacPaletteMap(QPlatformTheme::ToolButtonPalette, kThemeTextColorBevelButtonActive, kThemeTextColorBevelButtonInactive), + QMacPaletteMap(QPlatformTheme::ButtonPalette, kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive), + QMacPaletteMap(QPlatformTheme::HeaderPalette, kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive), + QMacPaletteMap(QPlatformTheme::ComboBoxPalette, kThemeTextColorPopupButtonActive, kThemeTextColorPopupButtonInactive), + QMacPaletteMap(QPlatformTheme::ItemViewPalette, kThemeTextColorListView, kThemeTextColorDialogInactive), + QMacPaletteMap(QPlatformTheme::MessageBoxLabelPelette, kThemeTextColorAlertActive, kThemeTextColorAlertInactive), + QMacPaletteMap(QPlatformTheme::TabBarPalette, kThemeTextColorTabFrontActive, kThemeTextColorTabFrontInactive), + QMacPaletteMap(QPlatformTheme::LabelPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), + QMacPaletteMap(QPlatformTheme::GroupBoxPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), + QMacPaletteMap(QPlatformTheme::MenuPalette, kThemeTextColorPopupLabelActive, kThemeTextColorPopupLabelInactive), + //### TODO: The zeros below gives white-on-black text. + QMacPaletteMap(QPlatformTheme::TextEditPalette, 0, 0), + QMacPaletteMap(QPlatformTheme::TextLineEditPalette, 0, 0), QMacPaletteMap(QPlatformTheme::NPalettes, 0, 0) }; QHash qt_mac_createRolePalettes() @@ -175,7 +175,7 @@ QHash qt_mac_createRolePalettes() QHash palettes; QColor qc; for (int i = 0; mac_widget_colors[i].paletteRole != QPlatformTheme::NPalettes; i++) { - QPalette pal; + QPalette pal = *qt_mac_createSystemPalette(); if (mac_widget_colors[i].active != 0) { qc = qt_mac_colorForThemeTextColor(mac_widget_colors[i].active); pal.setColor(QPalette::Active, QPalette::Text, qc); -- cgit v1.2.3 From afa57146cb519f27d816a295dadb2f0e71733f4b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 22 Dec 2012 13:40:26 -0800 Subject: Fix warning about unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qeglfshooks.h:77:21: error: 'hooks' defined but not used [-Werror=unused-variable] Defining a static variable in a header file is a terrible idea. But if I remove it, other code breaks and I don't have the time to fix them all. Change-Id: I4f94cbc7f0790df91853662749701e8fb11c2347 Reviewed-by: Samuel Rødal --- src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index f60b9ee83d..7106b99490 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE void QEglFSHooks::platformInit() { + Q_UNUSED(hooks); } void QEglFSHooks::platformDestroy() -- cgit v1.2.3