summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-08-19 09:24:04 (GMT)
committeraxis <qt-info@nokia.com>2009-08-19 09:24:04 (GMT)
commit2d1b49bd21b788ba3e35fc5c41bf3aab42cbda65 (patch)
tree24dae3a4532870d61282841f6bb186cb008ab747 /src
parentb3a3652abbf1cb4ebba6c6257ecf47f8dc022d93 (diff)
parent20d2b7312456435e5e1a98dba7c2cc96b44fe83c (diff)
downloadQt-2d1b49bd21b788ba3e35fc5c41bf3aab42cbda65.zip
Qt-2d1b49bd21b788ba3e35fc5c41bf3aab42cbda65.tar.gz
Qt-2d1b49bd21b788ba3e35fc5c41bf3aab42cbda65.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: tests/auto/auto.pro
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/qanimationgroup.cpp7
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/io/qurl.cpp4
-rw-r--r--src/corelib/xml/qxmlstream.cpp107
-rw-r--r--src/corelib/xml/qxmlstream.h10
-rw-r--r--src/dbus/qdbus_symbols.cpp10
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h1
-rw-r--r--src/gui/itemviews/qheaderview.cpp3
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp22
-rw-r--r--src/gui/itemviews/qlistview.cpp4
-rw-r--r--src/gui/kernel/qapplication_x11.cpp18
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm10
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm2
-rw-r--r--src/gui/kernel/qwidget_mac.mm71
-rw-r--r--src/gui/painting/qpaintdevice.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp50
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp16
-rw-r--r--src/gui/text/qtextcursor.cpp3
-rw-r--r--src/gui/widgets/qlineedit.cpp2
-rw-r--r--src/network/access/qnetworkcookie.cpp7
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp10
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp65
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp26
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp51
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h6
-rw-r--r--src/testlib/qtestcase.cpp9
-rw-r--r--src/testlib/qtestevent.h5
-rw-r--r--src/testlib/qtestkeyboard.h2
-rw-r--r--src/testlib/qtestmouse.h2
31 files changed, 416 insertions, 116 deletions
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index ab47b5a..78777f1 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -79,13 +79,6 @@
QAnimationGroup takes ownership of the animations it manages, and
ensures that they are deleted when the animation group is deleted.
- You can also use a \l{The State Machine Framework}{state machine}
- to create complex animations. The framework provides a special
- state, QAnimationState, that plays an animation upon entry and
- transitions to a new state when the animation has finished
- playing. This technique can also be combined with using animation
- groups.
-
\sa QAbstractAnimation, QVariantAnimation, {The Animation Framework}
*/
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 244161d..f38d7cc 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -302,7 +302,7 @@ namespace QT_NAMESPACE {}
# ifdef MAC_OS_X_VERSION_MIN_REQUIRED
# undef MAC_OS_X_VERSION_MIN_REQUIRED
# endif
-# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
+# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4
# include <AvailabilityMacros.h>
# if !defined(MAC_OS_X_VERSION_10_3)
# define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index acbac36..4aae53d 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -5699,6 +5699,10 @@ QString QUrl::fromAce(const QByteArray &domain)
Applications (IDNA) specification, which allows for domain names
(like \c "example.com") to be written using international
characters.
+
+ This function return an empty QByteArra if \a domain is not a valid
+ hostname. Note, in particular, that IPv6 literals are not valid domain
+ names.
*/
QByteArray QUrl::toAce(const QString &domain)
{
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 004e823..4eadc75 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -129,6 +129,21 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \enum QXmlStreamReader::ReadElementTextBehaviour
+
+ This enum specifies the different behaviours of readElementText().
+
+ \value ErrorOnUnexpectedElement Raise an UnexpectedElementError and return
+ what was read so far when a child element is encountered.
+
+ \value IncludeChildElements Recursively include the text from child elements.
+
+ \value SkipChildElements Skip child elements.
+
+ \since 4.6
+*/
+
+/*!
\enum QXmlStreamReader::Error
This enum specifies different error cases
@@ -621,6 +636,56 @@ QXmlStreamReader::TokenType QXmlStreamReader::tokenType() const
return d->type;
}
+/*!
+ Reads until the next start element within the current element. Returns true
+ when a start element was reached. When the end element was reached, or when
+ an error occurred, false is returned.
+
+ The current element is the element matching the most recently parsed start
+ element of which a matching end element has not yet been reached. When the
+ parser has reached the end element, the current element becomes the parent
+ element.
+
+ This is a convenience function for when you're only concerned with parsing
+ XML elements. The \l{QXmlStream Bookmarks Example} makes extensive use of
+ this function.
+
+ \since 4.6
+ \sa readNext()
+ */
+bool QXmlStreamReader::readNextStartElement()
+{
+ while (readNext() != Invalid) {
+ if (isEndElement())
+ return false;
+ else if (isStartElement())
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Reads until the end of the current element, skipping any child nodes.
+ This function is useful for skipping unknown elements.
+
+ The current element is the element matching the most recently parsed start
+ element of which a matching end element has not yet been reached. When the
+ parser has reached the end element, the current element becomes the parent
+ element.
+
+ \since 4.6
+ */
+void QXmlStreamReader::skipCurrentElement()
+{
+ int depth = 1;
+ while (depth && readNext() != Invalid) {
+ if (isEndElement())
+ --depth;
+ else if (isStartElement())
+ ++depth;
+ }
+}
+
/*
* Use the following Perl script to generate the error string index list:
===== PERL SCRIPT ====
@@ -2022,12 +2087,17 @@ void QXmlStreamReader::addExtraNamespaceDeclarations(const QXmlStreamNamespaceDe
The function concatenates text() when it reads either \l Characters
or EntityReference tokens, but skips ProcessingInstruction and \l
- Comment. In case anything else is read before reaching EndElement,
- the function returns what it read so far and raises an
- UnexpectedElementError. If the current token is not StartElement, an
- empty string is returned.
+ Comment. If the current token is not StartElement, an empty string is
+ returned.
+
+ The \a behaviour defines what happens in case anything else is
+ read before reaching EndElement. The function can include the text from
+ child elements (useful for example for HTML), ignore child elements, or
+ raise an UnexpectedElementError and return what was read so far.
+
+ \since 4.6
*/
-QString QXmlStreamReader::readElementText()
+QString QXmlStreamReader::readElementText(ReadElementTextBehaviour behaviour)
{
Q_D(QXmlStreamReader);
if (isStartElement()) {
@@ -2043,16 +2113,37 @@ QString QXmlStreamReader::readElementText()
case ProcessingInstruction:
case Comment:
break;
+ case StartElement:
+ if (behaviour == SkipChildElements) {
+ skipCurrentElement();
+ break;
+ } else if (behaviour == IncludeChildElements) {
+ result += readElementText(behaviour);
+ break;
+ }
+ // Fall through (for ErrorOnUnexpectedElement)
default:
- if (!d->error)
- d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data."));
- return result;
+ if (d->error || behaviour == ErrorOnUnexpectedElement) {
+ if (!d->error)
+ d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data."));
+ return result;
+ }
}
}
}
return QString();
}
+/*!
+ \overload readElementText()
+
+ Calling this function is equivalent to calling readElementText(ErrorOnUnexpectedElement).
+ */
+QString QXmlStreamReader::readElementText()
+{
+ return readElementText(ErrorOnUnexpectedElement);
+}
+
/*! Raises a custom error with an optional error \a message.
\sa error(), errorString()
diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h
index 89585bc..25c6efe 100644
--- a/src/corelib/xml/qxmlstream.h
+++ b/src/corelib/xml/qxmlstream.h
@@ -322,6 +322,9 @@ public:
bool atEnd() const;
TokenType readNext();
+ bool readNextStartElement();
+ void skipCurrentElement();
+
TokenType tokenType() const;
QString tokenString() const;
@@ -349,6 +352,13 @@ public:
qint64 characterOffset() const;
QXmlStreamAttributes attributes() const;
+
+ enum ReadElementTextBehaviour {
+ ErrorOnUnexpectedElement,
+ IncludeChildElements,
+ SkipChildElements
+ };
+ QString readElementText(ReadElementTextBehaviour behaviour);
QString readElementText();
QStringRef name() const;
diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp
index ca0147a..356b14c 100644
--- a/src/dbus/qdbus_symbols.cpp
+++ b/src/dbus/qdbus_symbols.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
+#include "qdbus_symbols_p.h"
#include <QtCore/qglobal.h>
#include <QtCore/qlibrary.h>
#include <QtCore/qmutex.h>
@@ -52,7 +53,7 @@ void *qdbus_resolve_me(const char *name);
static QLibrary *qdbus_libdbus = 0;
-void qdbus_unloadLibDBus()
+static void qdbus_unloadLibDBus()
{
delete qdbus_libdbus;
qdbus_libdbus = 0;
@@ -76,8 +77,11 @@ bool qdbus_loadLibDBus()
lib->setFileName(QLatin1String("dbus-1"));
for (uint i = 0; i < sizeof(majorversions) / sizeof(majorversions[0]); ++i) {
lib->setFileNameAndVersion(lib->fileName(), majorversions[i]);
- if (lib->load() && lib->resolve("dbus_connection_open_private"))
+ if (lib->load() && lib->resolve("dbus_connection_open_private")) {
+ struct Unloader { ~Unloader() { qdbus_unloadLibDBus(); } };
+ static Unloader unloader;
return true;
+ }
lib->unload();
}
@@ -107,8 +111,6 @@ void *qdbus_resolve_me(const char *name)
return ptr;
}
-Q_DESTRUCTOR_FUNCTION(qdbus_unloadLibDBus)
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index d34787d..176d719 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -517,6 +517,7 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
+ Q_INTERFACES(QGraphicsItem)
public:
QGraphicsObject(QGraphicsItem *parent = 0);
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 5d3bb12..60c31ad 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1195,7 +1195,8 @@ QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const
{
Q_D(const QHeaderView);
int visual = visualIndex(logicalIndex);
- Q_ASSERT(visual != -1);
+ if (visual == -1)
+ return Fixed; //the default value
return d->headerSectionResizeMode(visual);
}
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 98810a0..8414460 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -573,6 +573,7 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
int start, int end)
{
Q_Q(QItemSelectionModel);
+ finalize();
// update current index
if (currentIndex.isValid() && parent == currentIndex.parent()
@@ -591,8 +592,8 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
}
QItemSelection deselected;
- QItemSelection::iterator it = currentSelection.begin();
- while (it != currentSelection.end()) {
+ QItemSelection::iterator it = ranges.begin();
+ while (it != ranges.end()) {
if (it->topLeft().parent() != parent) { // Check parents until reaching root or contained in range
QModelIndex itParent = it->topLeft().parent();
while (itParent.isValid() && itParent.parent() != parent)
@@ -600,24 +601,22 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
if (parent.isValid() && start <= itParent.row() && itParent.row() <= end) {
deselected.append(*it);
- it = currentSelection.erase(it);
+ it = ranges.erase(it);
} else {
++it;
}
} else if (start <= it->bottom() && it->bottom() <= end // Full inclusion
&& start <= it->top() && it->top() <= end) {
deselected.append(*it);
- it = currentSelection.erase(it);
+ it = ranges.erase(it);
} else if (start <= it->top() && it->top() <= end) { // Top intersection
deselected.append(QItemSelectionRange(it->topLeft(), model->index(end, it->left(), it->parent())));
- it = currentSelection.insert(it, QItemSelectionRange(model->index(end + 1, it->left(), it->parent()),
- it->bottomRight()));
- it = currentSelection.erase(++it);
+ *it = QItemSelectionRange(model->index(end + 1, it->left(), it->parent()), it->bottomRight());
+ ++it;
} else if (start <= it->bottom() && it->bottom() <= end) { // Bottom intersection
deselected.append(QItemSelectionRange(model->index(start, it->right(), it->parent()), it->bottomRight()));
- it = currentSelection.insert(it, QItemSelectionRange(it->topLeft(),
- model->index(start - 1, it->right(), it->parent())));
- it = currentSelection.erase(++it);
+ *it = QItemSelectionRange(it->topLeft(), model->index(start - 1, it->right(), it->parent()));
+ ++it;
} else {
if (it->top() < start && end < it->bottom()) // Middle intersection (do nothing)
deselected.append(QItemSelectionRange(model->index(start, it->right(), it->parent()),
@@ -626,7 +625,8 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
}
}
- emit q->selectionChanged(QItemSelection(), deselected);
+ if (!deselected.isEmpty())
+ emit q->selectionChanged(QItemSelection(), deselected);
}
/*!
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index ea38f5f..e9e365f 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -458,6 +458,8 @@ QSize QListView::gridSize() const
void QListView::setViewMode(ViewMode mode)
{
Q_D(QListView);
+ if (d->viewMode == mode)
+ return;
d->viewMode = mode;
if (mode == ListMode) {
@@ -1963,7 +1965,7 @@ QListViewPrivate::QListViewPrivate()
movement(QListView::Static),
resizeMode(QListView::Fixed),
layoutMode(QListView::SinglePass),
- viewMode(QListView::ListMode),
+ viewMode(QListView::IconMode), //this will ensure the first initialization to ListView
modeProperties(0),
column(0),
uniformItemSizes(false),
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index db349f0..d942519 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -1851,10 +1851,20 @@ void qt_init(QApplicationPrivate *priv, int,
QX11InfoData *screen = X11->screens + s;
screen->ref = 1; // ensures it doesn't get deleted
screen->screen = s;
- screen->dpiX = (DisplayWidth(X11->display, s) * 254 + DisplayWidthMM(X11->display, s)*5)
- / (DisplayWidthMM(X11->display, s)*10);
- screen->dpiY = (DisplayHeight(X11->display, s) * 254 + DisplayHeightMM(X11->display, s)*5)
- / (DisplayHeightMM(X11->display, s)*10);
+
+ int widthMM = DisplayWidthMM(X11->display, s);
+ if (widthMM != 0) {
+ screen->dpiX = (DisplayWidth(X11->display, s) * 254 + widthMM * 5) / (widthMM * 10);
+ } else {
+ screen->dpiX = 72;
+ }
+
+ int heightMM = DisplayHeightMM(X11->display, s);
+ if (heightMM != 0) {
+ screen->dpiY = (DisplayHeight(X11->display, s) * 254 + heightMM * 5) / (heightMM * 10);
+ } else {
+ screen->dpiY = 72;
+ }
X11->argbVisuals[s] = 0;
X11->argbColormaps[s] = 0;
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 45b0ada..7ac0d89 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -872,7 +872,7 @@ extern "C" {
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.percentage = [event magnification];
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)rotateWithEvent:(NSEvent *)event;
@@ -885,7 +885,7 @@ extern "C" {
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.percentage = [event rotation];
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)swipeWithEvent:(NSEvent *)event;
@@ -898,7 +898,7 @@ extern "C" {
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.direction = QSize(-[event deltaX], -[event deltaY]);
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)beginGestureWithEvent:(NSEvent *)event;
@@ -910,7 +910,7 @@ extern "C" {
qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)endGestureWithEvent:(NSEvent *)event;
@@ -922,7 +922,7 @@ extern "C" {
qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index efe6375..113362a 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -500,7 +500,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
static inline void qt_mac_waitForMoreEvents()
{
#ifndef QT_MAC_USE_COCOA
- while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, true) == kCFRunLoopRunTimedOut);
+ while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, true) == kCFRunLoopRunTimedOut) ;
#else
// If no event exist in the cocoa event que, wait
// (and free up cpu time) until at least one event occur.
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index fbb05c4..3dd2e65 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -107,6 +107,7 @@
#include <private/qcocoapanel_mac_p.h>
#include "qwidget_p.h"
+#include "qevent_p.h"
#include "qdnd_p.h"
#include <QtGui/qgraphicsproxywidget.h>
@@ -729,6 +730,13 @@ static EventTypeSpec window_events[] = {
{ kEventClassWindow, kEventWindowGetRegion },
{ kEventClassWindow, kEventWindowGetClickModality },
{ kEventClassWindow, kEventWindowTransitionCompleted },
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ { kEventClassGesture, kEventGestureStarted },
+ { kEventClassGesture, kEventGestureEnded },
+ { kEventClassGesture, kEventGestureMagnify },
+ { kEventClassGesture, kEventGestureSwipe },
+ { kEventClassGesture, kEventGestureRotate },
+#endif
{ kEventClassMouse, kEventMouseDown }
};
static EventHandlerUPP mac_win_eventUPP = 0;
@@ -1013,6 +1021,69 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
return SendEventToApplication(event);
handled_event = false;
break; }
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ case kEventClassGesture: {
+ // First, find the widget that was under
+ // the mouse when the gesture happened:
+ HIPoint screenLocation;
+ if (GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, 0,
+ sizeof(screenLocation), 0, &screenLocation) != noErr) {
+ handled_event = false;
+ break;
+ }
+ QWidget *widget = QApplication::widgetAt(screenLocation.x, screenLocation.y);
+ if (!widget) {
+ handled_event = false;
+ break;
+ }
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.position = QPoint(screenLocation.x, screenLocation.y);
+
+ switch (ekind) {
+ case kEventGestureStarted:
+ qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
+ break;
+ case kEventGestureEnded:
+ qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
+ break;
+ case kEventGestureRotate: {
+ CGFloat amount;
+ if (GetEventParameter(event, kEventParamRotationAmount, typeCGFloat, 0,
+ sizeof(amount), 0, &amount) != noErr) {
+ handled_event = false;
+ break;
+ }
+ qNGEvent.gestureType = QNativeGestureEvent::Zoom;
+ qNGEvent.percentage = float(amount);
+ break; }
+ case kEventGestureSwipe: {
+ HIPoint swipeDirection;
+ if (GetEventParameter(event, kEventParamSwipeDirection, typeHIPoint, 0,
+ sizeof(swipeDirection), 0, &swipeDirection) != noErr) {
+ handled_event = false;
+ break;
+ }
+ qNGEvent.gestureType = QNativeGestureEvent::Swipe;
+ qNGEvent.direction = QSize(-swipeDirection.x, -swipeDirection.y);
+ break; }
+ case kEventGestureMagnify: {
+ CGFloat amount;
+ if (GetEventParameter(event, kEventParamMagnificationAmount, typeCGFloat, 0,
+ sizeof(amount), 0, &amount) != noErr) {
+ handled_event = false;
+ break;
+ }
+ qNGEvent.gestureType = QNativeGestureEvent::Zoom;
+ qNGEvent.percentage = float(amount);
+ break; }
+ }
+
+ QApplication::sendSpontaneousEvent(widget, &qNGEvent);
+ break; }
+#endif // gestures
+
default:
handled_event = false;
}
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 6477952..6a2a4c4 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -64,3 +64,5 @@ int QPaintDevice::metric(PaintDeviceMetric) const
qWarning("QPaintDevice::metrics: Device has no metric information");
return 0;
}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index ef4904f..8679e15 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2541,12 +2541,44 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state();
const bool aa = s->flags.antialiased || s->flags.bilinear;
- if (!aa && sr.size() == QSize(1, 1)) {
+ int sr_l = qFloor(sr.left());
+ int sr_r = qCeil(sr.right()) - 1;
+ int sr_t = qFloor(sr.top());
+ int sr_b = qCeil(sr.bottom()) - 1;
+
+ if (!aa && sr_l == sr_r && sr_t == sr_b) {
// as fillRect will apply the aliased coordinate delta we need to
// subtract it here as we don't use it for image drawing
QTransform old = s->matrix;
s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta);
- fillRect(r, QColor::fromRgba(img.pixel(sr.x(), sr.y())));
+
+ // Do whatever fillRect() does, but without premultiplying the color if it's already premultiplied.
+ QRgb color = img.pixel(sr_l, sr_t);
+ switch (img.format()) {
+ case QImage::Format_ARGB32_Premultiplied:
+ case QImage::Format_ARGB8565_Premultiplied:
+ case QImage::Format_ARGB6666_Premultiplied:
+ case QImage::Format_ARGB8555_Premultiplied:
+ case QImage::Format_ARGB4444_Premultiplied:
+ // Combine premultiplied color with the opacity set on the painter.
+ d->solid_color_filler.solid.color =
+ ((((color & 0x00ff00ff) * s->intOpacity) >> 8) & 0x00ff00ff)
+ | ((((color & 0xff00ff00) >> 8) * s->intOpacity) & 0xff00ff00);
+ break;
+ default:
+ d->solid_color_filler.solid.color = PREMUL(ARGB_COMBINE_ALPHA(color, s->intOpacity));
+ break;
+ }
+
+ if ((d->solid_color_filler.solid.color & 0xff000000) == 0
+ && s->composition_mode == QPainter::CompositionMode_SourceOver) {
+ return;
+ }
+
+ d->solid_color_filler.clip = d->clip();
+ d->solid_color_filler.adjustSpanMethods();
+ fillRect(r, &d->solid_color_filler);
+
s->matrix = old;
return;
}
@@ -5218,6 +5250,13 @@ static void drawLine_midpoint_i(int x1, int y1, int x2, int y2, ProcessSpans spa
dy = -dy;
}
+ int x_lower_limit = - 128;
+ if (x1 < x_lower_limit) {
+ int cy = dy * (x_lower_limit - x1) / dx + y1;
+ drawLine_midpoint_i(x_lower_limit, cy, x2, y2, span_func, data, style, devRect);
+ return;
+ }
+
if (style == LineDrawNormal)
--x2;
@@ -5355,6 +5394,13 @@ static void drawLine_midpoint_i(int x1, int y1, int x2, int y2, ProcessSpans spa
dx = -dx;
}
+ int y_lower_limit = - 128;
+ if (y1 < y_lower_limit) {
+ int cx = dx * (y_lower_limit - y1) / dy + x1;
+ drawLine_midpoint_i(cx, y_lower_limit, x2, y2, span_func, data, style, devRect);
+ return;
+ }
+
if (style == LineDrawNormal)
--y2;
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 115f599..b8781b1 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -2459,15 +2459,23 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti)
XRectangle rects[rectcount];
int num_rects = 0;
+ QPoint delta(qRound(d->matrix.dx()), qRound(d->matrix.dy()));
+ QRect clip(d->polygonClipper.boundingRect());
for (int i=0; i < path.elementCount(); i+=5) {
int x = qRound(path.elementAt(i).x);
int y = qRound(path.elementAt(i).y);
int w = qRound(path.elementAt(i+1).x) - x;
int h = qRound(path.elementAt(i+2).y) - y;
- rects[num_rects].x = x + qRound(d->matrix.dx());
- rects[num_rects].y = y + qRound(d->matrix.dy());
- rects[num_rects].width = w;
- rects[num_rects].height = h;
+
+ QRect rect = QRect(x + delta.x(), y + delta.y(), w, h);
+ rect = rect.intersected(clip);
+ if (rect.isEmpty())
+ continue;
+
+ rects[num_rects].x = short(rect.x());
+ rects[num_rects].y = short(rect.y());
+ rects[num_rects].width = ushort(rect.width());
+ rects[num_rects].height = ushort(rect.height());
++num_rects;
if (num_rects == rectcount) {
XFillRectangles(d->dpy, d->hd, d->gc, rects, num_rects);
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 88ab9d0..5a938e3 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -84,7 +84,8 @@ QTextCursorPrivate::QTextCursorPrivate(const QTextCursorPrivate &rhs)
QTextCursorPrivate::~QTextCursorPrivate()
{
- priv->removeCursor(this);
+ if (priv)
+ priv->removeCursor(this);
}
QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int positionOfChange, int charsAddedOrRemoved, QTextUndoCommand::Operation op)
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 9e15e80..6b73e21 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1394,6 +1394,7 @@ bool QLineEdit::event(QEvent * e)
if (QApplication::keypadNavigationEnabled()) {
if (e->type() == QEvent::EnterEditFocus) {
end(false);
+ d->setCursorVisible(true);
int cft = QApplication::cursorFlashTime();
d->control->setCursorBlinkPeriod(cft/2);
} else if (e->type() == QEvent::LeaveEditFocus) {
@@ -1402,7 +1403,6 @@ bool QLineEdit::event(QEvent * e)
if (d->control->hasAcceptableInput() || d->control->fixup())
emit editingFinished();
}
- return true;
}
#endif
return QWidget::event(e);
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 0c13286..6884bee 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -504,7 +504,12 @@ QByteArray QNetworkCookie::toRawForm(RawForm form) const
}
if (!d->domain.isEmpty()) {
result += "; domain=";
- result += QUrl::toAce(d->domain);
+ QString domainNoDot = d->domain;
+ if (domainNoDot.startsWith(QLatin1Char('.'))) {
+ result += '.';
+ domainNoDot = domainNoDot.mid(1);
+ }
+ result += QUrl::toAce(domainNoDot);
}
if (!d->path.isEmpty()) {
result += "; path=";
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index d2fadcb..3979a8c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -47,7 +47,7 @@
QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr)
: QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
- lock(DFBSurfaceLockFlags(0)), mem(0), engine(0)
+ bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0)
{}
QDirectFBPaintDevice::~QDirectFBPaintDevice()
@@ -65,15 +65,15 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const
void QDirectFBPaintDevice::lockDirectFB(DFBSurfaceLockFlags flags)
{
- if (!(lock & flags)) {
- if (lock)
+ if (!(lockFlgs & flags)) {
+ if (lockFlgs)
unlockDirectFB();
mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl);
Q_ASSERT(mem);
const QSize s = size();
lockedImage = new QImage(mem, s.width(), s.height(), bpl,
QDirectFBScreen::getImageFormat(dfbSurface));
- lock = flags;
+ lockFlgs = flags;
}
}
@@ -87,7 +87,7 @@ void QDirectFBPaintDevice::unlockDirectFB()
delete lockedImage;
lockedImage = 0;
mem = 0;
- lock = DFBSurfaceLockFlags(0);
+ lockFlgs = DFBSurfaceLockFlags(0);
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index 3932403..688fd7b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -68,7 +68,7 @@ public:
int bytesPerLine() const;
QSize size() const;
int metric(QPaintDevice::PaintDeviceMetric metric) const;
- DFBSurfaceLockFlags lockFlags() const { return lock; }
+ DFBSurfaceLockFlags lockFlags() const { return lockFlgs; }
QPaintEngine *paintEngine() const;
protected:
@@ -86,7 +86,7 @@ protected:
QImage *lockedImage;
QDirectFBScreen *screen;
int bpl;
- DFBSurfaceLockFlags lock;
+ DFBSurfaceLockFlags lockFlgs;
uchar *mem;
QDirectFBPaintEngine *engine;
private:
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 131ff4b..ba715c3 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -119,13 +119,14 @@ private:
IDirectFB *fb;
quint8 opacity;
- bool dirtyClip;
ClipType clipType;
QDirectFBPaintDevice *dfbDevice;
uint compositionModeStatus;
- QDirectFBPaintEngine *q;
+ bool inClip;
QRect currentClip;
+
+ QDirectFBPaintEngine *q;
friend class QDirectFBPaintEngine;
};
@@ -236,7 +237,7 @@ static inline void drawRects(const T *rects, int n, const QTransform &transform,
d->surface->SetClip(d->surface, &clipRegion); \
operation; \
} \
- d->dirtyClip = true; \
+ d->updateClip(); \
break; } \
case QDirectFBPaintEnginePrivate::ComplexClip: \
case QDirectFBPaintEnginePrivate::ClipUnset: \
@@ -297,8 +298,8 @@ bool QDirectFBPaintEngine::end()
void QDirectFBPaintEngine::clipEnabledChanged()
{
Q_D(QDirectFBPaintEngine);
- d->dirtyClip = true;
QRasterPaintEngine::clipEnabledChanged();
+ d->updateClip();
}
void QDirectFBPaintEngine::penChanged()
@@ -341,26 +342,49 @@ void QDirectFBPaintEngine::setState(QPainterState *state)
{
Q_D(QDirectFBPaintEngine);
QRasterPaintEngine::setState(state);
- d->dirtyClip = true;
d->setPen(state->pen);
d->opacity = quint8(state->opacity * 255);
d->setCompositionMode(state->compositionMode());
d->setTransform(state->transform());
d->setRenderHints(state->renderHints);
+ if (d->surface)
+ d->updateClip();
}
void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
{
Q_D(QDirectFBPaintEngine);
- d->dirtyClip = true;
+ const bool wasInClip = d->inClip;
+ d->inClip = true;
QRasterPaintEngine::clip(path, op);
+ if (!wasInClip) {
+ d->inClip = false;
+ d->updateClip();
+ }
+}
+
+void QDirectFBPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
+{
+ Q_D(QDirectFBPaintEngine);
+ const bool wasInClip = d->inClip;
+ d->inClip = true;
+ QRasterPaintEngine::clip(region, op);
+ if (!wasInClip) {
+ d->inClip = false;
+ d->updateClip();
+ }
}
void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
{
Q_D(QDirectFBPaintEngine);
- d->dirtyClip = true;
+ const bool wasInClip = d->inClip;
+ d->inClip = true;
QRasterPaintEngine::clip(rect, op);
+ if (!wasInClip) {
+ d->inClip = false;
+ d->updateClip();
+ }
}
void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
@@ -371,7 +395,6 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
if (brush == Qt::NoBrush && pen == Qt::NoPen)
return;
- d->updateClip();
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
|| !d->simplePen
@@ -401,7 +424,6 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
if (brush == Qt::NoBrush && pen == Qt::NoPen)
return;
- d->updateClip();
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
|| !d->simplePen
@@ -426,7 +448,6 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
{
Q_D(QDirectFBPaintEngine);
- d->updateClip();
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
|| !d->simplePen
@@ -448,7 +469,6 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
{
Q_D(QDirectFBPaintEngine);
- d->updateClip();
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
|| !d->simplePen
@@ -491,7 +511,6 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
than the max image cache size we fall back to raster engine.
*/
- d->updateClip();
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
@@ -534,7 +553,6 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
{
Q_D(QDirectFBPaintEngine);
- d->updateClip();
if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
d->lock();
@@ -569,7 +587,6 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
const QPointF &offset)
{
Q_D(QDirectFBPaintEngine);
- d->updateClip();
if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
d->lock();
@@ -586,7 +603,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
QRasterPaintEngine::drawTiledPixmap(r, pix, offset);
} else {
d->unlock();
- d->drawTiledPixmap(r, pixmap, offset);
+ CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset));
}
}
@@ -674,7 +691,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
Q_D(QDirectFBPaintEngine);
if (brush.style() == Qt::NoBrush)
return;
- d->updateClip();
if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) {
switch (brush.style()) {
case Qt::SolidPattern: {
@@ -718,7 +734,6 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
if (!color.isValid())
return;
Q_D(QDirectFBPaintEngine);
- d->updateClip();
if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
|| (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
|| d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) {
@@ -729,8 +744,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
- d->surface->FillRectangle(d->surface, r.x(), r.y(),
- r.width(), r.height());
+ CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
}
}
@@ -765,9 +779,9 @@ void QDirectFBPaintEngine::initImageCache(int size)
QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p)
: surface(0), antialiased(false), simplePen(false),
- transformationType(0), opacity(255), dirtyClip(true),
+ transformationType(0), opacity(255),
clipType(ClipUnset), dfbDevice(0),
- compositionModeStatus(0), q(p)
+ compositionModeStatus(0), inClip(false), q(p)
{
fb = QDirectFBScreen::instance()->dfb();
surfaceCache = new SurfaceCache;
@@ -978,7 +992,6 @@ static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset)
void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off)
{
- Q_ASSERT(!dirtyClip);
Q_ASSERT(!(transformationType & Matrix_BlitsUnsupported));
const QTransform &transform = q->state()->matrix;
const QRect destinationRect = transform.mapRect(dest).toRect().normalized();
@@ -1071,9 +1084,7 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
void QDirectFBPaintEnginePrivate::updateClip()
{
- if (!dirtyClip)
- return;
-
+ Q_ASSERT(surface);
currentClip = QRect();
const QClipData *clipData = clip();
if (!clipData || !clipData->enabled) {
@@ -1095,14 +1106,12 @@ void QDirectFBPaintEnginePrivate::updateClip()
} else {
clipType = ComplexClip;
}
-
- dirtyClip = false;
}
void QDirectFBPaintEnginePrivate::systemStateChanged()
{
- dirtyClip = true;
QRasterPaintEnginePrivate::systemStateChanged();
+ updateClip();
}
IDirectFBSurface *SurfaceCache::getSurface(const uint *buf, int size)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
index b939b68..80108b2 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
@@ -101,6 +101,7 @@ public:
virtual void setState(QPainterState *state);
virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
+ virtual void clip(const QRegion &region, Qt::ClipOperation op);
virtual void clip(const QRect &rect, Qt::ClipOperation op);
static void initImageCache(int size);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 774162c..dc53847 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -56,13 +56,18 @@
class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem
{
+ Q_OBJECT
public:
QDirectFBScreenPrivate(QDirectFBScreen *qptr);
~QDirectFBScreenPrivate();
void setFlipFlags(const QStringList &args);
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
-
+public slots:
+#ifdef QT_DIRECTFB_WM
+ void onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event);
+#endif
+public:
IDirectFB *dfb;
DFBSurfaceFlipFlags flipFlags;
QDirectFBScreen::DirectFBFlags directFBFlags;
@@ -86,6 +91,8 @@ public:
QDirectFBScreen *q;
};
+#include "qdirectfbscreen.moc"
+
QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
: QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE),
directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid),
@@ -107,6 +114,10 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
#ifndef QT_NO_QWS_SIGNALHANDLER
QWSSignalHandler::instance()->addObject(this);
#endif
+#ifdef QT_DIRECTFB_WM
+ connect(QWSServer::instance(), SIGNAL(windowEvent(QWSWindow*, QWSServer::WindowEvent)),
+ this, SLOT(onWindowEvent(QWSWindow*, QWSServer::WindowEvent)));
+#endif
}
QDirectFBScreenPrivate::~QDirectFBScreenPrivate()
@@ -578,6 +589,7 @@ QDirectFBScreenCursor::QDirectFBScreenCursor()
void QDirectFBScreenCursor::move(int x, int y)
{
+ pos = QPoint(x, y);
layer->WarpCursor(layer, x, y);
}
@@ -746,6 +758,18 @@ void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args)
}
}
+#ifdef QT_DIRECTFB_WM
+void QDirectFBScreenPrivate::onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event)
+{
+ if (event == QWSServer::Raise) {
+ QWSWindowSurface *windowSurface = window->windowSurface();
+ if (windowSurface && windowSurface->key() == QLatin1String("directfb")) {
+ static_cast<QDirectFBWindowSurface*>(windowSurface)->raise();
+ }
+ }
+}
+#endif
+
QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType type) const
{
if (type == QPixmapData::BitmapType)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 584f334..441bac9 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -54,6 +54,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
: QDirectFBPaintDevice(scr)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
+ , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -72,6 +73,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
: QWSWindowSurface(widget), QDirectFBPaintDevice(scr)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
+ , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -98,6 +100,17 @@ QDirectFBWindowSurface::~QDirectFBWindowSurface()
{
}
+#ifdef QT_DIRECTFB_WM
+void QDirectFBWindowSurface::raise()
+{
+ if (dfbWindow) {
+ dfbWindow->RaiseToTop(dfbWindow);
+ } else if (sibling && (!sibling->sibling || sibling->dfbWindow)) {
+ sibling->raise();
+ }
+}
+#endif
+
bool QDirectFBWindowSurface::isValid() const
{
return true;
@@ -126,6 +139,7 @@ void QDirectFBWindowSurface::createWindow()
description.surface_caps = DSCAPS_PREMULTIPLIED;
DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow);
+
if (result != DFB_OK)
DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result);
@@ -231,34 +245,25 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
QByteArray QDirectFBWindowSurface::permanentState() const
{
- QByteArray array;
-#ifdef QT_NO_DIRECTFB_WM
- array.resize(sizeof(SurfaceFlags) + sizeof(IDirectFBSurface*));
-#else
- array.resize(sizeof(SurfaceFlags));
-#endif
- char *ptr = array.data();
-
- *reinterpret_cast<SurfaceFlags*>(ptr) = surfaceFlags();
- ptr += sizeof(SurfaceFlags);
-
-#ifdef QT_NO_DIRECTFB_WM
- *reinterpret_cast<IDirectFBSurface**>(ptr) = dfbSurface;
+ QByteArray state;
+#ifdef QT_DIRECTFB_WM
+ QDataStream ds(&state, QIODevice::WriteOnly);
+ ds << reinterpret_cast<quintptr>(this);
#endif
- return array;
+ return state;
}
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
- SurfaceFlags flags;
- const char *ptr = state.constData();
-
- flags = *reinterpret_cast<const SurfaceFlags*>(ptr);
- setSurfaceFlags(flags);
-
-#ifdef QT_NO_DIRECTFB_WM
- ptr += sizeof(SurfaceFlags);
- dfbSurface = *reinterpret_cast<IDirectFBSurface* const*>(ptr);
+#ifdef QT_DIRECTFB_WM
+ if (state.size() == sizeof(quintptr)) {
+ QDataStream ds(state);
+ quintptr ptr;
+ ds >> ptr;
+ sibling = reinterpret_cast<QDirectFBWindowSurface*>(ptr);
+ }
+#else
+ Q_UNUSED(state);
#endif
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index 64b1920..2c4bcdf 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -65,6 +65,9 @@ public:
QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen *scr, QWidget *widget);
~QDirectFBWindowSurface();
+#ifdef QT_DIRECTFB_WM
+ void raise();
+#endif
bool isValid() const;
void setGeometry(const QRect &rect);
@@ -87,9 +90,10 @@ public:
QImage *buffer(const QWidget *widget);
private:
-#ifndef QT_NO_DIRECTFB_WM
+#ifdef QT_DIRECTFB_WM
void createWindow();
IDirectFBWindow *dfbWindow;
+ QDirectFBWindowSurface *sibling;
#endif
#ifdef QT_NO_DIRECTFB_WM
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index a7aa81b..9a09c19 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -813,12 +813,12 @@ namespace QTest
{
static QObject *currentTestObject = 0;
- struct TestFunction {
+ static struct TestFunction {
TestFunction():function(0), data(0) {}
~TestFunction() { delete [] data; }
int function;
char *data;
- } testFuncs[512];
+ } *testFuncs;
/**
* Contains the count of test functions that was supplied
@@ -1125,6 +1125,11 @@ static void qParseArgs(int argc, char *argv[])
exit(1);
}
++QTest::lastTestFuncIdx;
+ if (!QTest::testFuncs) {
+ struct Cleanup { ~Cleanup() { delete[] QTest::testFuncs; } };
+ static Cleanup cleanup;
+ QTest::testFuncs = new TestFunction[512];
+ }
QTest::testFuncs[QTest::lastTestFuncIdx].function = idx;
QTest::testFuncs[QTest::lastTestFuncIdx].data = data;
QTEST_ASSERT(QTest::lastTestFuncIdx < 512);
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h
index a8376ee..dfbba33 100644
--- a/src/testlib/qtestevent.h
+++ b/src/testlib/qtestevent.h
@@ -71,6 +71,7 @@ public:
virtual ~QTestEvent() {}
};
+#ifdef QT_GUI_LIB
class QTestKeyEvent: public QTestEvent
{
public:
@@ -135,6 +136,8 @@ private:
QPoint _pos;
int _delay;
};
+#endif //QT_GUI_LIB
+
class QTestDelayEvent: public QTestEvent
{
@@ -159,6 +162,7 @@ public:
inline void clear()
{ qDeleteAll(*this); QList<QTestEvent *>::clear(); }
+#ifdef QT_GUI_LIB
inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
{ addKeyEvent(QTest::Click, qtKey, modifiers, msecs); }
inline void addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
@@ -194,6 +198,7 @@ public:
{ append(new QTestMouseEvent(QTest::MouseDClick, button, stateKey, pos, delay)); }
inline void addMouseMove(QPoint pos = QPoint(), int delay=-1)
{ append(new QTestMouseEvent(QTest::MouseMove, Qt::NoButton, 0, pos, delay)); }
+#endif //QT_GUI_LIB
inline void addDelay(int msecs)
{ append(new QTestDelayEvent(msecs)); }
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index 2e475b2..af81075 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#ifndef QTESTKEYBOARD_H
+#if !defined(QTESTKEYBOARD_H) && defined(QT_GUI_LIB)
#define QTESTKEYBOARD_H
#if 0
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 2825c58..7ea927c 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#ifndef QTESTMOUSE_H
+#if !defined(QTESTMOUSE_H) && defined(QT_GUI_LIB)
#define QTESTMOUSE_H
#if 0