summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h4
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp7
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp27
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp2
5 files changed, 35 insertions, 21 deletions
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 1443e5e920..825602e7dc 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -550,6 +550,7 @@ CursorHandlePtr QWindowsCursor::standardWindowCursor(Qt::CursorShape shape)
}
HCURSOR QWindowsCursor::m_overriddenCursor = nullptr;
+HCURSOR QWindowsCursor::m_overrideCursor = nullptr;
/*!
\brief Return cached pixmap cursor or create new one.
@@ -622,11 +623,20 @@ void QWindowsCursor::changeCursor(QCursor *cursorIn, QWindow *window)
}
}
+// QTBUG-69637: Override cursors can get reset externally when moving across
+// window borders. Enforce the cursor again (to be called from enter event).
+void QWindowsCursor::enforceOverrideCursor()
+{
+ if (hasOverrideCursor() && m_overrideCursor != GetCursor())
+ SetCursor(m_overrideCursor);
+}
+
void QWindowsCursor::setOverrideCursor(const QCursor &cursor)
{
const CursorHandlePtr wcursor = cursorHandle(cursor);
- if (wcursor->handle()) {
- const HCURSOR previousCursor = SetCursor(wcursor->handle());
+ if (const auto overrideCursor = wcursor->handle()) {
+ m_overrideCursor = overrideCursor;
+ const HCURSOR previousCursor = SetCursor(overrideCursor);
if (m_overriddenCursor == nullptr)
m_overriddenCursor = previousCursor;
} else {
@@ -639,7 +649,7 @@ void QWindowsCursor::clearOverrideCursor()
{
if (m_overriddenCursor) {
SetCursor(m_overriddenCursor);
- m_overriddenCursor = nullptr;
+ m_overriddenCursor = m_overrideCursor = nullptr;
}
}
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index 715533e0af..1816732594 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -107,7 +107,8 @@ public:
void changeCursor(QCursor * widgetCursor, QWindow * widget) override;
void setOverrideCursor(const QCursor &cursor) override;
void clearOverrideCursor() override;
- bool hasOverrideCursor() const { return m_overriddenCursor != nullptr; }
+ static void enforceOverrideCursor();
+ static bool hasOverrideCursor() { return m_overriddenCursor != nullptr; }
QPoint pos() const override;
void setPos(const QPoint &pos) override;
@@ -143,6 +144,7 @@ private:
mutable QPixmap m_ignoreDragCursor;
static HCURSOR m_overriddenCursor;
+ static HCURSOR m_overrideCursor;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 17fc120b42..45788fec15 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2108,6 +2108,8 @@ bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *
HWND desktopHWND = GetDesktopWindow();
platformWindow->m_data.embedded = !parentWindow && parentHWND && (parentHWND != desktopHWND);
}
+ if (qWindow->flags().testFlag(Qt::WindowStaysOnBottomHint))
+ windowPos->hwndInsertAfter = HWND_BOTTOM;
}
if (!qWindow->isTopLevel()) // Implement hasHeightForWidth().
return false;
@@ -2454,8 +2456,11 @@ static inline bool applyNewCursor(const QWindow *w)
void QWindowsWindow::applyCursor()
{
- if (static_cast<const QWindowsCursor *>(screen()->cursor())->hasOverrideCursor())
+ if (QWindowsCursor::hasOverrideCursor()) {
+ if (isTopLevel())
+ QWindowsCursor::enforceOverrideCursor();
return;
+ }
#ifndef QT_NO_CURSOR
if (m_cursor->isNull()) { // Recurse up to parent with non-null cursor. Set default for toplevel.
if (const QWindow *p = window()->parent()) {
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
index 0ae60ad220..85a931e015 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
@@ -68,21 +68,18 @@ QWindowsUiaAccessibility::~QWindowsUiaAccessibility()
// Handles UI Automation window messages.
bool QWindowsUiaAccessibility::handleWmGetObject(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
{
- if (lParam == LPARAM(UiaRootObjectId)) {
-
- // Start handling accessibility internally
- QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true);
-
- // Ignoring all requests while starting up / shutting down
- if (QCoreApplication::startingUp() || QCoreApplication::closingDown())
- return false;
-
- if (QWindow *window = QWindowsContext::instance()->findWindow(hwnd)) {
- if (QAccessibleInterface *accessible = window->accessibleRoot()) {
- QWindowsUiaMainProvider *provider = QWindowsUiaMainProvider::providerForAccessible(accessible);
- *lResult = QWindowsUiaWrapper::instance()->returnRawElementProvider(hwnd, wParam, lParam, provider);
- return true;
- }
+ // Start handling accessibility internally
+ QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true);
+
+ // Ignoring all requests while starting up / shutting down
+ if (QCoreApplication::startingUp() || QCoreApplication::closingDown())
+ return false;
+
+ if (QWindow *window = QWindowsContext::instance()->findWindow(hwnd)) {
+ if (QAccessibleInterface *accessible = window->accessibleRoot()) {
+ QWindowsUiaMainProvider *provider = QWindowsUiaMainProvider::providerForAccessible(accessible);
+ *lResult = QWindowsUiaWrapper::instance()->returnRawElementProvider(hwnd, wParam, lParam, provider);
+ return true;
}
}
return false;
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp
index 96f557efd3..11397fb9ec 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp
@@ -149,7 +149,7 @@ long roleToControlTypeId(QAccessible::Role role)
{QAccessible::Caret, UIA_CustomControlTypeId},
{QAccessible::AlertMessage, UIA_CustomControlTypeId},
{QAccessible::Window, UIA_WindowControlTypeId},
- {QAccessible::Client, UIA_CustomControlTypeId},
+ {QAccessible::Client, UIA_GroupControlTypeId},
{QAccessible::PopupMenu, UIA_MenuControlTypeId},
{QAccessible::MenuItem, UIA_MenuItemControlTypeId},
{QAccessible::ToolTip, UIA_ToolTipControlTypeId},