summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-10-05 12:38:45 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-10-05 12:38:45 +0000
commit7bbb9a8ce81653b1665c9c942cc707ce98f611c5 (patch)
tree2bbfb13413d95feb6b2e65f3673f750f0bd32ce7 /src/plugins
parent8e70241dccaf5a9e5c79c8d6da5665b881c5914d (diff)
parentbc5f45052fd8f9a5481a37a6a4d55c7f6cbf037d (diff)
Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm4
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h6
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp1
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h1
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp38
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h5
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro1
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp18
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp9
11 files changed, 85 insertions, 20 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 643d3b3a30..054dca122f 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1374,6 +1374,10 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
if (m_composingText.isEmpty()) {
m_sendKeyEvent = !QWindowSystemInterface::handleShortcutEvent(window, timestamp, keyCode,
modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1);
+
+ // Handling a shortcut may result in closing the window
+ if (!m_platformWindow)
+ return true;
}
QObject *fo = m_platformWindow->window()->focusObject();
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index d9c342be27..c8bdc1c93e 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -101,6 +101,8 @@ enum WindowsEventType // Simplify event types
FocusOutEvent = WindowEventFlag + 18,
WhatsThisEvent = WindowEventFlag + 19,
DpiChangedEvent = WindowEventFlag + 21,
+ EnterSizeMoveEvent = WindowEventFlag + 22,
+ ExitSizeMoveEvent = WindowEventFlag + 23,
MouseEvent = MouseEventFlag + 1,
MouseWheelEvent = MouseEventFlag + 2,
CursorEvent = MouseEventFlag + 3,
@@ -282,6 +284,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
return HIWORD(wParamIn) ? QtWindows::AcceleratorCommandEvent : QtWindows::MenuCommandEvent;
case WM_DPICHANGED:
return QtWindows::DpiChangedEvent;
+ case WM_ENTERSIZEMOVE:
+ return QtWindows::EnterSizeMoveEvent;
+ case WM_EXITSIZEMOVE:
+ return QtWindows::ExitSizeMoveEvent;
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 7683f0da4d..289a61336f 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -1081,6 +1081,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
if (platformWindow->frameStrutEventsEnabled())
return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
break;
+ case QtWindows::EnterSizeMoveEvent:
+ platformWindow->setFlag(QWindowsWindow::ResizeMoveActive);
+ return true;
+ case QtWindows::ExitSizeMoveEvent:
+ platformWindow->clearFlag(QWindowsWindow::ResizeMoveActive);
+ platformWindow->checkForScreenChanged();
+ return true;
case QtWindows::ScrollEvent:
return sessionManagerInteractionBlocked() || d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
case QtWindows::MouseWheelEvent:
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index af4304cb19..2b14edc804 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -233,6 +233,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// Check for events synthesized from touch. Lower 7 bits are touch/pen index, bit 8 indicates touch.
// However, when tablet support is active, extraInfo is a packet serial number. This is not a problem
// since we do not want to ignore mouse events coming from a tablet.
+ // See https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320.aspx
const quint64 extraInfo = quint64(GetMessageExtraInfo());
if ((extraInfo & signatureMask) == miWpSignature) {
if (extraInfo & 0x80) { // Bit 7 indicates touch event, else tablet pen.
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 3a4793efcd..cfddb3cc71 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -566,4 +566,19 @@ const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const
return Q_NULLPTR;
}
+const QWindowsScreen *QWindowsScreenManager::screenForHwnd(HWND hwnd) const
+{
+ HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL);
+ if (hMonitor == NULL)
+ return nullptr;
+ const auto it =
+ std::find_if(m_screens.cbegin(), m_screens.cend(),
+ [hMonitor](const QWindowsScreen *s)
+ {
+ return s->data().hMonitor == hMonitor
+ && (s->data().flags & QWindowsScreenData::VirtualDesktop) != 0;
+ });
+ return it != m_screens.cend() ? *it : nullptr;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 9a8997326b..7cf73f03af 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -134,6 +134,7 @@ public:
const WindowsScreenList &screens() const { return m_screens; }
const QWindowsScreen *screenAtDp(const QPoint &p) const;
+ const QWindowsScreen *screenForHwnd(HWND hwnd) const;
private:
void removeScreen(int index);
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 3f417fde27..312ff9065f 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -896,7 +896,9 @@ void QWindowsBaseWindow::hide_sys() // Normal hide, do not activate other window
void QWindowsBaseWindow::raise_sys()
{
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window();
- if (window()->type() == Qt::Popup
+ const Qt::WindowType type = window()->type();
+ if (type == Qt::Popup
+ || type == Qt::SubWindow // Special case for QTBUG-63121: MDI subwindows with WindowStaysOnTopHint
|| (window()->flags() & (Qt::WindowStaysOnTopHint | Qt::WindowStaysOnBottomHint)) == 0) {
SetWindowPos(handle(), HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}
@@ -1629,6 +1631,26 @@ void QWindowsWindow::handleResized(int wParam)
}
}
+void QWindowsWindow::checkForScreenChanged()
+{
+ if (parent())
+ return;
+
+ QPlatformScreen *currentScreen = screen();
+ const auto &screenManager = QWindowsContext::instance()->screenManager();
+ // QTBUG-62971: When dragging a window by its border, detect by mouse position
+ // to prevent it from oscillating between screens when it resizes
+ const QWindowsScreen *newScreen = testFlag(ResizeMoveActive)
+ ? screenManager.screenAtDp(QWindowsCursor::mousePosition())
+ : screenManager.screenForHwnd(m_data.hwnd);
+ if (newScreen != nullptr && newScreen != currentScreen) {
+ qCDebug(lcQpaWindows).noquote().nospace() << __FUNCTION__
+ << ' ' << window() << " \"" << currentScreen->name()
+ << "\"->\"" << newScreen->name() << '"';
+ QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
+ }
+}
+
void QWindowsWindow::handleGeometryChange()
{
const QRect previousGeometry = m_data.geometry;
@@ -1642,17 +1664,9 @@ void QWindowsWindow::handleGeometryChange()
&& !(m_data.geometry.width() > previousGeometry.width() || m_data.geometry.height() > previousGeometry.height())) {
fireExpose(QRect(QPoint(0, 0), m_data.geometry.size()), true);
}
- if (!parent() && previousGeometry.topLeft() != m_data.geometry.topLeft()) {
- HMONITOR hMonitor = MonitorFromWindow(m_data.hwnd, MONITOR_DEFAULTTONULL);
- QPlatformScreen *currentScreen = screen();
- const auto screens = QWindowsContext::instance()->screenManager().screens();
- auto newScreenIt = std::find_if(screens.begin(), screens.end(), [&](QWindowsScreen *s) {
- return s->data().hMonitor == hMonitor
- && s->data().flags & QWindowsScreenData::VirtualDesktop;
- });
- if (newScreenIt != screens.end() && *newScreenIt != currentScreen)
- QWindowSystemInterface::handleWindowScreenChanged(window(), (*newScreenIt)->screen());
- }
+
+ checkForScreenChanged();
+
if (testFlag(SynchronousGeometryChangeEvent))
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index f0789e5167..414d4a92f8 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -217,7 +217,8 @@ public:
Compositing = 0x200000,
HasBorderInFullScreen = 0x400000,
WithinDpiChanged = 0x800000,
- VulkanSurface = 0x1000000
+ VulkanSurface = 0x1000000,
+ ResizeMoveActive = 0x2000000
};
QWindowsWindow(QWindow *window, const QWindowsWindowData &data);
@@ -328,6 +329,8 @@ public:
void alertWindow(int durationMs = 0);
void stopAlertWindow();
+ void checkForScreenChanged();
+
static void setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes);
void registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes = QWindowsWindowFunctions::NormalTouch);
static void setHasBorderInFullScreenStatic(QWindow *window, bool border);
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index 6956d04083..a98a7892dd 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -83,7 +83,6 @@ qtConfig(vulkan) {
!qtConfig(system-xcb) {
QMAKE_USE += xcb-static xcb
} else {
- LIBS += -lxcb-xinerama ### there is no configure test for this!
qtConfig(xkb): QMAKE_USE += xcb_xkb
qtConfig(xcb-render): QMAKE_USE += xcb_render
QMAKE_USE += xcb_syslibs
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 3dc0e73af5..d9aebff700 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -1159,16 +1159,22 @@ static void qLibraryInit()
}
# endif // MYSQL_VERSION_ID
#endif // Q_NO_MYSQL_EMBEDDED
+
+#ifdef MARIADB_BASE_VERSION
+ qAddPostRoutine(mysql_server_end);
+#endif
}
static void qLibraryEnd()
{
-#ifndef Q_NO_MYSQL_EMBEDDED
-# if MYSQL_VERSION_ID > 40000
-# if (MYSQL_VERSION_ID >= 40110 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50003
- mysql_library_end();
-# else
- mysql_server_end();
+#if !defined(MARIADB_BASE_VERSION)
+# if !defined(Q_NO_MYSQL_EMBEDDED)
+# if MYSQL_VERSION_ID > 40000
+# if (MYSQL_VERSION_ID >= 40110 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50003
+ mysql_library_end();
+# else
+ mysql_server_end();
+# endif
# endif
# endif
#endif
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index 32d3681a17..a4793351de 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -206,6 +206,7 @@ protected:
QVariant lastInsertId() const Q_DECL_OVERRIDE;
bool execBatch(bool arrayBind = false) Q_DECL_OVERRIDE;
void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ bool fetchNext() override;
};
class QOCIResultPrivate: public QSqlCachedResultPrivate
@@ -2097,6 +2098,14 @@ void QOCIResult::virtual_hook(int id, void *data)
QSqlCachedResult::virtual_hook(id, data);
}
+bool QOCIResult::fetchNext()
+{
+ Q_D(QOCIResult);
+ if (isForwardOnly())
+ d->cache.clear();
+ return QSqlCachedResult::fetchNext();
+}
+
////////////////////////////////////////////////////////////////////////////