summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>2013-01-07 16:57:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-07 18:07:29 +0100
commitae2359d49e171c61450b17b1eb0e0dd7a20c7ca4 (patch)
treefbf5ef281002a47659d80405ae38f48b57e19c22 /src/plugins/platforms
parent998899cf3a2501d3bf30ad06ce47a2cf81e1d60b (diff)
parentcdf13ce286b14273e1e29c5bb02cbc880f31b786 (diff)
Merge "Merge branch 'stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm19
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp25
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.h4
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp1
9 files changed, 50 insertions, 28 deletions
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<QPlatformScreen *> 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
{
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<QQnxWindow*>(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 &region, const
if (window)
targetWindow = static_cast<QQnxWindow *>(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 &region, 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 &region, 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 &region)
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
m_hasUnflushedPaintOperations = true;
- m_platformWindow->adjustBufferSize();
+ platformWindow()->adjustBufferSize();
}
void QQnxRasterBackingStore::endPaint(const QRegion &region)
@@ -186,4 +187,10 @@ void QQnxRasterBackingStore::endPaint(const QRegion &region)
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
}
+QQnxWindow *QQnxRasterBackingStore::platformWindow() const
+{
+ Q_ASSERT(m_window->handle());
+ return static_cast<QQnxWindow*>(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<ScrollOp> m_scrollOpList;
bool m_hasUnflushedPaintOperations;
};
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;
}
}
}
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 &region,
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();
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);
}
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<QEGLPlatformContext *>(context->handle());
return eglPlatformContext->eglContext();
#else
+ Q_UNUSED(context);
return 0;
#endif
}