summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/global/qlogging.cpp42
-rw-r--r--src/corelib/global/qnamespace.qdoc38
-rw-r--r--src/gui/accessible/qaccessiblecache_mac.mm6
-rw-r--r--src/gui/accessible/qaccessiblecache_p.h10
-rw-r--r--src/gui/opengl/qopengltexture.cpp5
-rw-r--r--src/network/kernel/qdnslookup_winrt.cpp7
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h11
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h21
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm28
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm18
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp25
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.h4
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp8
-rw-r--r--src/plugins/platforms/windows/qplatformfunctions_wince.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp49
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp1
-rw-r--r--src/widgets/kernel/qwidget.cpp4
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm22
23 files changed, 178 insertions, 143 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 2bc52c6150..5210d80953 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Copyright (C) 2012 Intel Corporation.
+** Copyright (C) 2014 Intel Corporation.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -59,7 +59,7 @@
#include <QtCore/qconfig.h>
#include <QtCore/qfeatures.h>
#endif
-#if defined(Q_CC_MSVC) && _MSC_VER <= 1500 /* VS2008 */
+#ifdef _MSC_VER
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else
# define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE))
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index f908dd512e..5b4726f67d 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1100,8 +1100,13 @@ typedef void (*QtMsgHandler)(QtMsgType, const char *);
Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
#endif
-static QtMsgHandler msgHandler = 0; // pointer to debug handler (without context)
-static QtMessageHandler messageHandler = 0; // pointer to debug handler (with context)
+static void qDefaultMsgHandler(QtMsgType type, const char *buf);
+static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &buf);
+
+// pointer to QtMsgHandler debug handler (without context)
+static QBasicAtomicPointer<void (QtMsgType, const char*)> msgHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMsgHandler);
+// pointer to QtMessageHandler debug handler (with context)
+static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QString &)> messageHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMessageHandler);
#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED)
static void systemd_default_message_handler(QtMsgType type,
@@ -1267,20 +1272,15 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex
}
#endif
- if (!msgHandler)
- msgHandler = qDefaultMsgHandler;
- if (!messageHandler)
- messageHandler = qDefaultMessageHandler;
-
// prevent recursion in case the message handler generates messages
// itself, e.g. by using Qt API
if (grabMessageHandler()) {
// prefer new message handler over the old one
- if (msgHandler == qDefaultMsgHandler
- || messageHandler != qDefaultMessageHandler) {
- (*messageHandler)(msgType, context, message);
+ if (msgHandler.load() == qDefaultMsgHandler
+ || messageHandler.load() != qDefaultMessageHandler) {
+ (*messageHandler.load())(msgType, context, message);
} else {
- (*msgHandler)(msgType, message.toLocal8Bit().constData());
+ (*msgHandler.load())(msgType, message.toLocal8Bit().constData());
}
ungrabMessageHandler();
} else {
@@ -1485,22 +1485,18 @@ void qErrnoWarning(int code, const char *msg, ...)
QtMessageHandler qInstallMessageHandler(QtMessageHandler h)
{
- if (!messageHandler)
- messageHandler = qDefaultMessageHandler;
- QtMessageHandler old = messageHandler;
- messageHandler = h;
- return old;
+ if (!h)
+ h = qDefaultMessageHandler;
+ //set 'h' and return old message handler
+ return messageHandler.fetchAndStoreRelaxed(h);
}
QtMsgHandler qInstallMsgHandler(QtMsgHandler h)
{
- //if handler is 0, set it to the
- //default message handler
- if (!msgHandler)
- msgHandler = qDefaultMsgHandler;
- QtMsgHandler old = msgHandler;
- msgHandler = h;
- return old;
+ if (!h)
+ h = qDefaultMsgHandler;
+ //set 'h' and return old message handler
+ return msgHandler.fetchAndStoreRelaxed(h);
}
void qSetMessagePattern(const QString &pattern)
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 873c1bf0cc..e5c708e29a 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -306,7 +306,7 @@
This enum provides shorter names for the keyboard modifier keys
supported by Qt.
- \b{Note:} On Mac OS X, the \c CTRL value corresponds to
+ \note On Mac OS X, the \c CTRL value corresponds to
the Command keys on the Macintosh keyboard, and the \c META value
corresponds to the Control keys.
@@ -986,7 +986,7 @@
\value WA_NoSystemBackground Indicates that the widget has no background,
i.e. when the widget receives paint events, the background is not
- automatically repainted. \note Unlike WA_OpaquePaintEvent, newly exposed
+ automatically repainted. \b Note: Unlike WA_OpaquePaintEvent, newly exposed
areas are \b never filled with the background (e.g., after showing a
window for the first time the user can see "through" it until the
application processes the paint events). This flag is set or cleared by the
@@ -998,7 +998,7 @@
before generating paint events. The use of WA_OpaquePaintEvent provides a
small optimization by helping to reduce flicker on systems that do not
support double buffering and avoiding computational cycles necessary to
- erase the background prior to painting. \note Unlike
+ erase the background prior to painting. \b Note: Unlike
WA_NoSystemBackground, WA_OpaquePaintEvent makes an effort to avoid
transparent window backgrounds. This flag is set or cleared by the widget's
author.
@@ -1011,7 +1011,7 @@
\value WA_PaintOnScreen Indicates that the widget wants to draw directly
onto the screen. Widgets with this attribute set do not participate in
composition management, i.e. they cannot be semi-transparent or shine
- through semi-transparent overlapping widgets. \note This flag is only
+ through semi-transparent overlapping widgets. \b Note: This flag is only
supported on X11 and it disables double buffering. On Qt for Embedded
Linux, the flag only works when set on a top-level widget and it relies on
support from the active screen driver. This flag is set or cleared by the
@@ -1082,7 +1082,7 @@
\value WA_UpdatesDisabled Indicates that updates are blocked (including the
system background). This flag is set or cleared by the Qt kernel.
- \warning This flag must \e never be set or cleared by the widget's author.
+ \b Warning: This flag must \e never be set or cleared by the widget's author.
\value WA_WindowModified Indicates that the window is marked as modified.
On some platforms this flag will do nothing, on others (including Mac OS X
@@ -1124,50 +1124,50 @@
\value WA_X11NetWmWindowTypeToolBar Adds _NET_WM_WINDOW_TYPE_TOOLBAR to the
window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute for QToolBar.
\value WA_X11NetWmWindowTypeMenu Adds _NET_WM_WINDOW_TYPE_MENU to the
window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute for QMenu when torn-off.
\value WA_X11NetWmWindowTypeUtility Adds _NET_WM_WINDOW_TYPE_UTILITY to the
window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute for the Qt::Tool window type.
\value WA_X11NetWmWindowTypeSplash Adds _NET_WM_WINDOW_TYPE_SPLASH to the
window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute for the Qt::SplashScreen window type.
\value WA_X11NetWmWindowTypeDialog Adds _NET_WM_WINDOW_TYPE_DIALOG
to the window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This
- attribute has no effect on non-X11 platforms. \note Qt automatically sets
+ attribute has no effect on non-X11 platforms. \b Note: Qt automatically sets
this attribute for the Qt::Dialog and Qt::Sheet window types.
\value WA_X11NetWmWindowTypeDropDownMenu Adds
_NET_WM_WINDOW_TYPE_DROPDOWN_MENU to the window's
_NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This
- attribute has no effect on non-X11 platforms. \note Qt
+ attribute has no effect on non-X11 platforms. \b Note: Qt
automatically sets this attribute for QMenus added to a QMenuBar.
\value WA_X11NetWmWindowTypePopupMenu Adds _NET_WM_WINDOW_TYPE_POPUP_MENU
to the window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute for QMenu.
\value WA_X11NetWmWindowTypeToolTip Adds _NET_WM_WINDOW_TYPE_TOOLTIP to the
window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute for the Qt::ToolTip window type.
\value WA_X11NetWmWindowTypeNotification Adds
@@ -1178,13 +1178,13 @@
\value WA_X11NetWmWindowTypeCombo Adds _NET_WM_WINDOW_TYPE_COMBO
to the window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute for the QComboBox pop-up.
\value WA_X11NetWmWindowTypeDND Adds _NET_WM_WINDOW_TYPE_DND to
the window's _NET_WM_WINDOW_TYPE X11 window property. See
http://standards.freedesktop.org/wm-spec/ for more details. This attribute
- has no effect on non-X11 platforms. \note Qt automatically sets this
+ has no effect on non-X11 platforms. \b Note: Qt automatically sets this
attribute on the feedback widget used during a drag.
\value WA_MacFrameworkScaled Enables resolution independence aware mode
@@ -1255,7 +1255,7 @@
\value Key_Enter Typically located on the keypad.
\value Key_Insert
\value Key_Delete
- \value Key_Pause The Pause/Break key (\note Not anything to do with pausing media)
+ \value Key_Pause The Pause/Break key (\b Note: Not related to pausing media)
\value Key_Print
\value Key_SysReq
\value Key_Clear
@@ -1526,7 +1526,7 @@
\value Key_MediaPrevious
\value Key_MediaNext
\value Key_MediaRecord
- \value Key_MediaPause A key setting the state of the media player to pause (\note not the pause/break key)
+ \value Key_MediaPause A key setting the state of the media player to pause (\b Note: not the pause/break key)
\value Key_MediaTogglePlayPause A key to toggle the play/pause state in the media player (rather than setting an absolute state)
\value Key_HomePage
\value Key_Favorites
@@ -2868,7 +2868,7 @@
The keypad is used to implement a virtual cursor, unless
the device has an analog mouse type of input device (e.g. touchpad)
- \note: in 4.6, cursor navigation is only implemented for Symbian OS.
+ \note In 4.6, cursor navigation is only implemented for Symbian OS.
On other platforms, it behaves as NavigationModeNone.
\sa QApplication::setNavigationMode()
\sa QApplication::navigationMode()
diff --git a/src/gui/accessible/qaccessiblecache_mac.mm b/src/gui/accessible/qaccessiblecache_mac.mm
index bc6d0712d6..97c0c7e097 100644
--- a/src/gui/accessible/qaccessiblecache_mac.mm
+++ b/src/gui/accessible/qaccessiblecache_mac.mm
@@ -43,19 +43,19 @@
QT_BEGIN_NAMESPACE
-void QAccessibleCache::insertElement(QAccessible::Id axid, QMacAccessibilityElement *element) const
+void QAccessibleCache::insertElement(QAccessible::Id axid, QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *element) const
{
cocoaElements[axid] = element;
}
void QAccessibleCache::removeCocoaElement(QAccessible::Id axid)
{
- QMacAccessibilityElement *element = elementForId(axid);
+ QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *element = elementForId(axid);
[element invalidate];
cocoaElements.remove(axid);
}
-QMacAccessibilityElement *QAccessibleCache::elementForId(QAccessible::Id axid) const
+QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *QAccessibleCache::elementForId(QAccessible::Id axid) const
{
return cocoaElements.value(axid);
}
diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h
index 3ca62709b1..643cbe5667 100644
--- a/src/gui/accessible/qaccessiblecache_p.h
+++ b/src/gui/accessible/qaccessiblecache_p.h
@@ -59,9 +59,7 @@
#include "qaccessible.h"
-#ifdef Q_OS_MAC
- Q_FORWARD_DECLARE_OBJC_CLASS(QMacAccessibilityElement);
-#endif
+Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QMacAccessibilityElement));
QT_BEGIN_NAMESPACE
@@ -76,8 +74,8 @@ public:
void deleteInterface(QAccessible::Id id, QObject *obj = 0);
#ifdef Q_OS_MAC
- QMacAccessibilityElement *elementForId(QAccessible::Id axid) const;
- void insertElement(QAccessible::Id axid, QMacAccessibilityElement *element) const;
+ QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *elementForId(QAccessible::Id axid) const;
+ void insertElement(QAccessible::Id axid, QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *element) const;
#endif
private Q_SLOTS:
@@ -91,7 +89,7 @@ private:
#ifdef Q_OS_MAC
void removeCocoaElement(QAccessible::Id axid);
- mutable QHash<QAccessible::Id, QMacAccessibilityElement *> cocoaElements;
+ mutable QHash<QAccessible::Id, QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *> cocoaElements;
#endif
friend class QAccessible;
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index b64956c65c..06a71af552 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -2812,9 +2812,8 @@ bool QOpenGLTexture::hasFeature(Feature feature)
break;
case TextureBuffer:
- supported = f.version() >= qMakePair(4, 3)
- || (ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object"))
- && ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_range")));
+ supported = f.version() >= qMakePair(3, 0)
+ || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object"));
break;
case StencilTexturing:
diff --git a/src/network/kernel/qdnslookup_winrt.cpp b/src/network/kernel/qdnslookup_winrt.cpp
index 3a84279af6..52a8c3a530 100644
--- a/src/network/kernel/qdnslookup_winrt.cpp
+++ b/src/network/kernel/qdnslookup_winrt.cpp
@@ -116,6 +116,8 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
unsigned int size;
endpointPairs->get_Size(&size);
+ // endpoint pairs might contain duplicates so we temporarily store addresses in a QSet
+ QSet<QHostAddress> addresses;
for (unsigned int i = 0; i < size; ++i) {
ComPtr<IEndpointPair> endpointpair;
endpointPairs->GetAt(i, &endpointpair);
@@ -133,9 +135,12 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
remoteHost->get_CanonicalName(name.GetAddressOf());
UINT32 length;
PCWSTR rawString = name.GetRawBuffer(&length);
+ addresses.insert(QHostAddress(QString::fromWCharArray(rawString, length)));
+ }
+ foreach (const QHostAddress &address, addresses) {
QDnsHostAddressRecord record;
record.d->name = aceHostname;
- record.d->value = QHostAddress(QString::fromWCharArray(rawString, length));
+ record.d->value = address;
reply->hostAddressRecords.append(record);
}
}
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
index ca34deceef..4a5baefbc5 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
@@ -43,22 +43,25 @@
#include <QtCore/qglobal.h>
+#include "qt_mac_p.h"
+
#import <Cocoa/Cocoa.h>
#import <AppKit/NSAccessibility.h>
#import <qaccessible.h>
-Q_FORWARD_DECLARE_OBJC_CLASS(QMacAccessibilityElement);
+@class QT_MANGLE_NAMESPACE(QMacAccessibilityElement);
-@interface QMacAccessibilityElement : NSObject {
+@interface QT_MANGLE_NAMESPACE(QMacAccessibilityElement) : NSObject {
NSString *role;
QAccessible::Id axid;
}
- (id)initWithId:(QAccessible::Id)anId;
-+ (QMacAccessibilityElement *)elementWithId:(QAccessible::Id)anId;
++ (QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *)elementWithId:(QAccessible::Id)anId;
@end
-#endif
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacAccessibilityElement);
+#endif
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 2f5355b180..efe3269d42 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -433,7 +433,7 @@ static void cleanupCocoaApplicationDelegate()
{
Q_UNUSED(replyEvent);
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
- QWindowSystemInterface::handleFileOpenEvent(QCFString::toQString(urlString));
+ QWindowSystemInterface::handleFileOpenEvent(QUrl(QCFString::toQString(urlString)));
}
- (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 32692edde4..4b9a0146a9 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -329,12 +329,13 @@ NSMenuItem *QCocoaMenuItem::sync()
[m_native setKeyEquivalentModifierMask:NSCommandKeyMask];
}
+ NSImage *img = nil;
if (!m_icon.isNull()) {
- NSImage *img = qt_mac_create_nsimage(m_icon);
+ img = qt_mac_create_nsimage(m_icon);
[img setSize:NSMakeSize(16, 16)];
- [m_native setImage: img];
- [img release];
}
+ [m_native setImage:img];
+ [img release];
[m_native setState:m_checked ? NSOnState : NSOffState];
return m_native;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 66a81b0d9f..8f885ab5f3 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -51,14 +51,15 @@
#include "qcocoaglcontext.h"
#endif
#include "qnsview.h"
+#include "qt_mac_p.h"
QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
-@class QNSWindowHelper;
+@class QT_MANGLE_NAMESPACE(QNSWindowHelper);
@protocol QNSWindowProtocol
-@property (nonatomic, readonly) QNSWindowHelper *helper;
+@property (nonatomic, readonly) QT_MANGLE_NAMESPACE(QNSWindowHelper) *helper;
- (void)superSendEvent:(NSEvent *)theEvent;
- (void)closeAndRelease;
@@ -67,7 +68,7 @@ QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
-@interface QNSWindowHelper : NSObject
+@interface QT_MANGLE_NAMESPACE(QNSWindowHelper) : NSObject
{
QCocoaNSWindow *_window;
QCocoaWindow *_platformWindow;
@@ -86,7 +87,9 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
@end
-@interface QNSWindow : NSWindow<QNSWindowProtocol>
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowHelper);
+
+@interface QT_MANGLE_NAMESPACE(QNSWindow) : NSWindow<QNSWindowProtocol>
{
QNSWindowHelper *_helper;
}
@@ -99,7 +102,9 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
@end
-@interface QNSPanel : NSPanel<QNSWindowProtocol>
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindow);
+
+@interface QT_MANGLE_NAMESPACE(QNSPanel) : NSPanel<QNSWindowProtocol>
{
QNSWindowHelper *_helper;
}
@@ -112,7 +117,9 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
@end
-@class QNSWindowDelegate;
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSPanel);
+
+@class QT_MANGLE_NAMESPACE(QNSWindowDelegate);
QT_BEGIN_NAMESPACE
// QCocoaWindow
@@ -227,6 +234,7 @@ public:
void obscureWindow();
void updateExposedGeometry();
QWindow *childWindowAt(QPoint windowPoint);
+ bool shouldRefuseKeyWindowAndFirstResponder();
protected:
void recreateWindow(const QPlatformWindow *parentWindow);
QCocoaNSWindow *createNSWindow();
@@ -267,6 +275,7 @@ public: // for QNSView
bool m_windowUnderMouse;
bool m_inConstructor;
+ bool m_inSetVisible;
#ifndef QT_NO_OPENGL
QCocoaGLContext *m_glContext;
#endif
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index a7ebf4148c..29b983cd89 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -239,6 +239,9 @@ static bool isMouseEvent(NSEvent *ev)
if (!pw || pw->m_isNSWindowChild)
return NO;
+ if (pw->shouldRefuseKeyWindowAndFirstResponder())
+ return NO;
+
// The default implementation returns NO for title-bar less windows,
// override and return yes here to make sure popup windows such as
// the combobox popup can become the key window.
@@ -316,6 +319,9 @@ static bool isMouseEvent(NSEvent *ev)
if (!pw)
return NO;
+ if (pw->shouldRefuseKeyWindowAndFirstResponder())
+ return NO;
+
// Only tool or dialog windows should become key:
Qt::WindowType type = pw->window()->type();
if (type == Qt::Tool || type == Qt::Dialog)
@@ -368,6 +374,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_windowModality(Qt::NonModal)
, m_windowUnderMouse(false)
, m_inConstructor(true)
+ , m_inSetVisible(false)
#ifndef QT_NO_OPENGL
, m_glContext(0)
#endif
@@ -616,6 +623,8 @@ void QCocoaWindow::setVisible(bool visible)
if (m_isNSWindowChild && m_hiddenByClipping)
return;
+ m_inSetVisible = true;
+
QCocoaAutoReleasePool pool;
QCocoaWindow *parentCocoaWindow = 0;
if (window()->transientParent())
@@ -755,6 +764,8 @@ void QCocoaWindow::setVisible(bool visible)
[parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
}
}
+
+ m_inSetVisible = false;
}
NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags)
@@ -1784,6 +1795,23 @@ QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint)
return targetWindow;
}
+bool QCocoaWindow::shouldRefuseKeyWindowAndFirstResponder()
+{
+ // This function speaks up if there's any reason
+ // to refuse key window or first responder state.
+
+ if (window()->flags() & Qt::WindowDoesNotAcceptFocus)
+ return true;
+
+ if (m_inSetVisible) {
+ QVariant showWithoutActivating = window()->property("_q_showWithoutActivating");
+ if (showWithoutActivating.isValid() && showWithoutActivating.toBool())
+ return true;
+ }
+
+ return false;
+}
+
QMargins QCocoaWindow::frameMargins() const
{
NSRect frameW = [m_nsWindow frame];
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 53eee4a95d..a75e366a73 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -65,6 +65,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper);
QWindow *m_window;
QCocoaWindow *m_platformWindow;
Qt::MouseButtons m_buttons;
+ Qt::MouseButtons m_frameStrutButtons;
QString m_composingText;
bool m_sendKeyEvent;
QStringList *currentCustomDragTypes;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 4a562f8a4e..cc8fe51e0f 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -142,6 +142,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
m_shouldInvalidateWindowShadow = false;
m_window = 0;
m_buttons = Qt::NoButton;
+ m_frameStrutButtons = Qt::NoButton;
m_sendKeyEvent = false;
m_subscribesForGlobalFrameNotifications = false;
#ifndef QT_NO_OPENGL
@@ -603,7 +604,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
- (BOOL)acceptsFirstResponder
{
- if (m_window->flags() & Qt::WindowDoesNotAcceptFocus)
+ if (m_platformWindow->shouldRefuseKeyWindowAndFirstResponder())
return NO;
if (m_window->flags() & Qt::WindowTransparentForInput)
return NO;
@@ -661,6 +662,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
- (void)resetMouseButtons
{
m_buttons = Qt::NoButton;
+ m_frameStrutButtons = Qt::NoButton;
}
- (void)handleMouseEvent:(NSEvent *)theEvent
@@ -693,22 +695,22 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
NSEventType ty = [theEvent type];
switch (ty) {
case NSLeftMouseDown:
- m_buttons |= Qt::LeftButton;
+ m_frameStrutButtons |= Qt::LeftButton;
break;
case NSLeftMouseUp:
- m_buttons &= ~Qt::LeftButton;
+ m_frameStrutButtons &= ~Qt::LeftButton;
break;
case NSRightMouseDown:
- m_buttons |= Qt::RightButton;
+ m_frameStrutButtons |= Qt::RightButton;
break;
case NSRightMouseUp:
- m_buttons &= ~Qt::RightButton;
+ m_frameStrutButtons &= ~Qt::RightButton;
break;
case NSOtherMouseDown:
- m_buttons |= cocoaButton2QtButton([theEvent buttonNumber]);
+ m_frameStrutButtons |= cocoaButton2QtButton([theEvent buttonNumber]);
break;
case NSOtherMouseUp:
- m_buttons &= ~cocoaButton2QtButton([theEvent buttonNumber]);
+ m_frameStrutButtons &= ~cocoaButton2QtButton([theEvent buttonNumber]);
default:
break;
}
@@ -726,7 +728,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
ulong timestamp = [theEvent timestamp] * 1000;
- QWindowSystemInterface::handleFrameStrutMouseEvent(m_window, timestamp, qtWindowPoint, qtScreenPoint, m_buttons);
+ QWindowSystemInterface::handleFrameStrutMouseEvent(m_window, timestamp, qtWindowPoint, qtScreenPoint, m_frameStrutButtons);
}
- (void)mouseDown:(NSEvent *)theEvent
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h
index 5717551cc3..083466861b 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.h
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h
@@ -46,7 +46,7 @@
#include "qcocoawindow.h"
-@interface QNSWindowDelegate : NSObject <NSWindowDelegate>
+@interface QT_MANGLE_NAMESPACE(QNSWindowDelegate) : NSObject <NSWindowDelegate>
{
QCocoaWindow *m_cocoaWindow;
}
@@ -62,4 +62,6 @@
@end
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowDelegate);
+
#endif // QNSWINDOWDELEGATE_H
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 9ba0f5cd2e..add45ecbe5 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -286,6 +286,18 @@ Qt::ScreenOrientation QQnxScreen::orientation() const
return orient;
}
+QWindow *QQnxScreen::topLevelAt(const QPoint &point) const
+{
+ QListIterator<QQnxWindow*> it(m_childWindows);
+ it.toBack();
+ while (it.hasPrevious()) {
+ QWindow *win = it.previous()->window();
+ if (win->geometry().contains(point))
+ return win;
+ }
+ return 0;
+}
+
/*!
Check if the supplied angles are perpendicular to each other.
*/
@@ -767,17 +779,4 @@ void QQnxScreen::setRootWindow(QQnxWindow *window)
m_rootWindow = window;
}
-QWindow * QQnxScreen::topMostChildWindow() const
-{
- if (!m_childWindows.isEmpty()) {
-
- // We're picking up the last window of the list here
- // because this list is ordered by stacking order.
- // Last window is effectively the one on top.
- return m_childWindows.last()->window();
- }
-
- return 0;
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h
index a0b760135f..6b2281f7b9 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.h
+++ b/src/plugins/platforms/qnx/qqnxscreen.h
@@ -73,6 +73,8 @@ public:
Qt::ScreenOrientation nativeOrientation() const;
Qt::ScreenOrientation orientation() const;
+ QWindow *topLevelAt(const QPoint &point) const;
+
bool isPrimaryScreen() const { return m_primaryScreen; }
int rotation() const { return m_currentRotation; }
@@ -124,8 +126,6 @@ private:
void addMultimediaWindow(const QByteArray &id, screen_window_t window);
void removeOverlayOrUnderlayWindow(screen_window_t window);
- QWindow *topMostChildWindow() const;
-
screen_context_t m_screenContext;
screen_display_t m_display;
QQnxWindow *m_rootWindow;
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 9a17f807a9..082ddf625a 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -502,13 +502,11 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexIn
if (!indexInParent)
return E_INVALIDARG;
QAccessibleInterface *par = accessible->parent();
- if (!par) {
- *indexInParent = -1;
+ *indexInParent = par ? par->indexOfChild(accessible) : -1;
+ if (*indexInParent < 0) {
+ qCWarning(lcQpaAccessibility) << "index in parent invalid:" << accessible << "parent:" << par;
return S_FALSE;
}
- int indexOfChild = par->indexOfChild(accessible);
- Q_ASSERT(indexOfChild >= 0);
- *indexInParent = indexOfChild;
return S_OK;
}
diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h
index 921e64d64c..47b03b29cc 100644
--- a/src/plugins/platforms/windows/qplatformfunctions_wince.h
+++ b/src/plugins/platforms/windows/qplatformfunctions_wince.h
@@ -86,8 +86,10 @@
#define HWND_MESSAGE 0
#endif
+// Real Value would be 0x40000000, but if we pass this to Windows Embedded Compact
+// he blits it wrongly, so lets not do any harm and define it to 0
#ifndef CAPTUREBLT
-#define CAPTUREBLT (DWORD)0x40000000
+#define CAPTUREBLT (DWORD)0x0
#endif
#define SW_SHOWMINIMIZED SW_MINIMIZE
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index a574dcae6c..cf809b37e5 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -251,14 +251,13 @@ void QXcbConnection::xi2Select(xcb_window_t window)
XIEventMask mask;
mask.mask_len = sizeof(bitMask);
mask.mask = xiBitMask;
- // Enable each touchscreen
- foreach (XInput2DeviceData *dev, m_touchDevices) {
- mask.deviceid = dev->xiDeviceInfo->deviceid;
+ if (!m_touchDevices.isEmpty()) {
+ mask.deviceid = XIAllMasterDevices;
Status result = XISelectEvents(xDisplay, window, &mask, 1);
- // If we have XInput >= 2.2 and successfully enable a touchscreen, then
- // it will provide touch only. In most other cases, there will be
- // emulated mouse events from the driver. If not, then Qt must do its
- // own mouse emulation to enable interaction with mouse-oriented QWidgets.
+ // If we select for touch events on the master pointer, XInput2
+ // will not synthesize mouse events. This means Qt must do it,
+ // which is also preferable, since Qt can control better when
+ // to do so.
if (m_xi2Minor >= 2 && result == Success)
has_touch_without_mouse_emulation = true;
}
@@ -272,10 +271,10 @@ void QXcbConnection::xi2Select(xcb_window_t window)
// similar handlers useless and we have no intention to infect
// all the pure xcb code with Xlib-based XI2.
if (!m_tabletData.isEmpty()) {
- unsigned int tabletBitMask = bitMask;
+ unsigned int tabletBitMask;
unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask);
QVector<XIEventMask> xiEventMask(m_tabletData.count());
- tabletBitMask |= XI_ButtonPressMask;
+ tabletBitMask = XI_ButtonPressMask;
tabletBitMask |= XI_ButtonReleaseMask;
tabletBitMask |= XI_MotionMask;
tabletBitMask |= XI_PropertyEventMask;
@@ -294,24 +293,18 @@ void QXcbConnection::xi2Select(xcb_window_t window)
// Enable each scroll device
if (!m_scrollingDevices.isEmpty()) {
QVector<XIEventMask> xiEventMask(m_scrollingDevices.size());
- unsigned int scrollBitMask = 0;
+ unsigned int scrollBitMask;
unsigned char *xiScrollBitMask = reinterpret_cast<unsigned char *>(&scrollBitMask);
+
scrollBitMask = XI_MotionMask;
scrollBitMask |= XI_ButtonReleaseMask;
- bitMask |= XI_MotionMask;
- bitMask |= XI_ButtonReleaseMask;
int i=0;
Q_FOREACH (const ScrollingDevice& scrollingDevice, m_scrollingDevices) {
if (tabletDevices.contains(scrollingDevice.deviceId))
continue; // All necessary events are already captured.
xiEventMask[i].deviceid = scrollingDevice.deviceId;
- if (m_touchDevices.contains(scrollingDevice.deviceId)) {
- xiEventMask[i].mask_len = sizeof(bitMask);
- xiEventMask[i].mask = xiBitMask;
- } else {
- xiEventMask[i].mask_len = sizeof(scrollBitMask);
- xiEventMask[i].mask = xiScrollBitMask;
- }
+ xiEventMask[i].mask_len = sizeof(scrollBitMask);
+ xiEventMask[i].mask = xiScrollBitMask;
i++;
}
XISelectEvents(xDisplay, window, xiEventMask.data(), i);
@@ -458,7 +451,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y) );
if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) {
- XInput2DeviceData *dev = deviceForId(xiEvent->deviceid);
+ XInput2DeviceData *dev = deviceForId(xiDeviceEvent->sourceid);
Q_ASSERT(dev);
const bool firstTouch = m_touchPoints.isEmpty();
if (xiEvent->evtype == XI_TouchBegin) {
@@ -563,22 +556,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
qDebug() << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition <<
" area " << touchPoint.area << " pressure " << touchPoint.pressure;
QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiEvent->time, dev->qtTouchDevice, m_touchPoints.values());
- if (has_touch_without_mouse_emulation) {
- // We need to grab the touch event to prevent mouse emulation.
- if (xiEvent->evtype == XI_TouchBegin) {
- XIEventMask xieventmask;
- unsigned int bitMask = 0;
- unsigned char *xiBitMask = reinterpret_cast<unsigned char *>(&bitMask);
- xieventmask.deviceid = xiEvent->deviceid;
- xieventmask.mask = xiBitMask;
- xieventmask.mask_len = sizeof(bitMask);
- bitMask |= XI_TouchBeginMask;
- bitMask |= XI_TouchUpdateMask;
- bitMask |= XI_TouchEndMask;
- XIGrabDevice(static_cast<Display *>(m_xlib_display), xiEvent->deviceid, platformWindow->winId(), xiEvent->time, None, GrabModeAsync, GrabModeAsync, true, &xieventmask);
- } else if (xiEvent->evtype == XI_TouchEnd)
- XIUngrabDevice(static_cast<Display *>(m_xlib_display), xiEvent->deviceid, xiEvent->time);
- }
if (touchPoint.state == Qt::TouchPointReleased)
// If a touchpoint was released, we can forget it, because the ID won't be reused.
m_touchPoints.remove(touchPoint.id);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index dd3084e402..f002d473b7 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1347,6 +1347,7 @@ void QXcbWindow::setWindowTitle(const QString &title)
8,
ba.length(),
ba.constData()));
+ xcb_flush(xcb_connection());
}
void QXcbWindow::setWindowIcon(const QIcon &icon)
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 52d39759dc..c17f5c6e2e 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1411,6 +1411,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->setProperty(propertyName, q->property(propertyName));
}
+#ifdef Q_OS_OSX
+ if (q->testAttribute(Qt::WA_ShowWithoutActivating))
+ win->setProperty("_q_showWithoutActivating", QVariant(true));
+#endif
win->setFlags(data.window_flags);
fixPosIncludesFrame();
if (q->testAttribute(Qt::WA_Moved)
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index f03a7796d9..531f538820 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -100,13 +100,14 @@
QT_USE_NAMESPACE
-@interface NotificationReceiver : NSObject {
+@interface QT_MANGLE_NAMESPACE(NotificationReceiver) : NSObject {
QMacStylePrivate *mPrivate;
}
- (id)initWithPrivate:(QMacStylePrivate *)priv;
- (void)scrollBarStyleDidChange:(NSNotification *)notification;
@end
+QT_NAMESPACE_ALIAS_OBJC_CLASS(NotificationReceiver);
@implementation NotificationReceiver
- (id)initWithPrivate:(QMacStylePrivate *)priv
@@ -4045,11 +4046,20 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
break;
case CE_FocusFrame: {
- int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w) + 1;
- int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w) + 1;
- HIRect hirect = CGRectMake(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff,
- opt->rect.height() - 2 * yOff);
- HIThemeDrawFocusRect(&hirect, true, QMacCGContext(p), kHIThemeOrientationNormal);
+ int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w);
+ int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w);
+ NSRect rect = NSMakeRect(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff,
+ opt->rect.height() - 2 * yOff);
+ CGContextSaveGState(cg);
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext
+ graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]];
+ [NSGraphicsContext saveGraphicsState];
+ NSSetFocusRingStyle(NSFocusRingOnly);
+ NSBezierPath *focusFramePath = [NSBezierPath bezierPathWithRect:rect];
+ [focusFramePath setClip]; // Clear clip path to avoid artifacts when rendering the cursor at zero pos
+ [focusFramePath fill];
+ [NSGraphicsContext restoreGraphicsState];
+ CGContextRestoreGState(cg);
break; }
case CE_MenuItem:
case CE_MenuEmptyArea: