summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-20 08:44:28 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-20 09:00:44 +0100
commitae2695535a2f1abbd4c6596a22dd33319b9388dd (patch)
tree91df41df365a13ea71b1361d909535e5b7a7360a /src/plugins/platforms
parent8066ae49433ed7604e710eef7b15d15de171608e (diff)
parentc1a2f97a3b3a8c058b1760b57e5c83bf7815b84a (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm7
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm85
-rw-r--r--src/plugins/platforms/cocoa/qnsviewaccessibility.mm3
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp2
-rw-r--r--src/plugins/platforms/eglfs/eglfsdeviceintegration.pro2
-rw-r--r--src/plugins/platforms/vnc/vnc.pro10
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp59
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp6
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp24
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro2
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h13
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
19 files changed, 195 insertions, 54 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 77f88cc061..6478365d07 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1636,6 +1636,13 @@ void QCocoaWindow::recreateWindowIfNeeded()
[m_nsWindow setContentView:m_view];
[m_view release];
[m_view setPostsFrameChangedNotifications:YES];
+ // QTBUG-58963
+ // viewDidChangeFrame() should be called for each window automatically at this point because it is
+ // registered with Q_NOTIFICATION_HANDLER(NSViewFrameDidChangeNotification);
+ // The corner case when it's not called and we need to make a manual geometry update is when window's
+ // size is not specified explicitly but minimumSize is set and matches to the size NSView was created with.
+ if (QSizeF::fromCGSize(m_view.frame.size) == [QNSView defaultViewSize])
+ viewDidChangeFrame();
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 75a508370f..a05bd66890 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -88,6 +88,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
QSet<quint32> m_acceptedKeyDowns;
}
++ (QSizeF)defaultViewSize;
- (id)init;
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
#ifndef QT_NO_OPENGL
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 2d8323bead..e16915273a 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -140,7 +140,7 @@ static bool _q_dontOverrideCtrlLMB = false;
- (id) init
{
- self = [super initWithFrame : NSMakeRect(0,0, 300,300)];
+ self = [super initWithFrame : NSMakeRect(0, 0, [[self class] defaultViewSize].width(), [[self class] defaultViewSize].height())];
if (self) {
m_backingStore = 0;
m_maskImage = 0;
@@ -189,6 +189,11 @@ static bool _q_dontOverrideCtrlLMB = false;
[super dealloc];
}
++ (QSizeF)defaultViewSize
+{
+ return QSizeF(300.0, 300.0);
+}
+
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow
{
self = [self init];
@@ -238,6 +243,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)viewDidMoveToSuperview
{
+ if (m_platformWindow.isNull())
+ return;
+
if (!(m_platformWindow->m_viewIsToBeEmbedded))
return;
@@ -258,6 +266,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (QWindow *)topLevelWindow
{
+ if (m_platformWindow.isNull())
+ return nullptr;
+
QWindow *focusWindow = m_platformWindow->window();
// For widgets we need to do a bit of trickery as the window
@@ -273,6 +284,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)updateGeometry
{
+ if (m_platformWindow.isNull())
+ return;
+
QRect geometry;
if (self.window.parentWindow) {
@@ -619,6 +633,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)handleMouseEvent:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
// Tablet events may come in via the mouse event handlers,
// check if this is a valid tablet event first.
if ([self handleTabletEvent: theEvent])
@@ -633,6 +650,8 @@ static bool _q_dontOverrideCtrlLMB = false;
else
m_platformWindow->m_forwardWindow.clear();
}
+ if (targetView->m_platformWindow.isNull())
+ return;
// Popups implicitly grap mouse events; forward to the active popup if there is one
if (QCocoaWindow *popup = QCocoaIntegration::instance()->activePopupWindow()) {
@@ -657,6 +676,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
// get m_buttons in sync
// Don't send frme strut events if we are in the middle of a mouse drag.
if (m_buttons != Qt::NoButton)
@@ -936,6 +958,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)mouseMovedImpl:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self isTransparentForUserInput])
return;
@@ -967,6 +992,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)mouseEnteredImpl:(NSEvent *)theEvent
{
Q_UNUSED(theEvent)
+ if (m_platformWindow.isNull())
+ return;
+
m_platformWindow->m_windowUnderMouse = true;
if ([self isTransparentForUserInput])
@@ -986,6 +1014,9 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)mouseExitedImpl:(NSEvent *)theEvent
{
Q_UNUSED(theEvent);
+ if (m_platformWindow.isNull())
+ return;
+
m_platformWindow->m_windowUnderMouse = false;
if ([self isTransparentForUserInput])
@@ -1012,6 +1043,9 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
- (bool)handleTabletEvent: (NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return false;
+
NSEventType eventType = [theEvent type];
if (eventType != NSTabletPoint && [theEvent subtype] != NSTabletPointEventSubtype)
return false; // Not a tablet event.
@@ -1170,6 +1204,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (bool)shouldSendSingleTouch
{
+ if (m_platformWindow.isNull())
+ return true;
+
// QtWidgets expects single-point touch events, QtDeclarative does not.
// Until there is an API we solve this by looking at the window class type.
return m_platformWindow->window()->inherits("QWidgetWindow");
@@ -1177,6 +1214,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesBeganWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesBeganWithEvent" << points;
@@ -1185,6 +1225,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesMovedWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesMovedWithEvent" << points;
@@ -1193,6 +1236,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesEndedWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesEndedWithEvent" << points;
@@ -1201,6 +1247,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)touchesCancelledWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
qCDebug(lcQpaTouch) << "touchesCancelledWithEvent" << points;
@@ -1228,6 +1277,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
- (void)magnifyWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self handleGestureAsBeginEnd:event])
return;
@@ -1242,6 +1294,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)smartMagnifyWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
static bool zoomIn = true;
qCDebug(lcQpaGestures) << "smartMagnifyWithEvent" << zoomIn;
const NSTimeInterval timestamp = [event timestamp];
@@ -1255,6 +1310,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)rotateWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self handleGestureAsBeginEnd:event])
return;
@@ -1268,6 +1326,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)swipeWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
qCDebug(lcQpaGestures) << "swipeWithEvent" << [event deltaX] << [event deltaY];
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
@@ -1290,6 +1351,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)beginGestureWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
@@ -1301,6 +1365,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)endGestureWithEvent:(NSEvent *)event
{
+ if (m_platformWindow.isNull())
+ return;
+
qCDebug(lcQpaGestures) << "endGestureWithEvent";
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
@@ -1314,6 +1381,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
#ifndef QT_NO_WHEELEVENT
- (void)scrollWheel:(NSEvent *)theEvent
{
+ if (m_platformWindow.isNull())
+ return;
+
if ([self isTransparentForUserInput])
return [super scrollWheel:theEvent];
@@ -1984,6 +2054,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
// Sends drag update to Qt, return the action
- (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender
{
+ if (m_platformWindow.isNull())
+ return NSDragOperationNone;
+
NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil];
QPoint qt_windowPoint(windowPoint.x, windowPoint.y);
Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]);
@@ -2011,6 +2084,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
- (void)draggingExited:(id <NSDraggingInfo>)sender
{
+ if (m_platformWindow.isNull())
+ return;
+
QWindow *target = findEventTargetWindow(m_platformWindow->window());
if (!target)
return;
@@ -2025,6 +2101,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
// called on drop, send the drop to Qt and return if it was accepted.
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
+ if (m_platformWindow.isNull())
+ return false;
+
QWindow *target = findEventTargetWindow(m_platformWindow->window());
if (!target)
return false;
@@ -2055,6 +2134,10 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
{
Q_UNUSED(session);
Q_UNUSED(operation);
+
+ if (m_platformWindow.isNull())
+ return;
+
QWindow *target = findEventTargetWindow(m_platformWindow->window());
if (!target)
return;
diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
index 73e1f41dd5..645a93edf7 100644
--- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
@@ -53,6 +53,9 @@
@implementation QNSView (QNSViewAccessibility)
- (id)childAccessibleElement {
+ if (m_platformWindow.isNull())
+ return nil;
+
if (!m_platformWindow->window()->accessibleRoot())
return nil;
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 534467b32c..e411ea55e9 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -71,16 +71,16 @@ Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration")
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive))
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif // QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
{
QStringList list;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
list = directLoader()->keyMap().values();
@@ -104,7 +104,7 @@ QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)
{
QEglFSDeviceIntegration *integration = Q_NULLPTR;
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(directLoader(), key);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index 3723142f0b..87fb3146c7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -49,6 +49,8 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtFbSupport/private/qfbvthandler_p.h>
+#include <errno.h>
+
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
index 5c084b33fc..187cbc025f 100644
--- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
+++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
@@ -20,8 +20,6 @@ qtHaveModule(input_support-private): \
qtHaveModule(platformcompositor_support-private): \
QT += platformcompositor_support-private
-LIBS += $$QMAKE_LIBS_DYNLOAD
-
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro
index 3cd7e9b160..1fa682303f 100644
--- a/src/plugins/platforms/vnc/vnc.pro
+++ b/src/plugins/platforms/vnc/vnc.pro
@@ -1,10 +1,5 @@
TARGET = qvnc
-PLUGIN_TYPE = platforms
-PLUGIN_CLASS_NAME = QVncIntegrationPlugin
-!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
-load(qt_plugin)
-
QT += \
core-private network gui-private \
service_support-private theme_support-private fb_support-private \
@@ -29,3 +24,8 @@ HEADERS = \
qvncclient.h
OTHER_FILES += vnc.json
+
+PLUGIN_TYPE = platforms
+PLUGIN_CLASS_NAME = QVncIntegrationPlugin
+!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
+load(qt_plugin)
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 9275958456..a326ccac3e 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -373,34 +373,39 @@ void QWindowsOleDropSource::createCursors()
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
{
- HRESULT hr = S_OK;
- do {
- if (fEscapePressed || QWindowsDrag::isCanceled()) {
- hr = ResultFromScode(DRAGDROP_S_CANCEL);
- break;
- }
+ Qt::MouseButtons buttons = toQtMouseButtons(grfKeyState);
- const Qt::MouseButtons buttons = toQtMouseButtons(grfKeyState);
- if (m_currentButtons == Qt::NoButton) {
- m_currentButtons = buttons;
+ SCODE result = S_OK;
+ if (fEscapePressed || QWindowsDrag::isCanceled()) {
+ result = DRAGDROP_S_CANCEL;
+ buttons = Qt::NoButton;
} else {
- // Button changed: Complete Drop operation.
- if (!(m_currentButtons & buttons)) {
- hr = ResultFromScode(DRAGDROP_S_DROP);
- break;
+ if (buttons && !m_currentButtons) {
+ m_currentButtons = buttons;
+ } else if (!(m_currentButtons & buttons)) { // Button changed: Complete Drop operation.
+ result = DRAGDROP_S_DROP;
}
}
- QGuiApplication::processEvents();
+ switch (result) {
+ case DRAGDROP_S_DROP:
+ case DRAGDROP_S_CANCEL:
+ QGuiApplicationPrivate::modifier_buttons = toQtKeyboardModifiers(grfKeyState);
+ QGuiApplicationPrivate::mouse_buttons = buttons;
+ m_currentButtons = Qt::NoButton;
+ break;
- } while (false);
+ default:
+ QGuiApplication::processEvents();
+ break;
+ }
- if (QWindowsContext::verbose > 1 || hr != S_OK) {
+ if (QWindowsContext::verbose > 1 || result != S_OK) {
qCDebug(lcQpaMime) << __FUNCTION__ << "fEscapePressed=" << fEscapePressed
<< "grfKeyState=" << grfKeyState << "buttons" << m_currentButtons
- << "returns 0x" << hex <<int(hr) << dec;
+ << "returns 0x" << hex << int(result) << dec;
}
- return hr;
+ return ResultFromScode(result);
}
/*!
@@ -543,6 +548,12 @@ QWindowsOleDropTarget::DragLeave()
qCDebug(lcQpaMime) << __FUNCTION__ << ' ' << m_window;
QWindowSystemInterface::handleDrag(m_window, 0, QPoint(), Qt::IgnoreAction);
+
+ if (!QDragManager::self()->source()) {
+ QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
+ QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
+ m_lastKeyState = 0;
+ }
QWindowsDrag::instance()->releaseDropDataObject();
return NOERROR;
@@ -561,11 +572,9 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
<< "keys=" << grfKeyState << "pt=" << pt.x << ',' << pt.y;
m_lastPoint = QWindowsGeometryHint::mapFromGlobal(m_window, QPoint(pt.x,pt.y));
- // grfKeyState does not all ways contain button state in the drop so if
- // it doesn't then use the last known button state;
- if ((grfKeyState & KEY_STATE_BUTTON_MASK) == 0)
- grfKeyState |= m_lastKeyState & KEY_STATE_BUTTON_MASK;
- m_lastKeyState = grfKeyState;
+ // grfKeyState does not all ways contain button state in the drop
+ QGuiApplicationPrivate::mouse_buttons = toQtMouseButtons(m_lastKeyState);
+ QGuiApplicationPrivate::modifier_buttons = toQtKeyboardModifiers(grfKeyState);
QWindowsDrag *windowsDrag = QWindowsDrag::instance();
@@ -573,6 +582,10 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(),
m_lastPoint,
translateToQDragDropActions(*pdwEffect));
+
+ QGuiApplicationPrivate::mouse_buttons = toQtMouseButtons(grfKeyState);
+ m_lastKeyState = grfKeyState;
+
if (response.isAccepted()) {
const Qt::DropAction action = response.acceptedAction();
if (action == Qt::MoveAction || action == Qt::TargetMoveAction) {
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
index 6650ca44ae..d69d969783 100644
--- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
@@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String("/xcbglintegrations"), Qt::CaseInsensitive))
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif // !QT_NO_LIBRARY
+#endif // QT_CONFIG(library)
QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform, const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
// Try loading the plugin from pluginPath first:
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
index 492fbf7e10..d9add22e00 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -38,7 +38,9 @@
****************************************************************************/
#include <QDebug>
+#if QT_CONFIG(library)
#include <QLibrary>
+#endif
#include "qxcbwindow.h"
#include "qxcbscreen.h"
@@ -54,7 +56,9 @@
#include <QtGlxSupport/private/qglxconvenience_p.h>
#include <QtPlatformHeaders/QGLXNativeContext>
-#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
+#include "qxcbglintegration.h"
+
+#if !defined(QT_STATIC) && QT_CONFIG(dlopen)
#include <dlfcn.h>
#endif
@@ -564,7 +568,7 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
if (!glXGetProcAddressARB) {
QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' ');
if (glxExt.contains("GLX_ARB_get_proc_address")) {
-#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4)
+#if QT_CONFIG(dlopen)
void *handle = dlopen(NULL, RTLD_LAZY);
if (handle) {
glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB");
@@ -573,7 +577,7 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
if (!glXGetProcAddressARB)
#endif
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
extern const QString qt_gl_library_name();
// QLibrary lib(qt_gl_library_name());
QLibrary lib(QLatin1String("GL"));
@@ -689,6 +693,10 @@ void QGLXContext::queryDummyContext()
if (const char *renderer = (const char *) glGetString(GL_RENDERER)) {
for (int i = 0; qglx_threadedgl_blacklist_renderer[i]; ++i) {
if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != 0) {
+ qCInfo(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
+ "blacklisted renderer \""
+ << qglx_threadedgl_blacklist_renderer[i]
+ << "\"";
m_supportsThreading = false;
break;
}
@@ -698,6 +706,11 @@ void QGLXContext::queryDummyContext()
if (glxvendor) {
for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
if (strstr(glxvendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
+ qCInfo(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
+ "blacklisted vendor \""
+ << qglx_threadedgl_blacklist_vendor[i]
+ << "\"";
+
m_supportsThreading = false;
break;
}
@@ -707,6 +720,11 @@ void QGLXContext::queryDummyContext()
context.doneCurrent();
if (oldContext && oldSurface)
oldContext->makeCurrent(oldSurface);
+
+ if (!m_supportsThreading) {
+ qCInfo(lcQpaGl) << "Force-enable multithreaded OpenGL by setting "
+ "environment variable QT_OPENGL_NO_SANITY_CHECK";
+ }
}
bool QGLXContext::supportsThreading()
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
index 8aa6e1febd..215f5a3fe1 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
@@ -12,7 +12,7 @@ qtConfig(xcb-glx) {
QMAKE_USE += xcb_glx
}
-LIBS += $$QMAKE_LIBS_DYNLOAD
+!static:qtConfig(dlopen): QMAKE_USE += libdl
HEADERS += \
qxcbglxintegration.h \
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 24a4c1bf22..30ab669432 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -600,7 +600,7 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)
return;
}
- xcb_selection_notify_event_t event;
+ Q_DECLARE_XCB_EVENT(event, xcb_selection_notify_event_t);
event.response_type = XCB_SELECTION_NOTIFY;
event.requestor = req->requestor;
event.selection = req->selection;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index fa4fd68686..cdd8e64676 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -728,6 +728,19 @@ private:
std::free \
)
+template <typename T>
+union q_padded_xcb_event {
+ T event;
+ char padding[32];
+};
+
+// The xcb_send_event() requires all events to have 32 bytes. It calls memcpy() on the
+// passed in event. If the passed in event is less than 32 bytes, memcpy() reaches into
+// unrelated memory.
+#define Q_DECLARE_XCB_EVENT(event_var, event_type) \
+ q_padded_xcb_event<event_type> store = {}; \
+ auto &event_var = store.event;
+
QT_END_NAMESPACE
#endif
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 4b6642efee..c77e7b6269 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -1220,6 +1220,7 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
if (!xcbWindow)
return;
QWindow *window = xcbWindow->window();
+ const Qt::KeyboardModifiers modifiers = keyboard()->translateModifiers(ev->mods.effective_mods);
const double scale = 65536.0;
QPointF local(ev->event_x / scale, ev->event_y / scale);
QPointF global(ev->root_x / scale, ev->root_y / scale);
@@ -1261,18 +1262,18 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 event on tablet %d with tool %s type %s seq %d detail %d time %d "
- "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
+ "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf modifiers 0x%x",
tabletData->deviceId, toolName(tabletData->tool), pointerTypeName(tabletData->pointerType),
ev->sequenceNumber, ev->detail, ev->time,
fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y),
fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y),
- (int)tabletData->buttons, pressure, xTilt, yTilt, rotation);
+ (int)tabletData->buttons, pressure, xTilt, yTilt, rotation, (int)modifiers);
QWindowSystemInterface::handleTabletEvent(window, ev->time, local, global,
tabletData->tool, tabletData->pointerType,
tabletData->buttons, pressure,
xTilt, yTilt, tangentialPressure,
- rotation, 0, tabletData->serialId);
+ rotation, 0, tabletData->serialId, modifiers);
}
QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id)
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 7f8c7af2ae..d522e593fe 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -43,7 +43,9 @@
#include "qxcbimage.h"
#include "qxcbxsettings.h"
+#if QT_CONFIG(library)
#include <QtCore/QLibrary>
+#endif
#include <QtGui/QWindow>
#include <QtGui/QBitmap>
#include <QtGui/private/qguiapplication_p.h>
@@ -58,7 +60,7 @@ typedef char *(*PtrXcursorLibraryGetTheme)(void *);
typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *);
typedef int (*PtrXcursorLibraryGetDefaultSize)(void *);
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
#include <X11/Xlib.h>
enum {
XCursorShape = CursorShape
@@ -306,7 +308,7 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
const char *cursorStr = "cursor";
xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr);
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
static bool function_ptrs_not_initialized = true;
if (function_ptrs_not_initialized) {
QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
@@ -507,7 +509,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
return cursor;
}
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
bool updateCursorTheme(void *dpy, const QByteArray &theme) {
if (!ptrXcursorLibraryGetTheme
|| !ptrXcursorLibrarySetTheme)
@@ -551,7 +553,7 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
}
return cursor;
}
-#endif //XCB_USE_XLIB / QT_NO_LIBRARY
+#endif // XCB_USE_XLIB / QT_CONFIG(library)
xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
{
@@ -560,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
xcb_cursor_t cursor = XCB_NONE;
// Try Xcursor first
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
if (cshape >= 0 && cshape <= Qt::LastCursor) {
void *dpy = connection()->xlib_display();
// special case for non-standard dnd-* cursors
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index c15225f6d2..41ec4dbbf8 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -101,7 +101,7 @@ private:
#ifndef QT_NO_CURSOR
CursorHash m_cursorHash;
#endif
-#if defined(XCB_USE_XLIB) && !defined(QT_NO_LIBRARY)
+#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen,
const QByteArray &name,
const QVariant &property,
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 908a6fdf82..d4521de8e0 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -1118,7 +1118,7 @@ static xcb_window_t findXdndAwareParent(QXcbConnection *c, xcb_window_t window)
void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event)
{
- xcb_selection_notify_event_t notify;
+ Q_DECLARE_XCB_EVENT(notify, xcb_selection_notify_event_t);
notify.response_type = XCB_SELECTION_NOTIFY;
notify.requestor = event->requestor;
notify.selection = event->selection;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index e2c25df111..e15c22b690 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -826,7 +826,7 @@ void QXcbWindow::hide()
xcb_unmap_window(xcb_connection(), m_window);
// send synthetic UnmapNotify event according to icccm 4.1.4
- xcb_unmap_notify_event_t event;
+ Q_DECLARE_XCB_EVENT(event, xcb_unmap_notify_event_t);
event.response_type = XCB_UNMAP_NOTIFY;
event.event = xcbScreen()->root();
event.window = m_window;