summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-06-18 15:38:40 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-06-18 15:38:40 (GMT)
commitfc0e74d5661da0a678a60082dae60d4564da94b0 (patch)
tree512256a8bfc49ed4a17a821b8e683662b65e6ddc /src/gui
parente5302035d91f4337db25cf805c6b13339c552cbf (diff)
parentb82466a64e305af8c557b2b7fdbb4a386e3d9cd7 (diff)
downloadQt-fc0e74d5661da0a678a60082dae60d4564da94b0.zip
Qt-fc0e74d5661da0a678a60082dae60d4564da94b0.tar.gz
Qt-fc0e74d5661da0a678a60082dae60d4564da94b0.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsgridlayout.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp3
-rw-r--r--src/gui/graphicsview/qgridlayoutengine_p.h4
-rw-r--r--src/gui/kernel/qapplication_s60.cpp25
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp4
-rw-r--r--src/gui/kernel/qt_s60_p.h26
-rw-r--r--src/gui/painting/qoutlinemapper.cpp12
-rw-r--r--src/gui/painting/qoutlinemapper_p.h4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp11
-rw-r--r--src/gui/painting/qpaintengineex.cpp4
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp20
-rw-r--r--src/gui/text/qfontengine_mac.mm3
-rw-r--r--src/gui/text/qfontengine_s60.cpp2
16 files changed, 101 insertions, 36 deletions
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index 6ca799d..83db3ec 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -572,6 +572,18 @@ void QGraphicsGridLayout::removeAt(int index)
if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem())
layoutItem->setParentLayoutItem(0);
d->engine.removeItem(gridItem);
+
+ // recalculate rowInfo.count if we remove an item that is on the right/bottommost row
+ for (int j = 0; j < NOrientations; ++j) {
+ // 0: Hor, 1: Ver
+ const Qt::Orientation orient = (j == 0 ? Qt::Horizontal : Qt::Vertical);
+ const int oldCount = d->engine.rowCount(orient);
+ if (gridItem->lastRow(orient) == oldCount - 1) {
+ const int newCount = d->engine.effectiveLastRow(orient) + 1;
+ d->engine.removeRows(newCount, oldCount - newCount, orient);
+ }
+ }
+
delete gridItem;
invalidate();
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 51acf9b..2de3638 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3277,7 +3277,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
*/
void QGraphicsItem::clearFocus()
{
- d_ptr->clearFocusHelper(/* giveFocusToParent = */ true);
+ if (hasFocus())
+ d_ptr->clearFocusHelper(/* giveFocusToParent = */ true);
}
/*!
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 9722683..b828722 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -147,7 +147,7 @@ void QGraphicsLinearLayoutPrivate::removeGridItem(QGridLayoutItem *gridItem)
{
int index = gridItem->firstRow(orientation);
engine.removeItem(gridItem);
- engine.removeRow(index, orientation);
+ engine.removeRows(index, 1, orientation);
}
void QGraphicsLinearLayoutPrivate::fixIndex(int *index) const
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 6c5623e..ca3b56f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -6277,7 +6277,8 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
{
Q_ASSERT(original);
QGraphicsItem *originalItem = gestureTargets.value(original);
- Q_ASSERT(originalItem);
+ if (originalItem == 0) // we only act on accepted gestures, which implies it has a target.
+ return;
// iterate over all active gestures and for each find the owner
// if the owner is part of our sub-hierarchy, cancel it.
diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h
index cbf704e..9ac9a8e 100644
--- a/src/gui/graphicsview/qgridlayoutengine_p.h
+++ b/src/gui/graphicsview/qgridlayoutengine_p.h
@@ -363,8 +363,8 @@ public:
QGridLayoutItem *itemAt(int row, int column, Qt::Orientation orientation = Qt::Vertical) const;
inline void insertRow(int row, Qt::Orientation orientation = Qt::Vertical)
{ insertOrRemoveRows(row, +1, orientation); }
- inline void removeRow(int row, Qt::Orientation orientation = Qt::Vertical)
- { insertOrRemoveRows(row, -1, orientation); }
+ inline void removeRows(int row, int count, Qt::Orientation orientation)
+ { insertOrRemoveRows(row, -count, orientation); }
void invalidate();
void setGeometries(const QLayoutStyleInfo &styleInfo, const QRectF &contentsGeometry);
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index a50fd95..d5d4be6 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -2196,4 +2196,29 @@ void QApplication::restoreOverrideCursor()
#endif // QT_NO_CURSOR
+QS60ThreadLocalData::QS60ThreadLocalData()
+{
+ CCoeEnv *env = CCoeEnv::Static();
+ if (env) {
+ //if this is the UI thread, share objects owned by CONE
+ usingCONEinstances = true;
+ wsSession = env->WsSession();
+ screenDevice = env->ScreenDevice();
+ }
+ else {
+ usingCONEinstances = false;
+ qt_symbian_throwIfError(wsSession.Connect(qt_s60GetRFs()));
+ screenDevice = new CWsScreenDevice(wsSession);
+ screenDevice->Construct();
+ }
+}
+
+QS60ThreadLocalData::~QS60ThreadLocalData()
+{
+ if (!usingCONEinstances) {
+ delete screenDevice;
+ wsSession.Close();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 3bdc971..9fcc718 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -1518,7 +1518,7 @@ bool qt_xfixes_selection_changed(Window selectionOwner, Time timestamp)
(unsigned int)(d ? d->timestamp : 0), (unsigned int)timestamp);
#endif
if (!owner || (selectionOwner && selectionOwner != owner->internalWinId()) ||
- (!selectionOwner && d->timestamp != CurrentTime && d->timestamp < timestamp))
+ (!selectionOwner && (d->timestamp == CurrentTime || d->timestamp < timestamp)))
return qt_check_selection_sentinel();
return false;
}
@@ -1532,7 +1532,7 @@ bool qt_xfixes_clipboard_changed(Window clipboardOwner, Time timestamp)
(unsigned int)(d ? d->timestamp : 0), (unsigned int)timestamp);
#endif
if (!owner || (clipboardOwner && clipboardOwner != owner->internalWinId()) ||
- (!clipboardOwner && d->timestamp != CurrentTime && d->timestamp < timestamp))
+ (!clipboardOwner && (d->timestamp == CurrentTime || d->timestamp < timestamp)))
return qt_check_clipboard_sentinel();
return false;
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index fe3fa57..ed53ccf 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -63,6 +63,7 @@
#include "qpointer.h"
#include "qapplication.h"
#include "qelapsedtimer.h"
+#include "QtCore/qthreadstorage.h"
#include <w32std.h>
#include <coecntrl.h>
#include <eikenv.h>
@@ -86,10 +87,21 @@ const TInt KInternalStatusPaneChange = 0x50000000;
//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
+class QS60ThreadLocalData
+{
+public:
+ QS60ThreadLocalData();
+ ~QS60ThreadLocalData();
+ bool usingCONEinstances;
+ RWsSession wsSession;
+ CWsScreenDevice *screenDevice;
+};
+
class QS60Data
{
public:
QS60Data();
+ QThreadStorage<QS60ThreadLocalData *> tls;
TUid uid;
int screenDepth;
QPoint lastCursorPos;
@@ -132,9 +144,9 @@ public:
int memoryLimitForHwRendering;
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
static inline void updateScreenSize();
- static inline RWsSession& wsSession();
+ inline RWsSession& wsSession();
static inline RWindowGroup& windowGroup();
- static inline CWsScreenDevice* screenDevice();
+ inline CWsScreenDevice* screenDevice();
static inline CCoeAppUi* appUi();
static inline CEikMenuBar* menuBar();
#ifdef Q_WS_S60
@@ -265,7 +277,10 @@ inline void QS60Data::updateScreenSize()
inline RWsSession& QS60Data::wsSession()
{
- return CCoeEnv::Static()->WsSession();
+ if(!tls.hasLocalData()) {
+ tls.setLocalData(new QS60ThreadLocalData);
+ }
+ return tls.localData()->wsSession;
}
inline RWindowGroup& QS60Data::windowGroup()
@@ -275,7 +290,10 @@ inline RWindowGroup& QS60Data::windowGroup()
inline CWsScreenDevice* QS60Data::screenDevice()
{
- return CCoeEnv::Static()->ScreenDevice();
+ if(!tls.hasLocalData()) {
+ tls.setLocalData(new QS60ThreadLocalData);
+ }
+ return tls.localData()->screenDevice;
}
inline CCoeAppUi* QS60Data::appUi()
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 1b01960..bf03545 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -234,12 +234,12 @@ void QOutlineMapper::endOutline()
// Check for out of dev bounds...
- const bool do_clip = (controlPointRect.left() < -QT_RASTER_COORD_LIMIT
+ const bool do_clip = !m_in_clip_elements && ((controlPointRect.left() < -QT_RASTER_COORD_LIMIT
|| controlPointRect.right() > QT_RASTER_COORD_LIMIT
|| controlPointRect.top() < -QT_RASTER_COORD_LIMIT
|| controlPointRect.bottom() > QT_RASTER_COORD_LIMIT
|| controlPointRect.width() > QT_RASTER_COORD_LIMIT
- || controlPointRect.height() > QT_RASTER_COORD_LIMIT);
+ || controlPointRect.height() > QT_RASTER_COORD_LIMIT));
if (do_clip) {
clipElements(elements, elementTypes(), element_count);
@@ -353,7 +353,13 @@ void QOutlineMapper::clipElements(const QPointF *elements,
// instead of going through convenience functionallity, but since
// this part of code hardly every used, it shouldn't matter.
+ m_in_clip_elements = true;
+
QPainterPath path;
+
+ if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
+ path.setFillRule(Qt::WindingFill);
+
if (types) {
for (int i=0; i<element_count; ++i) {
switch (types[i]) {
@@ -389,6 +395,8 @@ void QOutlineMapper::clipElements(const QPointF *elements,
else
convertPath(clippedPath);
m_txop = old_txop;
+
+ m_in_clip_elements = false;
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 39b7593..f64d03b 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -95,7 +95,8 @@ public:
m_tags(0),
m_contours(0),
m_polygon_dev(0),
- m_round_coords(false)
+ m_round_coords(false),
+ m_in_clip_elements(false)
{
}
@@ -235,6 +236,7 @@ public:
qreal m_dy;
bool m_valid;
+ bool m_in_clip_elements;
private:
bool m_round_coords;
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index f10f12f..a212718 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -459,13 +459,12 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
QRasterPaintEngineState *s = state();
ensureOutlineMapper();
- d->outlineMapper->m_clip_rect = d->deviceRect.adjusted(-10, -10, 10, 10);
-
- // This is the upp
- QRect bounds(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT,
- QT_RASTER_COORD_LIMIT*2 - 1, QT_RASTER_COORD_LIMIT * 2 - 1);
- d->outlineMapper->m_clip_rect = bounds.intersected(d->outlineMapper->m_clip_rect);
+ d->outlineMapper->m_clip_rect = d->deviceRect;
+ if (d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT)
+ d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT);
+ if (d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT)
+ d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT);
d->rasterizer->setClipRect(d->deviceRect);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index ff82d59..e0746fb 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -494,11 +494,9 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
} else {
d->activeStroker->moveTo(points[0], points[1]);
points += 2;
- ++types;
while (points < lastPoint) {
d->activeStroker->lineTo(points[0], points[1]);
points += 2;
- ++types;
}
if (path.hasImplicitClose())
d->activeStroker->lineTo(path.points()[0], path.points()[1]);
@@ -561,12 +559,10 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
QPointF p = ((QPointF *)points)[0] * state()->matrix;
d->activeStroker->moveTo(p.x(), p.y());
points += 2;
- ++types;
while (points < lastPoint) {
QPointF p = ((QPointF *)points)[0] * state()->matrix;
d->activeStroker->lineTo(p.x(), p.y());
points += 2;
- ++types;
}
if (path.hasImplicitClose())
d->activeStroker->lineTo(p.x(), p.y());
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 4c058ce..139139f 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -289,7 +289,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize));
Q_CHECK_PTR(newPixelSizes);
pixelSizes = newPixelSizes;
- } else if (!(count % 8)) {
+ } else if (!(count % 8) || count == 1) {
QtFontSize *newPixelSizes = (QtFontSize *)
realloc(pixelSizes,
(((count+8) >> 3) << 3) * sizeof(QtFontSize));
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 943df7f..cdfba3d 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -118,7 +118,7 @@ public:
{
if (!font)
return;
- QS60Data::screenDevice()->ReleaseFont(font);
+ S60->screenDevice()->ReleaseFont(font);
}
};
@@ -205,7 +205,7 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c
CFont* font = NULL;
#ifdef Q_SYMBIAN_HAS_FONTTABLE_API
- const TInt err = QS60Data::screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec);
+ const TInt err = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec);
Q_ASSERT(err == KErrNone && font);
QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font);
QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font);
@@ -260,17 +260,19 @@ QFontEngineFTS60::QFontEngineFTS60(const QFontDef &fd)
*/
qreal QFontEngineS60::pixelsToPoints(qreal pixels, Qt::Orientation orientation)
{
+ CWsScreenDevice* device = S60->screenDevice();
return (orientation == Qt::Horizontal?
- S60->screenDevice()->HorizontalPixelsToTwips(pixels)
- :S60->screenDevice()->VerticalPixelsToTwips(pixels)) / KTwipsPerPoint;
+ device->HorizontalPixelsToTwips(pixels)
+ :device->VerticalPixelsToTwips(pixels)) / KTwipsPerPoint;
}
qreal QFontEngineS60::pointsToPixels(qreal points, Qt::Orientation orientation)
{
+ CWsScreenDevice* device = S60->screenDevice();
const int twips = points * KTwipsPerPoint;
return orientation == Qt::Horizontal?
- S60->screenDevice()->HorizontalTwipsToPixels(twips)
- :S60->screenDevice()->VerticalTwipsToPixels(twips);
+ device->HorizontalTwipsToPixels(twips)
+ :device->VerticalTwipsToPixels(twips);
}
QFontEngineMultiS60::QFontEngineMultiS60(QFontEngine *first, int script, const QStringList &fallbackFamilies)
@@ -309,16 +311,16 @@ static void initializeDb()
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces();
+ const int numTypeFaces = S60->screenDevice()->NumTypefaces();
const QSymbianFontDatabaseExtrasImplementation *dbExtras =
static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
bool fontAdded = false;
for (int i = 0; i < numTypeFaces; i++) {
TTypefaceSupport typefaceSupport;
- QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i);
+ S60->screenDevice()->TypefaceSupport(typefaceSupport, i);
CFont *font; // We have to get a font instance in order to know all the details
TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11);
- if (QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
+ if (S60->screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
continue;
QScopedPointer<CFont, QSymbianFontDatabaseExtrasImplementation::CFontFromScreenDeviceReleaser> sFont(font);
if (font->TypeUid() == KCFbsFontUid) {
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 3be6d28..7ceed61 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -237,7 +237,8 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
*nglyphs = len;
for (int i = 0; i < len; ++i) {
outGlyphs[i] = 0;
- logClusters[i] = i;
+ if (logClusters)
+ logClusters[i] = i;
outAdvances_x[i] = QFixed();
outAdvances_y[i] = QFixed();
outAttributes[i].clusterStart = true;
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 925b3bf..f691413 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -66,7 +66,7 @@ QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont
QSymbianTypeFaceExtras::~QSymbianTypeFaceExtras()
{
- QS60Data::screenDevice()->ReleaseFont(m_cFont);
+ S60->screenDevice()->ReleaseFont(m_cFont);
}
QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const