From ddf8ebb0145f81d0deb0aabf7b774c42e4be4c2b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 21 Dec 2012 19:42:22 -0800 Subject: Fix warnings found by GCC 4.7 in the XCB platform plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qxcbnativeinterface.cpp:246:8: error: unused parameter 'context' [-Werror=unused-parameter] qxcbcursor.cpp:550:85: error: 'root' may be used uninitialized in this function [-Werror=maybe-uninitialized] Change-Id: I5fa4e717c86d0e8198e501e6c799e0ceb9264708 Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbcursor.cpp | 2 +- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index e1dfe3d6c0..e2843d04dc 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -545,7 +545,7 @@ QPoint QXcbCursor::pos() const void QXcbCursor::setPos(const QPoint &pos) { - xcb_window_t root; + xcb_window_t root = 0; queryPointer(connection(), &root, 0); xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y()); xcb_flush(xcb_connection()); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 9c360df900..9a24390bac 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -250,6 +250,7 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context) QEGLPlatformContext *eglPlatformContext = static_cast(context->handle()); return eglPlatformContext->eglContext(); #else + Q_UNUSED(context); return 0; #endif } -- cgit v1.2.3 From 77924a0276674e3dd3627e33c5ea7005e5ee0d13 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 21 Dec 2012 21:40:30 -0800 Subject: Remove some dead code from qtriangulator.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CompareEdges functor class is never used anywhere. Clang saw it through to the static function that never got used: qtriangulator.cpp:227:12: error: unused function 'comparePoints' [-Werror,-Wunused-function] static int comparePoints(const QPodPoint &u, const QPodPoint &v) ^ Change-Id: I67d821e454daf82bd8107bf20f787aff9496e878 Reviewed-by: Samuel Rødal --- src/gui/opengl/qtriangulator.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp index b506ffdc6a..d31c260f3d 100644 --- a/src/gui/opengl/qtriangulator.cpp +++ b/src/gui/opengl/qtriangulator.cpp @@ -220,23 +220,6 @@ static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, c return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0; } -// Return: -// -1 if u < v -// 0 if u == v -// 1 if u > v -static int comparePoints(const QPodPoint &u, const QPodPoint &v) -{ - if (u.y < v.y) - return -1; - if (u.y > v.y) - return 1; - if (u.x < v.x) - return -1; - if (u.x > v.x) - return 1; - return 0; -} - //============================================================================// // QIntersectionPoint // //============================================================================// @@ -632,16 +615,6 @@ public: bool pointingUp, originallyPointingUp; }; - friend class CompareEdges; - class CompareEdges - { - public: - inline CompareEdges(ComplexToSimple *parent) : m_parent(parent) { } - bool operator () (int i, int j) const; - private: - ComplexToSimple *m_parent; - }; - struct Intersection { bool operator < (const Intersection &other) const {return other.intersectionPoint < intersectionPoint;} @@ -1653,18 +1626,6 @@ void QTriangulator::ComplexToSimple::removeUnusedPoints() { } } -template -bool QTriangulator::ComplexToSimple::CompareEdges::operator () (int i, int j) const -{ - int cmp = comparePoints(m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(i).from), - m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(j).from)); - if (cmp == 0) { - cmp = comparePoints(m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(i).to), - m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(j).to)); - } - return cmp > 0; -} - template inline bool QTriangulator::ComplexToSimple::Event::operator < (const Event &other) const { -- cgit v1.2.3 From 0fd0f8dfa05b9832f93cb8c1bc82220dd8d78eb2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Jan 2013 14:33:42 -0200 Subject: Declare the QMetaType::WasDeclaredAsMetaType enum as private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Omit its value in the documentation. Change-Id: I474faefde23b0e2e0a77a9e6391fd556a6523128 Reviewed-by: Jędrzej Nowacki Reviewed-by: Stephen Kelly --- src/corelib/kernel/qmetatype.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 6194f20912..0d737ac1a3 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -240,6 +240,7 @@ struct DefinedTypesFilter { \omitvalue PointerToQObject \omitvalue WeakPointerToQObject \omitvalue TrackingPointerToQObject + \omitvalue WasDeclaredAsMetaType */ /*! -- cgit v1.2.3 From 4319f698c893683c6a031e41272b85cfb25ac931 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 3 Jan 2013 10:33:51 +0100 Subject: Remove metatype registration of built-in types. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As they are built-in, they are effectively registered at compile-time already. Change-Id: I7ae6ba16088eab5d19213fa7b07c2a7760988a86 Reviewed-by: Jędrzej Nowacki --- src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp | 6 +++--- src/testlib/qsignalspy.qdoc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp b/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp index 6741ae7942..694f206212 100644 --- a/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp +++ b/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp @@ -65,14 +65,14 @@ QVERIFY(arguments.at(2).type() == QVariant::double); //! [2] -qRegisterMetaType("QModelIndex"); -QSignalSpy spy(&model, SIGNAL(whatever(QModelIndex))); +qRegisterMetaType(); +QSignalSpy spy(&model, SIGNAL(whatever(SomeStruct))); //! [2] //! [3] // get the first argument from the first received signal: -QModelIndex result = qvariant_cast(spy.at(0).at(0)); +SomeStruct result = qvariant_cast(spy.at(0).at(0)); //! [3] diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc index d36716bf2e..3d7b17a145 100644 --- a/src/testlib/qsignalspy.qdoc +++ b/src/testlib/qsignalspy.qdoc @@ -54,7 +54,7 @@ \snippet code/doc_src_qsignalspy.cpp 2 - To retrieve the \c QModelIndex, you can use qvariant_cast: + To retrieve the instance, you can use qvariant_cast: \snippet code/doc_src_qsignalspy.cpp 3 */ -- cgit v1.2.3 From 248ccb2889aec76cb99c25998534c97b48b98c4a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 11 Dec 2012 14:07:16 +0100 Subject: Fix possible crash in QTextDocument With trailing spaces in some cases, we would not get the "no justification at end of paragraph" special case, and continue in the code, getting the unexpected case where line_length becomes < 0 which would lead to memory corruption because we were writing outside our buffers. I added an assert to catch this type of bug earlier, and I added the trailing spaces to the test for the end of the paragraph. The test case added is one example which would crash. Task-number: QTBUG-27354 Change-Id: Id720a6fa55dbc709ce04dd5321e55687bf960d75 Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 82cff6a043..37d6276f6b 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1852,7 +1852,7 @@ void QTextEngine::justify(const QScriptLine &line) itemize(); if (!forceJustification) { - int end = line.from + (int)line.length; + int end = line.from + (int)line.length + line.trailingSpaces; if (end == layoutData->string.length()) return; // no justification at end of paragraph if (end && layoutData->items[findItem(end-1)].analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) @@ -1907,6 +1907,8 @@ void QTextEngine::justify(const QScriptLine &line) int gs = log_clusters[start]; int ge = (end == length(firstItem+i) ? si.num_glyphs : log_clusters[end]); + Q_ASSERT(ge <= si.num_glyphs); + const QGlyphLayout g = shapedGlyphs(&si); for (int i = gs; i < ge; ++i) { -- cgit v1.2.3 From 418489266598724d03380c2943038e7df30d1534 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 3 Jan 2013 16:06:44 +0100 Subject: Fix copy-pasto in QMetaObject::methodCount docs. Copy-pasto'ed from the propertyCount docs. Change-Id: Iddb4ce9c9559ca274a80deb0785424df108af762 Reviewed-by: Simon Hausmann --- src/corelib/kernel/qmetaobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 3616d0e825..b9bd74c2bd 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -472,7 +472,7 @@ int QMetaObject::constructorCount() const /*! Returns the number of methods in this class, including the number of - properties provided by each base class. These include signals and slots + methods provided by each base class. These include signals and slots as well as normal member functions. Use code like the following to obtain a QStringList containing the methods -- cgit v1.2.3 From 0cac0796a0156c1745e2a276c20d4eabb5f88bf8 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Thu, 3 Jan 2013 15:56:20 +0100 Subject: WINCE: Follow new library naming schema Change-Id: Iad85e64bf504053e21cad809d2435c1ca239201b Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsintegration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index f6011ae082..f5ad442e68 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -419,9 +419,9 @@ inline bool isQMLApplication() { // check if the QtQuick library is loaded #ifdef _DEBUG - HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"d5.dll"); + HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L"d.dll"); #else - HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"5.dll"); + HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L".dll"); #endif return (handle != NULL); } -- cgit v1.2.3 From 00b0dff93f77bed09687b876777bbf0cb4d6bfff Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Thu, 3 Jan 2013 10:34:38 +0000 Subject: QNX: Don't crash because the window hasn't been initialized yet. Don't call window->handle() inside the backingstore ctor, because we might still have the window ctor in the call stack ( ex: a QWindow sub-class that creates a backingstore inside it's ctor). Crash can be reproduced by running examples/gui/analogclock. Change-Id: I4622ceaeb05696c5ae0181a528f58e5d102dcb22 Reviewed-by: Sean Harmer --- .../platforms/qnx/qqnxrasterbackingstore.cpp | 25 ++++++++++++++-------- src/plugins/platforms/qnx/qqnxrasterbackingstore.h | 4 +++- 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index 11babe3aaa..47a72f173b 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -60,8 +60,7 @@ QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window) { qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window; - // save platform window associated with widget - m_platformWindow = static_cast(window->handle()); + m_window = window; } QQnxRasterBackingStore::~QQnxRasterBackingStore() @@ -71,8 +70,9 @@ QQnxRasterBackingStore::~QQnxRasterBackingStore() QPaintDevice *QQnxRasterBackingStore::paintDevice() { - if (m_platformWindow->hasBuffers()) - return m_platformWindow->renderBuffer().image(); + QQnxWindow *platformWindow = this->platformWindow(); + if (platformWindow->hasBuffers()) + return platformWindow->renderBuffer().image(); return 0; } @@ -85,7 +85,8 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const if (window) targetWindow = static_cast(window->handle()); - if (!targetWindow || targetWindow == m_platformWindow) { + QQnxWindow *platformWindow = this->platformWindow(); + if (!targetWindow || targetWindow == platformWindow) { // visit all pending scroll operations for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { @@ -93,14 +94,14 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const // do the scroll operation ScrollOp &op = m_scrollOpList[i]; QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) ); - m_platformWindow->scroll(srcArea, op.dx, op.dy); + platformWindow->scroll(srcArea, op.dx, op.dy); } // clear all pending scroll operations m_scrollOpList.clear(); // update the display with newly rendered content - m_platformWindow->post(region); + platformWindow->post(region); } else if (targetWindow) { // The contents of the backing store should be flushed to a different window than the @@ -119,7 +120,7 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const Q_ASSERT(!m_hasUnflushedPaintOperations); targetWindow->adjustBufferSize(); - targetWindow->blitFrom(m_platformWindow, offset, region); + targetWindow->blitFrom(platformWindow, offset, region); targetWindow->post(region); } else { @@ -177,7 +178,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); m_hasUnflushedPaintOperations = true; - m_platformWindow->adjustBufferSize(); + platformWindow()->adjustBufferSize(); } void QQnxRasterBackingStore::endPaint(const QRegion ®ion) @@ -186,4 +187,10 @@ void QQnxRasterBackingStore::endPaint(const QRegion ®ion) qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); } +QQnxWindow *QQnxRasterBackingStore::platformWindow() const +{ + Q_ASSERT(m_window->handle()); + return static_cast(m_window->handle()); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h index 8abd81f217..a344ff209d 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h @@ -72,7 +72,9 @@ private: int dy; }; - QQnxWindow *m_platformWindow; + QQnxWindow *platformWindow() const; + + QWindow *m_window; QList m_scrollOpList; bool m_hasUnflushedPaintOperations; }; -- cgit v1.2.3 From 1b47059c886d76cc1a403e74abd034cce3b53a34 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 3 Jan 2013 13:01:17 +0100 Subject: Clarify how two digit years are parsed by QDateTime::fromString(). It's currently not obvious that two digit years will always be in the 20th century (1900's). Task-number: QTBUG-28797 Change-Id: I7dee9a46e0cb803a8f097debc5443d1789c2f16c Reviewed-by: Thiago Macieira Reviewed-by: Venugopal Shivashankar --- .../doc/snippets/code/src_corelib_tools_qdatetime.cpp | 16 +++++++++++++++- src/corelib/tools/qdatetime.cpp | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp index a2b128800e..d57c1314a8 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qdatetime.cpp @@ -143,6 +143,8 @@ QDateTime dateTime = QDateTime::fromString("130", "Mm"); // invalid //! [14] QDateTime dateTime = QDateTime::fromString("1.30.1", "M.d.s"); // dateTime is January 30 in 1900 at 00:00:01. +dateTime = QDateTime::fromString("12", "yy"); +// dateTime is January 1 in 1912 at 00:00:00. //! [14] //! [15] @@ -191,4 +193,16 @@ UTC.setTimeSpec(Qt::UTC); qDebug() << "UTC time is:" << UTC; qDebug() << "There are" << local.secsTo(UTC) << "seconds difference between the datetimes."; -//! [19] \ No newline at end of file +//! [19] + +//! [20] +QString string = "Monday, 23 April 12 22:51:41"; +QString format = "dddd, d MMMM yy hh:mm:ss"; +QDateTime invalid = QDateTime::fromString(string, format); +//! [20] + +//! [21] +QString string = "Tuesday, 23 April 12 22:51:41"; +QString format = "dddd, d MMMM yy hh:mm:ss"; +QDateTime valid = QDateTime::fromString(string, format); +//! [21] diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 9ac4c1a87f..9949aeb7a1 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3533,6 +3533,18 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) This could have meant 1 January 00:30.00 but the M will grab two digits. + Incorrectly specified fields of the \a string will cause an invalid + QDateTime to be returned. For example, consider the following code, + where the two digit year 12 is read as 1912 (see the table below for all + field defaults); the resulting datetime is invalid because 23 April 1912 + was a Tuesday, not a Monday: + + \snippet code/src_corelib_tools_qdatetime.cpp 20 + + The correct code is: + + \snippet code/src_corelib_tools_qdatetime.cpp 21 + For any field that is not represented in the format, the following defaults are used: -- cgit v1.2.3 From 25c6908c80217ab7cae46e971ec5b04e3fab361e Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Thu, 20 Dec 2012 16:04:17 +0100 Subject: Do not crash in the bridge because of inconsistent hierarchy Change-Id: I732b624b9918ff4ab59ef46322fd42167b438a8d Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index f1bdc77303..5902f05663 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -767,9 +767,11 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI // actually ask for the same object. As a consequence, we need to clone ourselves: if (QAccessibleInterface *par = accessible->parent()) { const int indexOf = par->indexOfChild(accessible); - QAccessibleInterface *clone = par->child(indexOf); + if (indexOf == -1) + qWarning() << "inconsistent hierarchy, parent:" << par << "child:" << accessible; + else + acc = par->child(indexOf); delete par; - acc = clone; } } } -- cgit v1.2.3 From 24d8bcf93a14545769154dae9ce06de2ef4c2430 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 20 Dec 2012 14:02:03 +0100 Subject: QGtkStyle: exclude Xlib calls on Mac Task-number: QTBUG-28769 Change-Id: I3f83b6011acf43e5136a762d0f8841b3a910cecb Reviewed-by: Andy Shaw Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qgtkstyle_p.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index ba41482ec5..782ef8d483 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -75,6 +75,7 @@ #include #include +#ifndef Q_OS_MAC // X11 Includes: // the following is necessary to work around breakage in many versions @@ -90,6 +91,7 @@ #undef XRegisterIMInstantiateCallback #undef XUnregisterIMInstantiateCallback #undef XSetIMValues +#endif QT_BEGIN_NAMESPACE @@ -210,7 +212,9 @@ Ptr_gconf_client_get_bool QGtkStylePrivate::gconf_client_get_bool = 0; Ptr_gnome_icon_lookup_sync QGtkStylePrivate::gnome_icon_lookup_sync = 0; Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; +#ifndef Q_OS_MAC typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); +#endif QT_END_NAMESPACE @@ -540,10 +544,14 @@ void QGtkStylePrivate::initGtkWidgets() const } if (QGtkStylePrivate::gtk_init) { +#ifndef Q_OS_MAC // Gtk will set the Qt error handler so we have to reset it afterwards x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); +#endif QGtkStylePrivate::gtk_init (NULL, NULL); +#ifndef Q_OS_MAC XSetErrorHandler(qt_x_errhandler); +#endif // make a window GtkWidget* gtkWindow = QGtkStylePrivate::gtk_window_new(GTK_WINDOW_POPUP); @@ -967,13 +975,14 @@ void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *p QWidget *modalFor = parent ? parent->window() : qApp->activeWindow(); if (modalFor) { QGtkStylePrivate::gtk_widget_realize(gtkFileChooser); // Creates X window +#ifndef Q_OS_MAC XSetTransientForHint(QGtkStylePrivate::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window), QGtkStylePrivate::gdk_x11_drawable_get_xid(gtkFileChooser->window), modalFor->winId()); #ifdef Q_WS_X11 QGtkStylePrivate::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime()); #endif - +#endif } QFileInfo fileinfo(dir); -- cgit v1.2.3 From 9cfce43f19af87bc0a929b917da2901de7dbc193 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Thu, 3 Jan 2013 14:47:51 +0100 Subject: BlackBerry: Reevaluation of timer list in event dispatcher In the event dispatcher the timer list has to be reevaluated after each call to filterEvent, because timers could be started in event filters. Change-Id: I1a275845fb74c63441f2301555f3459f8295af27 Reviewed-by: Rafael Roquetto Reviewed-by: Sean Harmer --- src/corelib/kernel/qeventdispatcher_blackberry.cpp | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp index 69b4a8b172..3e958ee277 100644 --- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp +++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp @@ -271,6 +271,11 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif } } +static inline int timevalToMillisecs(const timeval &tv) +{ + return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); +} + int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout) { @@ -279,9 +284,6 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef BpsChannelScopeSwitcher channelSwitcher(d->bps_channel); - // Make a note of the start time - timeval startTime = qt_gettime(); - // prepare file sets for bps callback d->ioData->count = 0; d->ioData->readfds = readfds; @@ -298,15 +300,15 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef if (exceptfds) FD_ZERO(exceptfds); + bps_event_t *event = 0; + unsigned int eventCount = 0; + // Convert timeout to milliseconds int timeoutTotal = -1; if (timeout) - timeoutTotal = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000); - + timeoutTotal = timevalToMillisecs(*timeout); int timeoutLeft = timeoutTotal; - - bps_event_t *event = 0; - unsigned int eventCount = 0; + timeval startTime = qt_gettime(); // This loop exists such that we can drain the bps event queue of all native events // more efficiently than if we were to return control to Qt after each event. This @@ -331,11 +333,20 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef // Clock source is monotonic, so we can recalculate how much timeout is left if (timeoutTotal != -1) { timeval t2 = qt_gettime(); - timeoutLeft = timeoutTotal - ((t2.tv_sec * 1000 + t2.tv_usec / 1000) - - (startTime.tv_sec * 1000 + startTime.tv_usec / 1000)); + timeoutLeft = timeoutTotal + - (timevalToMillisecs(t2) - timevalToMillisecs(startTime)); if (timeoutLeft < 0) timeoutLeft = 0; } + + timeval tnext; + if (d->timerList.timerWait(tnext)) { + int timeoutNext = timevalToMillisecs(tnext); + if (timeoutNext < timeoutLeft || timeoutTotal == -1) { + timeoutTotal = timeoutLeft = timeoutNext; + startTime = qt_gettime(); + } + } } // Wait for event or file to be ready -- cgit v1.2.3 From 4250fa2cf607a21dedc0588497498f82e77fb390 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 2 Jan 2013 14:21:36 +0100 Subject: Revert "Enable module build with QT_NO_ACCESSIBILITY" This reverts commit b7f63c6bf74a0eb62bb49c1085584da1b3714a06. It made compilation fail in qstylehelper_p.h if QT_NO_ACCESSIBILITY was defined - which it is by default on linux without dbus. Change-Id: I313f5138460d28c44dad128d175df0e53a99287d Reviewed-by: Jens Bache-Wiig Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible.cpp | 14 ++++++++++---- src/gui/accessible/qaccessible.h | 3 --- src/platformsupport/linuxaccessibility/application.cpp | 4 ---- src/platformsupport/linuxaccessibility/application_p.h | 4 ---- src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 4 ---- src/platformsupport/linuxaccessibility/atspiadaptor_p.h | 4 ---- src/platformsupport/linuxaccessibility/bridge.cpp | 4 ---- src/platformsupport/linuxaccessibility/bridge_p.h | 4 ---- src/platformsupport/linuxaccessibility/cache.cpp | 4 ---- src/platformsupport/linuxaccessibility/cache_p.h | 4 ---- .../linuxaccessibility/constant_mappings.cpp | 4 ---- .../linuxaccessibility/constant_mappings_p.h | 3 --- src/platformsupport/linuxaccessibility/dbusconnection.cpp | 4 ---- src/platformsupport/linuxaccessibility/dbusconnection_p.h | 4 ---- .../linuxaccessibility/struct_marshallers.cpp | 4 ---- 15 files changed, 10 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 47d159380d..f55037c37a 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - /*! \class QAccessible \brief The QAccessible class provides enums and static functions @@ -439,19 +437,23 @@ QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; static bool accessibility_active = false; static bool cleanupAdded = false; +#ifndef QT_NO_ACCESSIBILITY static QPlatformAccessibility *platformAccessibility() { QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); return pfIntegration ? pfIntegration->accessibility() : 0; } +#endif /*! \internal */ void QAccessible::cleanup() { +#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->cleanup(); +#endif } static void qAccessibleCleanup() @@ -595,8 +597,10 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) mo = mo->superClass(); } +#ifndef QT_NO_ACCESSIBILITY if (object == qApp) return new QAccessibleApplication; +#endif return 0; } @@ -636,8 +640,10 @@ void QAccessible::setRootObject(QObject *object) return; } +#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->setRootObject(object); +#endif } /*! @@ -669,8 +675,10 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event) if (!isActive()) return; +#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->notifyAccessibilityUpdate(event); +#endif } #if QT_DEPRECATED_SINCE(5, 0) @@ -1524,7 +1532,5 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) #endif -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 5bcf9e7d0d..5f61634ba2 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -57,7 +57,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY class QAccessibleInterface; class QAccessibleEvent; @@ -677,8 +676,6 @@ inline void QAccessible::updateAccessibility(QObject *object, int child, Event r } #endif -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/platformsupport/linuxaccessibility/application.cpp b/src/platformsupport/linuxaccessibility/application.cpp index 22059de864..c2049e536a 100644 --- a/src/platformsupport/linuxaccessibility/application.cpp +++ b/src/platformsupport/linuxaccessibility/application.cpp @@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - /*! \class QSpiApplicationAdaptor \internal @@ -219,6 +217,4 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerError(const QDBusError& error } } -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/application_p.h b/src/platformsupport/linuxaccessibility/application_p.h index 4a60bbfe84..14b8a71b42 100644 --- a/src/platformsupport/linuxaccessibility/application_p.h +++ b/src/platformsupport/linuxaccessibility/application_p.h @@ -49,8 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - /* * Used for the root object. * @@ -82,8 +80,6 @@ private: QDBusConnection dbusConnection; }; -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 534cf4b73a..342b796fbe 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -65,8 +65,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - static bool isDebugging = false; #define qAtspiDebug if (!::isDebugging); else qDebug @@ -2359,6 +2357,4 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu return true; } -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h index e6f95195fe..5b5eb60228 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h +++ b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h @@ -56,8 +56,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - class QAccessibleInterface; class QSpiAccessibleInterface; class QSpiApplicationAdaptor; @@ -218,8 +216,6 @@ private: uint sendWindow_unshade : 1; }; -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/platformsupport/linuxaccessibility/bridge.cpp b/src/platformsupport/linuxaccessibility/bridge.cpp index bf2486fc57..f22dc4e191 100644 --- a/src/platformsupport/linuxaccessibility/bridge.cpp +++ b/src/platformsupport/linuxaccessibility/bridge.cpp @@ -56,8 +56,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - /*! \class QSpiAccessibleBridge \internal @@ -184,6 +182,4 @@ void QSpiAccessibleBridge::initializeConstantMappings() qSpiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1String(map[i].name), tr(map[i].name))); } -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/bridge_p.h b/src/platformsupport/linuxaccessibility/bridge_p.h index 3865e06489..f7c243cfbb 100644 --- a/src/platformsupport/linuxaccessibility/bridge_p.h +++ b/src/platformsupport/linuxaccessibility/bridge_p.h @@ -51,8 +51,6 @@ class DeviceEventControllerAdaptor; QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - class DBusConnection; class QSpiDBusCache; class AtSpiAdaptor; @@ -81,8 +79,6 @@ private: bool initialized; }; -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/platformsupport/linuxaccessibility/cache.cpp b/src/platformsupport/linuxaccessibility/cache.cpp index 9201fc1d8b..81a54a1ce5 100644 --- a/src/platformsupport/linuxaccessibility/cache.cpp +++ b/src/platformsupport/linuxaccessibility/cache.cpp @@ -49,8 +49,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - /*! \class QSpiDBusCache \internal @@ -91,6 +89,4 @@ QSpiAccessibleCacheArray QSpiDBusCache::GetItems() return cacheArray; } -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/cache_p.h b/src/platformsupport/linuxaccessibility/cache_p.h index 4b606eadb1..898f06f0d6 100644 --- a/src/platformsupport/linuxaccessibility/cache_p.h +++ b/src/platformsupport/linuxaccessibility/cache_p.h @@ -49,8 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - class QSpiDBusCache : public QObject { Q_OBJECT @@ -68,8 +66,6 @@ public Q_SLOTS: QSpiAccessibleCacheArray GetItems(); }; -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/platformsupport/linuxaccessibility/constant_mappings.cpp b/src/platformsupport/linuxaccessibility/constant_mappings.cpp index 5138b9a163..1840868aa2 100644 --- a/src/platformsupport/linuxaccessibility/constant_mappings.cpp +++ b/src/platformsupport/linuxaccessibility/constant_mappings.cpp @@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - QHash qSpiRoleMapping; quint64 spiStatesFromQState(QAccessible::State state) @@ -156,6 +154,4 @@ AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relat return ATSPI_RELATION_NULL; } -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/constant_mappings_p.h b/src/platformsupport/linuxaccessibility/constant_mappings_p.h index 870a3a4b2a..837a68516d 100644 --- a/src/platformsupport/linuxaccessibility/constant_mappings_p.h +++ b/src/platformsupport/linuxaccessibility/constant_mappings_p.h @@ -53,7 +53,6 @@ #include #include -#ifndef QT_NO_ACCESSIBILITY // interface names from at-spi2-core/atspi/atspi-misc-private.h #define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry" @@ -136,6 +135,4 @@ AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relat QT_END_NAMESPACE QT_END_HEADER -#endif // QT_NO_ACCESSIBILITY - #endif /* Q_SPI_CONSTANT_MAPPINGS_H */ diff --git a/src/platformsupport/linuxaccessibility/dbusconnection.cpp b/src/platformsupport/linuxaccessibility/dbusconnection.cpp index a38570a465..a99e8f0a5e 100644 --- a/src/platformsupport/linuxaccessibility/dbusconnection.cpp +++ b/src/platformsupport/linuxaccessibility/dbusconnection.cpp @@ -48,8 +48,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - /*! \class DBusConnection \internal @@ -106,6 +104,4 @@ QDBusConnection DBusConnection::connection() const return dbusConnection; } -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/platformsupport/linuxaccessibility/dbusconnection_p.h b/src/platformsupport/linuxaccessibility/dbusconnection_p.h index da090da9cf..674cf28c34 100644 --- a/src/platformsupport/linuxaccessibility/dbusconnection_p.h +++ b/src/platformsupport/linuxaccessibility/dbusconnection_p.h @@ -49,8 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - class DBusConnection { public: @@ -64,8 +62,6 @@ private: QDBusConnection dbusConnection; }; -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/platformsupport/linuxaccessibility/struct_marshallers.cpp b/src/platformsupport/linuxaccessibility/struct_marshallers.cpp index 027993c4bd..713e26f25a 100644 --- a/src/platformsupport/linuxaccessibility/struct_marshallers.cpp +++ b/src/platformsupport/linuxaccessibility/struct_marshallers.cpp @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - QSpiObjectReference::QSpiObjectReference() : path(QDBusObjectPath(ATSPI_DBUS_PATH_NULL)) {} @@ -236,6 +234,4 @@ void qSpiInitializeStructTypes() qDBusRegisterMetaType(); } -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE -- cgit v1.2.3 From d75b21790162694ce5f595ddf330af06df09644b Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Mon, 31 Dec 2012 18:31:19 +1100 Subject: Windows: Add fallback for UpdateLayeredWindowIndirect The UpdateLayeredWindowIndirect function is only available on Windows Vista and later. If UpdateLayeredWindowIndirect is not available (e.g. on Windows XP), use UpdateLayeredWindow instead. Change-Id: I8af23c051560f7e54eda390dae7553543c00a94b Reviewed-by: Joerg Bornemann Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsbackingstore.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 04fe558541..b7937b4d84 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -100,10 +100,15 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA}; - RECT dirty = {dirtyRect.x(), dirtyRect.y(), - dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; - UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; - QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info); + + if (QWindowsContext::user32dll.updateLayeredWindowIndirect) { + RECT dirty = {dirtyRect.x(), dirtyRect.y(), + dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; + UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; + QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info); + } else { + QWindowsContext::user32dll.updateLayeredWindow(rw->handle(), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA); + } } else { #endif const HDC dc = rw->getDC(); -- cgit v1.2.3 From f415d86d1e88410d22607729ec7f5485a70fc2ad Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 2 Jan 2013 16:42:16 +0100 Subject: Cocoa: Fix zombie NSScreen crash While the Cocoa documentation says we should not cache [NSScreen screens], it seems that we should not cache its referenced objects either. This caused a crash in desktop components when using Dial because, given the way it is being rendered, we need to know the screen pixel ratio. Task-number: QTCOMPONENTS-1279 Change-Id: If5c3c6f14d04925215b9dca011143a2056a68846 Reviewed-by: J-P Nurmi Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoaintegration.h | 4 ++-- src/plugins/platforms/cocoa/qcocoaintegration.mm | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index e455a3552e..69801a69f1 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -80,11 +80,11 @@ public: // ---------------------------------------------------- // Additional methods void setVirtualSiblings(QList siblings) { m_siblings = siblings; } - NSScreen *osScreen() const { return m_screen; } + NSScreen *osScreen() const; void updateGeometry(); public: - NSScreen *m_screen; + int m_screenIndex; QRect m_geometry; QRect m_availableGeometry; QDpi m_logicalDpi; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index e096096e99..f4da7cc58a 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -70,9 +70,8 @@ static void initResources() QT_BEGIN_NAMESPACE QCocoaScreen::QCocoaScreen(int screenIndex) : - QPlatformScreen(), m_refreshRate(60.0) + QPlatformScreen(), m_screenIndex(screenIndex), m_refreshRate(60.0) { - m_screen = [[NSScreen screens] objectAtIndex:screenIndex]; updateGeometry(); m_cursor = new QCocoaCursor; } @@ -82,19 +81,25 @@ QCocoaScreen::~QCocoaScreen() delete m_cursor; } +NSScreen *QCocoaScreen::osScreen() const +{ + return [[NSScreen screens] objectAtIndex:m_screenIndex]; +} + void QCocoaScreen::updateGeometry() { - NSRect frameRect = [m_screen frame]; + NSScreen *nsScreen = osScreen(); + NSRect frameRect = [nsScreen frame]; m_geometry = QRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height); - NSRect visibleRect = [m_screen visibleFrame]; + NSRect visibleRect = [nsScreen visibleFrame]; m_availableGeometry = QRect(visibleRect.origin.x, frameRect.size.height - (visibleRect.origin.y + visibleRect.size.height), // invert y visibleRect.size.width, visibleRect.size.height); m_format = QImage::Format_RGB32; - m_depth = NSBitsPerPixelFromDepth([m_screen depth]); + m_depth = NSBitsPerPixelFromDepth([nsScreen depth]); - NSDictionary *devDesc = [m_screen deviceDescription]; + NSDictionary *devDesc = [nsScreen deviceDescription]; CGDirectDisplayID dpy = [[devDesc objectForKey:@"NSScreenNumber"] unsignedIntValue]; CGSize size = CGDisplayScreenSize(dpy); m_physicalSize = QSizeF(size.width, size.height); @@ -119,7 +124,7 @@ qreal QCocoaScreen::devicePixelRatio() const { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { - return qreal([m_screen backingScaleFactor]); + return qreal([osScreen() backingScaleFactor]); } else #endif { -- cgit v1.2.3 From cf2a75e41bc6715958d170d42f37fc6bb609f830 Mon Sep 17 00:00:00 2001 From: Jon Severinsson Date: Tue, 23 Oct 2012 18:52:29 +0200 Subject: Fix QGuiApplication::keyboardModifiers() and QGuiApplication::mouseButtons() Previous commit b2363a935c8dac fixed keyboardModifiers() after QPA event processing, but broke QTestLib, which expects spontaneous input events sent to qApp->notify() to update keyboardModifiers() and mouseButtons(). The commit also did not fix mouseButtons() after QPA event processing, and missed keyboardModifiers() after QPA Tablet event processing. This commit fixes all these shortcommings in b2363a935c8dac. Includes test case by David Faure Task-Number: QTBUG-26887 Change-Id: I8518b06c4ce86ea7b35120e3353a45ea2a81d356 Reviewed-by: David Faure (KDE) Reviewed-by: Lars Knoll --- src/gui/kernel/qguiapplication.cpp | 7 +++-- src/gui/kernel/qwindowsysteminterface_p.h | 5 ++-- src/widgets/kernel/qapplication.cpp | 46 ++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 72e95c996c..190d52776a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1392,7 +1392,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo // Ignore mouse events that don't change the current state. return; } - buttons = e->buttons; + mouse_buttons = buttons = e->buttons; if (button & e->buttons) { ulong doubleClickInterval = static_cast(qApp->styleHints()->mouseDoubleClickInterval()); doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton; @@ -1688,7 +1688,10 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T type = e->down ? QEvent::TabletPress : QEvent::TabletRelease; tabletState = e->down; } + QWindow *window = e->window.data(); + modifier_buttons = e->modifiers; + bool localValid = true; // If window is null, pick one based on the global position and make sure all // subsequent events up to the release are delivered to that same window. @@ -1719,7 +1722,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T QTabletEvent ev(type, local, e->global, e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt, e->tangentialPressure, e->rotation, e->z, - e->mods, e->uid); + e->modifiers, e->uid); ev.setTimestamp(e->timestamp); QGuiApplication::sendSpontaneousEvent(window, &ev); #else diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index e8d2a85dd9..dfdf7e9e93 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -302,10 +302,10 @@ public: TabletEvent(QWindow *w, ulong time, bool down, const QPointF &local, const QPointF &global, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tpressure, qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers mods) - : InputEvent(w, time, Tablet, Qt::NoModifier), + : InputEvent(w, time, Tablet, mods), down(down), local(local), global(global), device(device), pointerType(pointerType), pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure), - rotation(rotation), z(z), uid(uid), mods(mods) { } + rotation(rotation), z(z), uid(uid) { } bool down; QPointF local; QPointF global; @@ -318,7 +318,6 @@ public: qreal rotation; int z; qint64 uid; - Qt::KeyboardModifiers mods; }; class TabletEnterProximityEvent : public InputEvent { diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 9d3c5f8616..ed6262ce93 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2709,16 +2709,48 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (receiver->isWindowType()) QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast(receiver), e); - // capture the current mouse/keyboard state if(e->spontaneous()) { - if (e->type() == QEvent::MouseButtonPress - || e->type() == QEvent::MouseButtonRelease) { + // Capture the current mouse and keyboard states. Doing so here is + // required in order to support QTestLib synthesized events. Real mouse + // and keyboard state updates from the platform plugin are managed by + // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event(); + switch (e->type()) { + case QEvent::MouseButtonPress: + { QMouseEvent *me = static_cast(e); - if(me->type() == QEvent::MouseButtonPress) - QApplicationPrivate::mouse_buttons |= me->button(); - else - QApplicationPrivate::mouse_buttons &= ~me->button(); + QApplicationPrivate::modifier_buttons = me->modifiers(); + QApplicationPrivate::mouse_buttons |= me->button(); + break; + } + case QEvent::MouseButtonRelease: + { + QMouseEvent *me = static_cast(e); + QApplicationPrivate::modifier_buttons = me->modifiers(); + QApplicationPrivate::mouse_buttons &= ~me->button(); + break; + } + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::MouseMove: +#ifndef QT_NO_WHEELEVENT + case QEvent::Wheel: +#endif + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: +#ifndef QT_NO_TABLETEVENT + case QEvent::TabletMove: + case QEvent::TabletPress: + case QEvent::TabletRelease: +#endif + { + QInputEvent *ie = static_cast(e); + QApplicationPrivate::modifier_buttons = ie->modifiers(); + break; } + default: + break; + } } #ifndef QT_NO_GESTURES -- cgit v1.2.3 From bd04a3d136ed3384aa754f288201b5675a912596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 4 Jan 2013 10:06:08 +0100 Subject: Fixed wrong emits of x/y/width/height changed signals in QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should only emit these when the corresponding property value changes. Since these are changed asynchronously in the case of a platform window, we should not emit them in the setter, as they are already properly emitted in QGuiApplicationPrivate::processGeometryChangeEvent(). Change-Id: I5ac00601ddb4e7a8ff02376e5f5135d427913119 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindow.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b6d592e050..22ad748fb5 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1105,16 +1105,16 @@ void QWindow::setGeometry(const QRect &rect) d->platformWindow->setGeometry(rect); } else { d->geometry = rect; - } - if (rect.x() != oldRect.x()) - emit xChanged(rect.x()); - if (rect.y() != oldRect.y()) - emit yChanged(rect.y()); - if (rect.width() != oldRect.width()) - emit widthChanged(rect.width()); - if (rect.height() != oldRect.height()) - emit heightChanged(rect.height()); + if (rect.x() != oldRect.x()) + emit xChanged(rect.x()); + if (rect.y() != oldRect.y()) + emit yChanged(rect.y()); + if (rect.width() != oldRect.width()) + emit widthChanged(rect.width()); + if (rect.height() != oldRect.height()) + emit heightChanged(rect.height()); + } } /*! -- cgit v1.2.3 From 89f862ab10893dcfc707fa9bcdbea6fb449600ca Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Mon, 17 Dec 2012 15:20:43 +0100 Subject: Do not send QAccessible::Focus when current index is changed. This had the unfortunate side-effect that focus was reported to change (but it didn't) just because the qtabbar was shown. Found by clicking the different categories on the left-hand side of the options dialog in Qt Creator. So, what happened was that clicking "Text Editor" would move the accessibility focus (that the AT client saw) to the "Font & Colors" tab) Change-Id: I19a508f6a32a77696079d24c3c6408cb6c3d9fd5 Reviewed-by: Frederik Gladhorn --- src/widgets/widgets/qtabbar.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 8cd86dd3f1..84a1668b3c 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1182,9 +1182,11 @@ void QTabBar::setCurrentIndex(int index) d->layoutTab(index); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - QAccessibleEvent focusEvent(this, QAccessible::Focus); - focusEvent.setChild(index); - QAccessible::updateAccessibility(&focusEvent); + if (hasFocus()) { + QAccessibleEvent focusEvent(this, QAccessible::Focus); + focusEvent.setChild(index); + QAccessible::updateAccessibility(&focusEvent); + } QAccessibleEvent selectionEvent(this, QAccessible::Selection); selectionEvent.setChild(index); QAccessible::updateAccessibility(&selectionEvent); -- cgit v1.2.3 From bf5e7fb2652669599a508e049b46ebd5cd3206e5 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 4 Jan 2013 11:06:14 +0100 Subject: SSL certificates: blacklist mis-issued Turktrust certificates Those certificates have erroneously set the CA attribute to true, meaning everybody in possesion of their keys can issue certificates on their own. Task-number: QTBUG-28937 Change-Id: Iff351e590ad3e6ab802e6fa1d65a9a9a9f7683de Reviewed-by: Richard J. Moore Reviewed-by: Shane Kearns --- src/network/ssl/qsslcertificate.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 6d3a77b45f..fbe60e99bf 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -1205,6 +1205,9 @@ static const char *certificate_blacklist[] = { "4c:0e:63:6a", "Digisign Server ID - (Enrich)", // (Malaysian) Digicert Sdn. Bhd. cross-signed by Entrust "72:03:21:05:c5:0c:08:57:3d:8e:a5:30:4e:fe:e8:b0", "UTN-USERFirst-Hardware", // comodogate test certificate "41", "MD5 Collisions Inc. (http://www.phreedom.org/md5)", // http://www.phreedom.org/research/rogue-ca/ + + "08:27", "*.EGO.GOV.TR", // Turktrust mis-issued intermediate certificate + "08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate 0 }; -- cgit v1.2.3 From a094bf5a893c3cccffff10c1420bfbe3a3c02a7c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 3 Jan 2013 15:17:21 -0200 Subject: Don't increase the reference count if dynamic_cast failed If the dynamic_cast failed in QSharedPointer::dynamicCast or qSharedPointerDynamicCast, we should avoid creating the QSharedPointer that shares the weak and strong reference counts. In Qt 5, this does not imply a leak since the original pointer is stored internally for deletion. In Qt 4 it implies a leak under certain circumstances, which this change fixes. Task-number: QTBUG-28924 Change-Id: Id2de140de4cf676461e14b201ad250c53666b79d Reviewed-by: Olivier Goffart --- src/corelib/tools/qsharedpointer_impl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 6f3e577e55..cce48e0d07 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -786,6 +786,8 @@ template Q_INLINE_TEMPLATE QSharedPointer qSharedPointerDynamicCast(const QSharedPointer &src) { register X *ptr = dynamic_cast(src.data()); // if you get an error in this line, the cast is invalid + if (!ptr) + return QSharedPointer(); return QtSharedPointer::copyAndSetPointer(ptr, src); } template -- cgit v1.2.3 From faaaa68db4d36efa239025fc6f9bdbe5d1112eff Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 2 Jan 2013 17:28:43 -0200 Subject: Remove redundant Q_OS_BLACKBERRY define check. Q_OS_QNX is always implied by Q_OS_BLACKBERRY Change-Id: Ic07a967ab9a45b3c6c088aa8399bab823b9a413e Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 7fae3d9dbc..f65fa01538 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -693,7 +693,7 @@ #endif /* Q_CC_MSVC */ #ifdef __cplusplus -# if defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX) +# if defined(Q_OS_QNX) # include # if defined(_YVALS) || defined(_LIBCPP_VER) // QNX: libcpp (Dinkumware-based) doesn't have the @@ -704,7 +704,7 @@ # endif # endif # endif -#endif // Q_OS_BLACKBERRY || Q_OS_QNX +#endif // Q_OS_QNX /* * C++11 keywords and expressions -- cgit v1.2.3 From fbd3cd867952a43d008dcfe6ae5657387603283a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 4 Jan 2013 15:04:54 +0100 Subject: remove unused member from QSystemLocalePrivate This is a refactoring leftover from commit bb86e77cc437b92d49692bb7026c57626d77079f in qt/qt.git. Change-Id: I04993faca44ad0ffca2ae163049770c29d232a47 Reviewed-by: Zeno Albisser Reviewed-by: Denis Dzyubenko --- src/corelib/tools/qlocale_win.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index ec9db24b57..a61f9b39fe 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -113,8 +113,6 @@ struct QSystemLocalePrivate void update(); private: - QByteArray langEnvVar; - enum SubstitutionType { SUnknown, SContext, @@ -142,7 +140,6 @@ Q_GLOBAL_STATIC(QSystemLocalePrivate, systemLocalePrivate) QSystemLocalePrivate::QSystemLocalePrivate() : substitutionType(SUnknown) { - langEnvVar = qgetenv("LANG"); lcid = GetUserDefaultLCID(); } -- cgit v1.2.3 From 91a55c7e7d15ca67d162af52e2332de2d1003490 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 2 Jan 2013 16:14:30 -0200 Subject: Disable Q_COMPILER_RVALUE_REFS on QNX std::forward and std::move are not yet supported by the NDK. Change-Id: I1df1b5e88717c0d27a280862b98eb68262927f2b Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index f65fa01538..0ba0d9be63 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -702,6 +702,9 @@ # ifdef Q_COMPILER_INITIALIZER_LISTS # undef Q_COMPILER_INITIALIZER_LISTS # endif +# ifdef Q_COMPILER_RVALUE_REFS +# undef Q_COMPILER_RVALUE_REFS +# endif # endif # endif #endif // Q_OS_QNX -- cgit v1.2.3