diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-10-16 08:11:14 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-10-16 08:11:14 (GMT) |
commit | 4f48e43dc4f8237875d7d4a61bf4e55ab92e3941 (patch) | |
tree | 0436d256b8812a5ff638d799710d3b20b4459716 /src | |
parent | 9935ad5366463429ed4aa9b8db03c4605586f866 (diff) | |
parent | 2348200bfb277450cb2e79f6054d95b3041b10db (diff) | |
download | Qt-4f48e43dc4f8237875d7d4a61bf4e55ab92e3941.zip Qt-4f48e43dc4f8237875d7d4a61bf4e55ab92e3941.tar.gz Qt-4f48e43dc4f8237875d7d4a61bf4e55ab92e3941.tar.bz2 |
Merge commit 'origin/4.6' into mmfphonon
Diffstat (limited to 'src')
42 files changed, 456 insertions, 350 deletions
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 1fd2165..a1c9833 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2565,8 +2565,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, Example: \snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 10 - The scope is QSettings::UserScope and the format is - QSettings::NativeFormat. + The scope is set to QSettings::UserScope, and the format is + set to QSettings::NativeFormat (i.e. calling setDefaultFormat() + before calling this constructor has no effect). \sa setDefaultFormat(), {Fallback Mechanism} */ @@ -2583,11 +2584,12 @@ QSettings::QSettings(const QString &organization, const QString &application, QO If \a scope is QSettings::UserScope, the QSettings object searches user-specific settings first, before it searches system-wide - settings as a fallback. If \a scope is - QSettings::SystemScope, the QSettings object ignores user-specific - settings and provides access to system-wide settings. + settings as a fallback. If \a scope is QSettings::SystemScope, the + QSettings object ignores user-specific settings and provides + access to system-wide settings. - The storage format is QSettings::NativeFormat. + The storage format is set to QSettings::NativeFormat (i.e. calling + setDefaultFormat() before calling this constructor has no effect). If no application name is given, the QSettings object will only access the organization-wide \l{Fallback Mechanism}{locations}. @@ -2668,6 +2670,8 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent) The scope is QSettings::UserScope and the format is defaultFormat() (QSettings::NativeFormat by default). + Use setDefaultFormat() before calling this constructor + to change the default format used by this constructor. The code @@ -3352,10 +3356,12 @@ QVariant QSettings::value(const QString &key, const QVariant &defaultValue) cons /*! \since 4.4 - Sets the default file format to the given \a format, used for storing - settings for the QSettings(QObject *) constructor. + Sets the default file format to the given \a format, which is used + for storing settings for the QSettings(QObject *) constructor. - If no default format is set, QSettings::NativeFormat is used. + If no default format is set, QSettings::NativeFormat is used. See + the documentation for the QSettings constructor you are using to + see if that constructor will ignore this function. \sa format() */ diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 22d0019..6001d9d 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3874,10 +3874,15 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const } } - if (host.startsWith(QLatin1Char('['))) + if (host.startsWith(QLatin1Char('['))) { url += host.toLatin1(); - else + } else if (host.contains(QLatin1Char(':'))) { + url += '['; + url += host.toLatin1(); + url += ']'; + } else { url += QUrl::toAce(host); + } if (!(options & QUrl::RemovePort) && port != -1) { url += ':'; url += QString::number(port).toAscii(); diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a8120cf..7be19b3 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3332,6 +3332,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists; if (!connectionLists) { + locker.unlock(); if (qt_signal_spy_callback_set.signal_end_callback != 0) qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index); return; @@ -3401,11 +3402,11 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign } #endif - locker.relock(); - if (qt_signal_spy_callback_set.slot_end_callback != 0) qt_signal_spy_callback_set.slot_end_callback(receiver, method); + locker.relock(); + QObjectPrivate::resetCurrentSender(receiver, ¤tSender, previousSender); if (connectionLists->orphaned) diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp index 590b666..df1179a 100644 --- a/src/gui/egl/qegl_qws.cpp +++ b/src/gui/egl/qegl_qws.cpp @@ -83,7 +83,8 @@ static QScreen *screenForDevice(QPaintDevice *device) screenNumber = 0; screen = screen->subScreens()[screenNumber]; } - while (screen->classId() == QScreen::ProxyClass) { + while (screen->classId() == QScreen::ProxyClass || + screen->classId() == QScreen::TransformedClass) { screen = static_cast<QProxyScreen *>(screen)->screen(); } return screen; diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri index fa4dd68..84253b5 100644 --- a/src/gui/embedded/directfb.pri +++ b/src/gui/embedded/directfb.pri @@ -1,7 +1,7 @@ # These defines might be necessary if your DirectFB driver doesn't # support all of the DirectFB API. # -#DEFINES += QT_NO_DIRECTFB_SUBSURFACE +#DEFINES += QT_DIRECTFB_SUBSURFACE #DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR #DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER #DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 5412e11..46c5431 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -78,6 +78,8 @@ static QString fallbackTheme() return X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); + } else { + return QLatin1String("hicolor"); } #endif return QString(); @@ -87,6 +89,8 @@ QIconLoader::QIconLoader() : m_themeKey(1), m_supportsSvg(false) { m_systemTheme = qt_guiPlatformPlugin()->systemIconThemeName(); + if (m_systemTheme.isEmpty()) + m_systemTheme = fallbackTheme(); QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid, QLatin1String("/iconengines"), @@ -107,6 +111,8 @@ void QIconLoader::updateSystemTheme() // Only change if this is not explicitly set by the user if (m_userTheme.isEmpty()) { QString theme = qt_guiPlatformPlugin()->systemIconThemeName(); + if (theme.isEmpty()) + theme = fallbackTheme(); if (theme != m_systemTheme) { m_systemTheme = theme; invalidateKey(); diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 268e78e..d91cedd 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1697,7 +1697,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) if ((event->buttons() & Qt::LeftButton) && d->selectionAllowed(index) && d->selectionModel) { setState(DragSelectingState); QItemSelectionModel::SelectionFlags command = selectionCommand(index, event); - if (command.testFlag(QItemSelectionModel::Toggle)) { + if (d->ctrlDragSelectionFlag != QItemSelectionModel::NoUpdate && command.testFlag(QItemSelectionModel::Toggle)) { command &= ~QItemSelectionModel::Toggle; command |= d->ctrlDragSelectionFlag; } @@ -3029,7 +3029,7 @@ void QAbstractItemView::update(const QModelIndex &index) //this test is important for peformance reason //For example in dataChanged we simply update all the cells without checking //it can be a major bottleneck to update rects that aren't even part of the viewport - if (d->viewport->geometry().intersects(rect)) + if (d->viewport->rect().intersects(rect)) d->viewport->update(rect); } } diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 2d98258..a610b73 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1117,6 +1117,9 @@ void QTableView::setHorizontalHeader(QHeaderView *header) connect(d->horizontalHeader, SIGNAL(sectionHandleDoubleClicked(int)), this, SLOT(resizeColumnToContents(int))); connect(d->horizontalHeader, SIGNAL(geometriesChanged()), this, SLOT(updateGeometries())); + + //update the sorting enabled states on the new header + setSortingEnabled(d->sortingEnabled); } /*! diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp index a086498..21c4e0a 100644 --- a/src/gui/itemviews/qtablewidget.cpp +++ b/src/gui/itemviews/qtablewidget.cpp @@ -571,6 +571,8 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order, colItems.remove(oldRow); vit = sortedInsertionIterator(vit, colItems.end(), order, item); int newRow = qMax((int)(vit - colItems.begin()), 0); + if ((newRow < oldRow) && !(*item < *colItems.at(oldRow - 1)) && !(*colItems.at(oldRow - 1) < *item)) + newRow = oldRow; vit = colItems.insert(vit, item); if (newRow != oldRow) { changed = true; diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 06342d8..040c498 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -623,7 +623,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order, lit = sortedInsertionIterator(lit, lst.end(), order, item); int newRow = qMax(lit - lst.begin(), 0); - if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1))) + if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1)) && !(*lst.at(oldRow - 1) < *item )) newRow = oldRow; lit = lst.insert(lit, item); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index c55d6e0..cb9dda4 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -464,12 +464,47 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent)); } +typedef QPair<QWidget*,QMouseEvent> Event; + +/* + * Helper function called by HandlePointerEvent - separated to keep that function readable + */ +static void generateEnterLeaveEvents(QList<Event> &events, QWidget *widgetUnderPointer, + QPoint globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) +{ + //moved to another widget, create enter and leave events + if (S60->lastPointerEventTarget) { + QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal( + S60->lastCursorPos), S60->lastCursorPos, button, QApplicationPrivate::mouse_buttons, + modifiers); + events.append(Event(S60->lastPointerEventTarget, mEventLeave)); + } + if (widgetUnderPointer) { + QMouseEvent mEventEnter(QEvent::Enter, widgetUnderPointer->mapFromGlobal(globalPos), + globalPos, button, QApplicationPrivate::mouse_buttons, modifiers); + + events.append(Event(widgetUnderPointer, mEventEnter)); +#ifndef QT_NO_CURSOR + S60->curWin = widgetUnderPointer->effectiveWinId(); + if (!QApplication::overrideCursor()) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_set_pointer_sprite(widgetUnderPointer->cursor()); + else +#endif + qt_symbian_setWindowCursor(widgetUnderPointer->cursor(), S60->curWin); + } +#endif + } +} + + void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) { - //### refactor me, getting too complex QMouseEvent::Type type; Qt::MouseButton button; mapS60MouseEventTypeToQt(&type, &button, &pEvent); + Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); if (m_previousEventLongTap) if (type == QEvent::MouseButtonRelease){ @@ -481,79 +516,76 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) return; // store events for later sending/saving - QWidget *alienWidget; - typedef QPair<QWidget*,QMouseEvent> Event; QList<Event > events; QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY); TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; - if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove) - { - // get the widget where the event happened - alienWidget = qwidget->childAt(widgetPos); - if (!alienWidget) - alienWidget = qwidget; - S60->mousePressTarget = alienWidget; + // widgets interested in the event + QWidget *widgetUnderPointer = qwidget->childAt(widgetPos); + if (!widgetUnderPointer) + widgetUnderPointer = qwidget; //i.e. this container widget + + QWidget *widgetWithMouseGrab = QWidget::mouseGrabber(); + + // handle auto grab of pointer when pressing / releasing + if (!widgetWithMouseGrab && type == QEvent::MouseButtonPress) { + //if previously auto-grabbed, generate a fake mouse release (platform bug: mouse release event was lost) + if (S60->mousePressTarget) { + QMouseEvent mEvent(QEvent::MouseButtonRelease, S60->mousePressTarget->mapFromGlobal(globalPos), globalPos, + button, QApplicationPrivate::mouse_buttons, modifiers); + events.append(Event(S60->mousePressTarget,mEvent)); + } + //auto grab the mouse + widgetWithMouseGrab = S60->mousePressTarget = widgetUnderPointer; + widgetWithMouseGrab->grabMouse(); + } + if (widgetWithMouseGrab && widgetWithMouseGrab == S60->mousePressTarget && type == QEvent::MouseButtonRelease) { + //release the auto grab - note this release event still goes to the autograb widget + S60->mousePressTarget = 0; + widgetWithMouseGrab->releaseMouse(); } - alienWidget = S60->mousePressTarget; + QWidget *widgetToReceiveMouseEvent; + if (widgetWithMouseGrab) + widgetToReceiveMouseEvent = widgetWithMouseGrab; + else + widgetToReceiveMouseEvent = widgetUnderPointer; - if (alienWidget != S60->lastPointerEventTarget) - if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove) - { - //moved to another widget, create enter and leave events - if (S60->lastPointerEventTarget) - { - QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal(S60->lastCursorPos), S60->lastCursorPos, - button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); - events.append(Event(S60->lastPointerEventTarget,mEventLeave)); - } - if (alienWidget) { - QMouseEvent mEventEnter(QEvent::Enter, alienWidget->mapFromGlobal(globalPos), - globalPos, button, QApplicationPrivate::mouse_buttons, mapToQtModifiers( - pEvent.iModifiers)); + //queue QEvent::Enter and QEvent::Leave, if the pointer has moved + if (widgetUnderPointer != S60->lastPointerEventTarget && (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove)) + generateEnterLeaveEvents(events, widgetUnderPointer, globalPos, button, modifiers); - events.append(Event(alienWidget, mEventEnter)); -#ifndef QT_NO_CURSOR - S60->curWin = alienWidget->effectiveWinId(); - if (!QApplication::overrideCursor()) { -#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS - if (S60->brokenPointerCursors) - qt_symbian_set_pointer_sprite(alienWidget->cursor()); - else -#endif - qt_symbian_setWindowCursor(alienWidget->cursor(), S60->curWin); - } -#endif - } - } + //save global state S60->lastCursorPos = globalPos; + S60->lastPointerEventPos = widgetPos; + S60->lastPointerEventTarget = widgetUnderPointer; + #if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS) if (S60->brokenPointerCursors) qt_symbian_move_cursor_sprite(); #endif - S60->lastPointerEventPos = widgetPos; - S60->lastPointerEventTarget = alienWidget; - if (alienWidget) - { - QMouseEvent mEvent(type, alienWidget->mapFromGlobal(globalPos), globalPos, - button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); - events.append(Event(alienWidget,mEvent)); - QEventDispatcherS60 *dispatcher; - // It is theoretically possible for someone to install a different event dispatcher. - if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(alienWidget->d_func()->threadData->eventDispatcher)) != 0) { - if (dispatcher->excludeUserInputEvents()) { - for (int i=0;i < events.count();++i) - { - Event next = events[i]; - dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second)); - } - return; + + //queue this event. + Q_ASSERT(widgetToReceiveMouseEvent); + QMouseEvent mEvent(type, widgetToReceiveMouseEvent->mapFromGlobal(globalPos), globalPos, + button, QApplicationPrivate::mouse_buttons, modifiers); + events.append(Event(widgetToReceiveMouseEvent,mEvent)); + QEventDispatcherS60 *dispatcher; + // It is theoretically possible for someone to install a different event dispatcher. + if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widgetToReceiveMouseEvent->d_func()->threadData->eventDispatcher)) != 0) { + if (dispatcher->excludeUserInputEvents()) { + for (int i=0;i < events.count();++i) + { + Event next = events[i]; + dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second)); } + return; } } + + //send events in the queue for (int i=0;i < events.count();++i) { Event next = events[i]; diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index b1c5fc5..4c2a14a 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1066,7 +1066,10 @@ extern "C" { sendToPopup = true; } - if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)) { + if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled) + && !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly + || widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly + || widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) { [qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]]; } if (sendKeyEvents && !composing) { @@ -1420,29 +1423,29 @@ Qt::DropAction QDragManager::drag(QDrag *o) // convert the image to NSImage. NSImage *image = (NSImage *)qt_mac_create_nsimage(pix); [image retain]; - DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; + DnDParams dndParams = *[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; // save supported actions - [dndParams->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; - NSPoint imageLoc = {dndParams->localPoint.x - hotspot.x(), - dndParams->localPoint.y + pix.height() - hotspot.y()}; + [dndParams.view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; + NSPoint imageLoc = {dndParams.localPoint.x - hotspot.x(), + dndParams.localPoint.y + pix.height() - hotspot.y()}; NSSize mouseOffset = {0.0, 0.0}; NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; - NSPoint windowPoint = [dndParams->theEvent locationInWindow]; + NSPoint windowPoint = [dndParams.theEvent locationInWindow]; dragPrivate()->executed_action = Qt::ActionMask; // do the drag - [dndParams->view retain]; - [dndParams->view dragImage:image + [dndParams.view retain]; + [dndParams.view dragImage:image at:imageLoc offset:mouseOffset - event:dndParams->theEvent + event:dndParams.theEvent pasteboard:pboard - source:dndParams->view + source:dndParams.view slideBack:YES]; - [dndParams->view release]; + [dndParams.view release]; [image release]; dragPrivate()->executed_action = Qt::IgnoreAction; object = 0; - Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction)); + Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams.performedAction)); // do post drag processing, if required. if(performedAction != Qt::IgnoreAction) { // check if the receiver points us to a file location. diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 0034819..02eb526 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -51,12 +51,12 @@ QT_BEGIN_HEADER +Q_DECLARE_METATYPE(Qt::GestureState) + QT_BEGIN_NAMESPACE QT_MODULE(Gui) -Q_DECLARE_METATYPE(Qt::GestureState) - class QGesturePrivate; class Q_GUI_EXPORT QGesture : public QObject { @@ -180,8 +180,12 @@ public: friend class QPinchGestureRecognizer; }; +QT_END_NAMESPACE + Q_DECLARE_METATYPE(QPinchGesture::WhatChanged) +QT_BEGIN_NAMESPACE + class QSwipeGesturePrivate; class Q_GUI_EXPORT QSwipeGesture : public QGesture { diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 4fc3d3d..cee38ee 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1425,7 +1425,7 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) SetMenuItemProperty(data.submenuHandle, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); #else NSMenu *subMenu = static_cast<NSMenu *>(action->action->menu()->macMenu()); - if ([subMenu supermenu] != nil) { + if ([subMenu supermenu] && [subMenu supermenu] != [item menu]) { // The menu is already a sub-menu of another one. Cocoa will throw an exception, // in such cases. For the time being, a new QMenu with same set of actions is the // only workaround. @@ -1718,7 +1718,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::syncAction(QMacMenuAction *action) GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); SetMenuItemProperty(submenu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); #else - if ([submenu supermenu] != nil) + if ([submenu supermenu] && [submenu supermenu] != [item menu]) return; else [item setSubmenu:submenu]; diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 81fac57..6962ab3 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -105,6 +105,9 @@ void QHttpNetworkConnectionChannel::init() QObject::connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError>&)), this, SLOT(_q_sslErrors(const QList<QSslError>&)), Qt::DirectConnection); + QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)), + this, SLOT(_q_encryptedBytesWritten(qint64)), + Qt::DirectConnection); } #endif } @@ -881,6 +884,15 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors) //QNetworkReply::NetworkError errorCode = QNetworkReply::ProtocolFailure; emit connection->sslErrors(errors); } + +void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes) +{ + Q_UNUSED(bytes); + // bytes have been written to the socket. write even more of them :) + if (isSocketWriting()) + sendRequest(); + // otherwise we do nothing +} #endif QT_END_NAMESPACE diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index 1d1153e..127a431 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -180,6 +180,7 @@ public: #ifndef QT_NO_OPENSSL void _q_encrypted(); // start sending request (https) void _q_sslErrors(const QList<QSslError> &errors); // ssl errors from the socket + void _q_encryptedBytesWritten(qint64 bytes); // proceed sending #endif }; diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 0e9cb4f..a5732fb 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -149,6 +149,13 @@ This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (\l{http://www.openssl.org/}). + \note Be aware of the difference between the bytesWritten() signal and + the encryptedBytesWritten() signal. For a QTcpSocket, bytesWritten() + will get emitted as soon as data has been written to the TCP socket. + For a QSslSocket, bytesWritten() will get emitted when the data + is being encrypted and encryptedBytesWritten() + will get emitted as soon as data has been written to the TCP socket. + \sa QSslCertificate, QSslCipher, QSslError */ diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index d434725..e561932 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -126,14 +126,12 @@ wince*: { embedded { SOURCES += qgl_qws.cpp \ - qglpaintdevice_qws.cpp \ qglpixelbuffer_egl.cpp \ qglscreen_qws.cpp \ qglwindowsurface_qws.cpp \ qgl_egl.cpp - HEADERS += qglpaintdevice_qws_p.h \ - qglscreen_qws.h \ + HEADERS += qglscreen_qws.h \ qglwindowsurface_qws_p.h \ qgl_egl_p.h diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5e00b11..0d00f59 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -76,7 +76,6 @@ #endif #ifdef Q_WS_QWS -#include <private/qglpaintdevice_qws_p.h> #include <private/qglwindowsurface_qws_p.h> #endif diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index bb23ace..5e59975 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -73,7 +73,8 @@ static QGLScreen *glScreenForDevice(QPaintDevice *device) screenNumber = 0; screen = screen->subScreens()[screenNumber]; } - while (screen->classId() == QScreen::ProxyClass) { + while (screen->classId() == QScreen::ProxyClass || + screen->classId() == QScreen::TransformedClass) { screen = static_cast<QProxyScreen *>(screen)->screen(); } if (screen->classId() == QScreen::GLClass) diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index 1e7ba8d..63ba5da 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE -class QGLPaintDevice : public QPaintDevice +class Q_OPENGL_EXPORT QGLPaintDevice : public QPaintDevice { public: QGLPaintDevice(); diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp deleted file mode 100644 index 1512278..0000000 --- a/src/opengl/qglpaintdevice_qws.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <private/qglpaintdevice_qws_p.h> -#include <private/qgl_p.h> -#include <private/qpaintengine_opengl_p.h> -#include <private/qglwindowsurface_qws_p.h> - -QT_BEGIN_NAMESPACE - -class QWSGLPaintDevicePrivate -{ -public: - QWidget *widget; -}; - -QWSGLPaintDevice::QWSGLPaintDevice(QWidget *widget) : - d_ptr(new QWSGLPaintDevicePrivate) -{ - Q_D(QWSGLPaintDevice); - d->widget = widget; -} - -QWSGLPaintDevice::~QWSGLPaintDevice() -{ -} - -QPaintEngine* QWSGLPaintDevice::paintEngine() const -{ - return qt_qgl_paint_engine(); -} - -int QWSGLPaintDevice::metric(PaintDeviceMetric m) const -{ - Q_D(const QWSGLPaintDevice); - Q_ASSERT(d->widget); - - return qt_paint_device_metric(d->widget, m); -} - -QWSGLWindowSurface* QWSGLPaintDevice::windowSurface() const -{ - Q_D(const QWSGLPaintDevice); - return static_cast<QWSGLWindowSurface*>(d->widget->windowSurface()); -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglpaintdevice_qws_p.h b/src/opengl/qglpaintdevice_qws_p.h deleted file mode 100644 index 6dc9d31..0000000 --- a/src/opengl/qglpaintdevice_qws_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSGLPAINTDEVICE_GL_P_H -#define QWSGLPAINTDEVICE_GL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QGLWindowSurface class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qscopedpointer.h> -#include <QPaintDevice> - -QT_BEGIN_NAMESPACE - -class QWidget; -class QWSGLWindowSurface; -class QWSGLPaintDevicePrivate; - -class Q_OPENGL_EXPORT QWSGLPaintDevice : public QPaintDevice -{ - Q_DECLARE_PRIVATE(QWSGLPaintDevice) -public: - QWSGLPaintDevice(QWidget *widget); - ~QWSGLPaintDevice(); - - QPaintEngine *paintEngine() const; - - int metric(PaintDeviceMetric m) const; - - QWSGLWindowSurface *windowSurface() const; - -private: - friend class QWSGLWindowSurface; - QScopedPointer<QWSGLPaintDevicePrivate> d_ptr; -}; - - -QT_END_NAMESPACE - -#endif // QWSGLPAINTDEVICE_GL_P_H diff --git a/src/opengl/qglwindowsurface_qws.cpp b/src/opengl/qglwindowsurface_qws.cpp index 6bf3257..5041cb9 100644 --- a/src/opengl/qglwindowsurface_qws.cpp +++ b/src/opengl/qglwindowsurface_qws.cpp @@ -43,7 +43,6 @@ #include <QtGui/QWidget> #include <QtOpenGL/QGLWidget> #include "private/qglwindowsurface_qws_p.h" -#include "private/qglpaintdevice_qws_p.h" #include "private/qpaintengine_opengl_p.h" QT_BEGIN_NAMESPACE diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 3e4a8e7..1a11476 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -66,7 +66,6 @@ #include "util/fragmentprograms_p.h" #ifdef Q_WS_QWS -#include "private/qglpaintdevice_qws_p.h" #include "private/qglwindowsurface_qws_p.h" #include "qwsmanager_qws.h" #include "private/qwsmanager_p.h" diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index e0c99d7..fdd61ea 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3328,9 +3328,6 @@ QPixmapFilter *QVGPaintEngine::pixmapFilter(int type, const QPixmapFilter *proto d->convolutionFilter.reset(new QVGPixmapConvolutionFilter); return d->convolutionFilter.data(); case QPixmapFilter::ColorizeFilter: - // Strength parameter does not work with current implementation. - if ((static_cast<const QPixmapColorizeFilter *>(prototype))->strength() != 1.0f) - break; if (!d->colorizeFilter) d->colorizeFilter.reset(new QVGPixmapColorizeFilter); return d->colorizeFilter.data(); diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp index 613f4ea..3305bbb 100644 --- a/src/openvg/qpixmapfilter_vg.cpp +++ b/src/openvg/qpixmapfilter_vg.cpp @@ -123,8 +123,7 @@ void QVGPixmapConvolutionFilter::draw } QVGPixmapColorizeFilter::QVGPixmapColorizeFilter() - : QPixmapColorizeFilter(), - firstTime(true) + : QPixmapColorizeFilter() { } @@ -136,7 +135,7 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const { if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { // The pixmap data is not an instance of QVGPixmapData, so fall - // back to the default convolution filter implementation. + // back to the default colorize filter implementation. QPixmapColorizeFilter::draw(painter, dest, src, srcRect); return; } @@ -154,50 +153,45 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const if (dstImage == VG_INVALID_HANDLE) return; - // Recompute the color matrix if the color has changed. + // Determine the weights for the matrix from the color and strength. QColor c = color(); - if (c != prevColor || firstTime) { - prevColor = c; - - // Determine the weights for the matrix from the color. - VGfloat weights[3]; - VGfloat invweights[3]; - VGfloat alpha = c.alphaF(); - weights[0] = c.redF() * alpha; - weights[1] = c.greenF() * alpha; - weights[2] = c.blueF() * alpha; - invweights[0] = 1.0f - weights[0]; - invweights[1] = 1.0f - weights[1]; - invweights[2] = 1.0f - weights[2]; - - // Grayscale weights. - static const VGfloat redGray = 11.0f / 32.0f; - static const VGfloat greenGray = 16.0f / 32.0f; - static const VGfloat blueGray = 1.0f - (redGray + greenGray); - - matrix[0][0] = redGray * invweights[0]; - matrix[0][1] = redGray * invweights[1]; - matrix[0][2] = redGray * invweights[2]; - matrix[0][3] = 0.0f; - matrix[1][0] = greenGray * invweights[0]; - matrix[1][1] = greenGray * invweights[1]; - matrix[1][2] = greenGray * invweights[2]; - matrix[1][3] = 0.0f; - matrix[2][0] = blueGray * invweights[0]; - matrix[2][1] = blueGray * invweights[1]; - matrix[2][2] = blueGray * invweights[2]; - matrix[2][3] = 0.0f; - matrix[3][0] = 0.0f; - matrix[3][1] = 0.0f; - matrix[3][2] = 0.0f; - matrix[3][3] = 1.0f; - matrix[4][0] = weights[0]; - matrix[4][1] = weights[1]; - matrix[4][2] = weights[2]; - matrix[4][3] = 0.0f; - } - - firstTime = false; + VGfloat strength = this->strength(); + VGfloat weights[3]; + VGfloat invweights[3]; + VGfloat alpha = c.alphaF(); + weights[0] = c.redF() * alpha; + weights[1] = c.greenF() * alpha; + weights[2] = c.blueF() * alpha; + invweights[0] = (1.0f - weights[0]) * strength; + invweights[1] = (1.0f - weights[1]) * strength; + invweights[2] = (1.0f - weights[2]) * strength; + + // Grayscale weights. + static const VGfloat redGray = 11.0f / 32.0f; + static const VGfloat greenGray = 16.0f / 32.0f; + static const VGfloat blueGray = 1.0f - (redGray + greenGray); + + VGfloat matrix[5][4]; + matrix[0][0] = redGray * invweights[0] + (1.0f - strength); + matrix[0][1] = redGray * invweights[1]; + matrix[0][2] = redGray * invweights[2]; + matrix[0][3] = 0.0f; + matrix[1][0] = greenGray * invweights[0]; + matrix[1][1] = greenGray * invweights[1] + (1.0f - strength); + matrix[1][2] = greenGray * invweights[2]; + matrix[1][3] = 0.0f; + matrix[2][0] = blueGray * invweights[0]; + matrix[2][1] = blueGray * invweights[1]; + matrix[2][2] = blueGray * invweights[2] + (1.0f - strength); + matrix[2][3] = 0.0f; + matrix[3][0] = 0.0f; + matrix[3][1] = 0.0f; + matrix[3][2] = 0.0f; + matrix[3][3] = 1.0f; + matrix[4][0] = weights[0] * strength; + matrix[4][1] = weights[1] * strength; + matrix[4][2] = weights[2] * strength; + matrix[4][3] = 0.0f; vgColorMatrix(dstImage, srcImage, matrix[0]); diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h index 58111ec..f79b6c2 100644 --- a/src/openvg/qpixmapfilter_vg_p.h +++ b/src/openvg/qpixmapfilter_vg_p.h @@ -79,11 +79,6 @@ public: ~QVGPixmapColorizeFilter(); void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const; - -private: - mutable VGfloat matrix[5][4]; - mutable QColor prevColor; - mutable bool firstTime; }; class Q_OPENVG_EXPORT QVGPixmapDropShadowFilter : public QPixmapDropShadowFilter diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 8662df6..57b1950 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -207,7 +207,7 @@ void QDirectFBMouseHandlerPrivate::readMouseData() int wheel = 0; if (input.type == DIET_AXISMOTION) { -#ifdef QT_NO_DIRECTFB_LAYER +#if defined(QT_NO_DIRECTFB_LAYER) || defined(QT_DIRECTFB_WINDOW_AS_CURSOR) if (input.flags & DIEF_AXISABS) { switch (input.axis) { case DIAI_X: x = input.axisabs; break; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 0f7a6de..449bc0d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -99,8 +99,11 @@ public: qint64 cursorImageKey; QDirectFBScreen *q; + static QDirectFBScreen *instance; }; +QDirectFBScreen *QDirectFBScreenPrivate::instance = 0; + QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) : QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE), directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid), @@ -802,13 +805,21 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) QDirectFBScreen::QDirectFBScreen(int display_id) : QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this)) { + QDirectFBScreenPrivate::instance = this; } QDirectFBScreen::~QDirectFBScreen() { + if (QDirectFBScreenPrivate::instance == this) + QDirectFBScreenPrivate::instance = 0; delete d_ptr; } +QDirectFBScreen *QDirectFBScreen::instance() +{ + return QDirectFBScreenPrivate::instance; +} + int QDirectFBScreen::depth(DFBSurfacePixelFormat format) { switch (format) { @@ -1050,6 +1061,26 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var return false; } +static inline QColor colorFromName(const QString &name) +{ + QRegExp rx("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])"); + rx.setCaseSensitivity(Qt::CaseInsensitive); + if (rx.exactMatch(name)) { + Q_ASSERT(rx.numCaptures() == 4); + int ints[4]; + int i; + for (i=0; i<4; ++i) { + bool ok; + ints[i] = rx.cap(i + 1).toUInt(&ok, 16); + if (!ok || ints[i] > 255) + break; + } + if (i == 4) + return QColor(ints[0], ints[1], ints[2], ints[3]); + } + return QColor(name); +} + bool QDirectFBScreen::connect(const QString &displaySpec) { DFBResult result = DFB_OK; @@ -1282,18 +1313,50 @@ bool QDirectFBScreen::connect(const QString &displaySpec) #endif #ifdef QT_DIRECTFB_WM surface->Release(surface); + QColor backgroundColor; #else - QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)")); + QColor &backgroundColor = d_ptr->backgroundColor; +#endif + + QRegExp backgroundColorRegExp(QLatin1String("bgcolor=(.+)")); backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive); if (displayArgs.indexOf(backgroundColorRegExp) != -1) { - d_ptr->backgroundColor.setNamedColor(backgroundColorRegExp.cap(1)); + backgroundColor = colorFromName(backgroundColorRegExp.cap(1)); } - if (!d_ptr->backgroundColor.isValid()) - d_ptr->backgroundColor = Qt::green; - d_ptr->primarySurface->Clear(d_ptr->primarySurface, d_ptr->backgroundColor.red(), - d_ptr->backgroundColor.green(), d_ptr->backgroundColor.blue(), - d_ptr->backgroundColor.alpha()); +#ifdef QT_NO_DIRECTFB_WM + if (!backgroundColor.isValid()) + backgroundColor = Qt::green; + d_ptr->primarySurface->Clear(d_ptr->primarySurface, backgroundColor.red(), + backgroundColor.green(), backgroundColor.blue(), + backgroundColor.alpha()); d_ptr->primarySurface->Flip(d_ptr->primarySurface, 0, d_ptr->flipFlags); +#else + if (backgroundColor.isValid()) { + DFBResult result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::connect " + "Unable to set cooperative level", result); + } + result = d_ptr->dfbLayer->SetBackgroundColor(d_ptr->dfbLayer, backgroundColor.red(), backgroundColor.green(), + backgroundColor.blue(), backgroundColor.alpha()); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::connect: " + "Unable to set background color", result); + } + + result = d_ptr->dfbLayer->SetBackgroundMode(d_ptr->dfbLayer, DLBM_COLOR); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::connect: " + "Unable to set background mode", result); + } + + result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::connect " + "Unable to set cooperative level", result); + } + + } #endif return true; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 5e8c5c6..0520cdc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#if !defined QT_NO_DIRECTFB_SUBSURFACE && !defined QT_DIRECTFB_SUBSURFACE -#define QT_DIRECTFB_SUBSURFACE +#if !defined QT_DIRECTFB_SUBSURFACE && !defined QT_NO_DIRECTFB_SUBSURFACE +#define QT_NO_DIRECTFB_SUBSURFACE #endif #if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER #define QT_DIRECTFB_LAYER @@ -163,12 +163,7 @@ public: QWSWindowSurface *createSurface(QWidget *widget) const; QWSWindowSurface *createSurface(const QString &key) const; - static inline QDirectFBScreen *instance() { - QScreen *inst = QScreen::instance(); - Q_ASSERT(!inst || inst->classId() == QScreen::DirectFBClass); - return static_cast<QDirectFBScreen*>(inst); - } - + static QDirectFBScreen *instance(); void waitIdle(); IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; #ifdef QT_DIRECTFB_SUBSURFACE diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index ac9dc8d..c1b655a 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -617,6 +617,16 @@ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect) *rect = drawable->rect; } +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle) +{ + if (drawable->rotationAngle != angle) { + drawable->rotationAngle = angle; + + /* Force the buffers to be recreated if the rotation angle changes */ + pvrQwsInvalidateBuffers(drawable); + } +} + int pvrQwsGetStride(PvrQwsDrawable *drawable) { if (drawable->backBuffersValid) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index 952ff6f..b9e035f 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -126,6 +126,9 @@ void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect); /* Get the current geometry for a drawable */ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect); +/* Set the rotation angle in degrees */ +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle); + /* Get the line stride for a drawable. Returns zero if the buffers are not allocated or have been invalidated */ int pvrQwsGetStride(PvrQwsDrawable *drawable); diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h index cf80a90..dcd4e4f 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h @@ -114,6 +114,7 @@ struct _PvrQwsDrawable int isFullScreen; int strideBytes; int stridePixels; + int rotationAngle; PvrQwsSwapFunction swapFunction; void *userData; PvrQwsDrawable *nextWinId; diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c index 253f39f..28b2251 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c @@ -132,6 +132,16 @@ static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display) return WSEGL_SUCCESS; } +static WSEGLRotationAngle wseglRotationValue(int degrees) +{ + switch (degrees) { + case 90: return WSEGL_ROTATE_90; + case 180: return WSEGL_ROTATE_180; + case 270: return WSEGL_ROTATE_270; + default: return WSEGL_ROTATE_0; + } +} + /* Create the WSEGL drawable version of a native window */ static WSEGLError wseglCreateWindowDrawable (WSEGLDisplayHandle display, WSEGLConfig *config, @@ -152,7 +162,7 @@ static WSEGLError wseglCreateWindowDrawable *drawable = (WSEGLDrawableHandle)screen; if (!pvrQwsAllocBuffers(screen)) return WSEGL_OUT_OF_MEMORY; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(screen->rotationAngle); return WSEGL_SUCCESS; } @@ -163,7 +173,7 @@ static WSEGLError wseglCreateWindowDrawable /* The drawable is ready to go */ *drawable = (WSEGLDrawableHandle)draw; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(draw->rotationAngle); if (!pvrQwsAllocBuffers(draw)) return WSEGL_OUT_OF_MEMORY; return WSEGL_SUCCESS; diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index 4dce87f..322a6b2 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -51,6 +51,11 @@ on the device with: hellogl_es -qws +The driver also supports screen rotation if Qt is configured with the +-qt-gfx-transformed option and the QWS_DISPLAY variable is wrapped in a +"Transformed" declaration: + + Transformed:powervr:mmWidth40:mmHeight54:Rot90:0 Know Issues: * A QGLWidget may not have window decorations if it is a top-level window. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index 61f2225..1dec9ea 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -44,6 +44,9 @@ #include "pvrqwsdrawable_p.h" #include <QRegExp> #include <qwindowsystem_qws.h> +#ifndef QT_NO_QWS_TRANSFORMED +#include <qscreentransformed_qws.h> +#endif #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/kd.h> @@ -62,6 +65,7 @@ PvrEglScreen::PvrEglScreen(int displayId) ttyfd = -1; doGraphicsMode = true; oldKdMode = KD_TEXT; + parent = 0; // Make sure that the EGL layer is initialized and the drivers loaded. EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); @@ -192,7 +196,7 @@ bool PvrEglScreen::hasOpenGL() QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const { if (qobject_cast<QGLWidget*>(widget)) - return new PvrEglWindowSurface(widget, (QScreen *)this, displayId); + return new PvrEglWindowSurface(widget, (PvrEglScreen *)this, displayId); return QScreen::createSurface(widget); } @@ -206,6 +210,67 @@ QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const } //![1] +#ifndef QT_NO_QWS_TRANSFORMED + +static const QScreen *parentScreen + (const QScreen *current, const QScreen *lookingFor) +{ + if (!current) + return 0; + switch (current->classId()) { + case QScreen::ProxyClass: + case QScreen::TransformedClass: { + const QScreen *child = + static_cast<const QProxyScreen *>(current)->screen(); + if (child == lookingFor) + return current; + else + return parentScreen(child, lookingFor); + } + // Not reached. + + case QScreen::MultiClass: { + QList<QScreen *> screens = current->subScreens(); + foreach (QScreen *screen, screens) { + if (screen == lookingFor) + return current; + const QScreen *parent = parentScreen(screen, lookingFor); + if (parent) + return parent; + } + } + break; + + default: break; + } + return 0; +} + +int PvrEglScreen::transformation() const +{ + // We need to search for our parent screen, which is assumed to be + // "Transformed". If it isn't, then there is no transformation. + // There is no direct method to get the parent screen so we need + // to search every screen until we find ourselves. + if (!parent && qt_screen != this) + parent = parentScreen(qt_screen, this); + if (!parent) + return 0; + if (parent->classId() != QScreen::TransformedClass) + return 0; + return 90 * static_cast<const QTransformedScreen *>(parent) + ->transformation(); +} + +#else + +int PvrEglScreen::transformation() const +{ + return 0; +} + +#endif + void PvrEglScreen::sync() { // Put code here to synchronize 2D and 3D operations if necessary. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h index 8bf42c7..5769e70 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h @@ -46,16 +46,18 @@ #include <QGLScreen> #include "pvrqwsdrawable.h" +class PvrEglScreen; + class PvrEglScreenSurfaceFunctions : public QGLScreenSurfaceFunctions { public: - PvrEglScreenSurfaceFunctions(QScreen *s, int screenNum) + PvrEglScreenSurfaceFunctions(PvrEglScreen *s, int screenNum) : screen(s), displayId(screenNum) {} bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); private: - QScreen *screen; + PvrEglScreen *screen; int displayId; }; @@ -80,6 +82,8 @@ public: QWSWindowSurface* createSurface(QWidget *widget) const; QWSWindowSurface* createSurface(const QString &key) const; + int transformation() const; + private: void sync(); void openTty(); @@ -89,6 +93,7 @@ private: int ttyfd, oldKdMode; QString ttyDevice; bool doGraphicsMode; + mutable const QScreen *parent; }; #endif diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 2c5ac21..4a3787f 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -46,7 +46,7 @@ #include <QWSDisplay> PvrEglWindowSurface::PvrEglWindowSurface - (QWidget *widget, QScreen *screen, int screenNum) + (QWidget *widget, PvrEglScreen *screen, int screenNum) : QWSGLWindowSurface(widget) { setSurfaceFlags(QWSWindowSurface::Opaque); @@ -63,6 +63,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrRect.y = pos.y(); pvrRect.width = size.width(); pvrRect.height = size.height(); + transformRects(&pvrRect, 1); // Try to recover a previous PvrQwsDrawable object for the widget // if there is one. This can happen when a PvrEglWindowSurface @@ -75,6 +76,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrQwsSetGeometry(drawable, &pvrRect); else drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } PvrEglWindowSurface::PvrEglWindowSurface() @@ -113,7 +115,9 @@ void PvrEglWindowSurface::setGeometry(const QRect &rect) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } QWSGLWindowSurface::setGeometry(rect); } @@ -127,7 +131,9 @@ bool PvrEglWindowSurface::move(const QPoint &offset) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } return QWSGLWindowSurface::move(offset); } @@ -200,7 +206,9 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetVisibleRegion(drawable, &pvrRect, 1); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); } else { @@ -213,9 +221,53 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRects[index].width = rect.width(); pvrRects[index].height = rect.height(); } + transformRects(pvrRects, rects.size()); pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size()); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); delete [] pvrRects; } } + +void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const +{ + switch (screen->transformation()) { + case 0: break; + + case 90: + { + for (int index = 0; index < count; ++index) { + int x = rects[index].y; + int y = screen->height() - (rects[index].x + rects[index].width); + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + + case 180: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].x + rects[index].width); + int y = screen->height() - (rects[index].y + rects[index].height); + rects[index].x = x; + rects[index].y = y; + } + } + break; + + case 270: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].y + rects[index].height); + int y = rects[index].x; + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + } +} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 58a5fb2..b0a161c 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -45,12 +45,12 @@ #include <private/qglwindowsurface_qws_p.h> #include "pvrqwsdrawable.h" -class QScreen; +class PvrEglScreen; class PvrEglWindowSurface : public QWSGLWindowSurface { public: - PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum); + PvrEglWindowSurface(QWidget *widget, PvrEglScreen *screen, int screenNum); PvrEglWindowSurface(); ~PvrEglWindowSurface(); @@ -76,8 +76,10 @@ public: private: QWidget *widget; PvrQwsDrawable *drawable; - QScreen *screen; + PvrEglScreen *screen; QPaintDevice *pdevice; + + void transformRects(PvrQwsRect *rects, int count) const; }; #endif diff --git a/src/qt3support/widgets/q3combobox.cpp b/src/qt3support/widgets/q3combobox.cpp index 9e7fd77..2aee4ac 100644 --- a/src/qt3support/widgets/q3combobox.cpp +++ b/src/qt3support/widgets/q3combobox.cpp @@ -2234,7 +2234,8 @@ bool Q3ComboBox::autoCompletion() const return d->useCompletion; } -/*!\reimp +/*! + \internal */ void Q3ComboBox::styleChange( QStyle& s ) { diff --git a/src/qt3support/widgets/q3toolbar.cpp b/src/qt3support/widgets/q3toolbar.cpp index dbe3afd..00ff47b 100644 --- a/src/qt3support/widgets/q3toolbar.cpp +++ b/src/qt3support/widgets/q3toolbar.cpp @@ -422,7 +422,7 @@ void Q3ToolBar::addSeparator() } /*! - \internal + \internal */ void Q3ToolBar::styleChange(QStyle &oldStyle) |