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/plugins/platforms') 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 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/plugins/platforms') 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/plugins/platforms') 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 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/plugins/platforms') 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 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/plugins/platforms') 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/plugins/platforms') 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