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/qwindowscontext.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h1
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.h1
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp41
6 files changed, 38 insertions, 21 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index a9fd1d9836..de0a583e58 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -593,6 +593,11 @@ QWindow *QWindowsContext::windowUnderMouse() const
return d->m_mouseHandler.windowUnderMouse();
}
+void QWindowsContext::clearWindowUnderMouse()
+{
+ d->m_mouseHandler.clearWindowUnderMouse();
+}
+
/*!
\brief Find a child window at a screen point.
@@ -868,10 +873,15 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::CloseEvent:
QWindowSystemInterface::handleCloseEvent(platformWindow->window());
return true;
- case QtWindows::ThemeChanged: // ### fixme: Compress these events?
+ case QtWindows::ThemeChanged: {
+ // Switch from Aero to Classic changes margins.
+ const Qt::WindowFlags flags = platformWindow->window()->flags();
+ if ((flags & Qt::WindowType_Mask) != Qt::Desktop && !(flags & Qt::FramelessWindowHint))
+ platformWindow->setFlag(QWindowsWindow::FrameDirty);
if (QWindowsTheme *theme = QWindowsTheme::instance())
theme->windowsThemeChanged(platformWindow->window());
return true;
+ }
#ifndef Q_OS_WINCE
case QtWindows::ActivateWindowEvent:
#ifndef QT_NO_TABLETEVENT
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index b5c97cddc9..0d3476e00f 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -168,6 +168,7 @@ public:
unsigned cwex_flags) const;
QWindow *windowUnderMouse() const;
+ void clearWindowUnderMouse();
inline bool windowsProc(HWND hwnd, UINT message,
QtWindows::WindowsEventType et,
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 17a6cd6579..354f6700b3 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -2098,7 +2098,7 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
|| QSysInfo::windowsVersion() <= QSysInfo::WV_2003) {
return new QWindowsXpFileDialogHelper();
}
- if (QSysInfo::windowsVersion() > QSysInfo::WV_XP)
+ if (QSysInfo::windowsVersion() > QSysInfo::WV_2003)
return new QWindowsFileDialogHelper();
#else
return new QWindowsFileDialogHelper();
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h
index caf30e6b1a..7a7b92ca7e 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.h
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.h
@@ -72,6 +72,7 @@ public:
static Qt::MouseButtons queryMouseButtons();
QWindow *windowUnderMouse() const { return m_windowUnderMouse.data(); }
+ void clearWindowUnderMouse() { m_windowUnderMouse = 0; }
private:
inline bool translateMouseWheelEvent(QWindow *window, HWND hwnd,
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 83d93b08bd..882967d22c 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -226,7 +226,6 @@ static inline QPalette menuPalette(const QPalette &systemPalette)
const QColor menuColor(getSysColor(COLOR_MENU));
const QColor menuTextColor(getSysColor(COLOR_MENUTEXT));
const QColor disabled(getSysColor(COLOR_GRAYTEXT));
- const bool isFlat = booleanSystemParametersInfo(SPI_GETFLATMENU, false);
// we might need a special color group for the result.
result.setColor(QPalette::Active, QPalette::Button, menuColor);
result.setColor(QPalette::Active, QPalette::Text, menuTextColor);
@@ -235,6 +234,7 @@ static inline QPalette menuPalette(const QPalette &systemPalette)
result.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
result.setColor(QPalette::Disabled, QPalette::Text, disabled);
#ifndef Q_OS_WINCE
+ const bool isFlat = booleanSystemParametersInfo(SPI_GETFLATMENU, false);
result.setColor(QPalette::Disabled, QPalette::Highlight,
getSysColor(isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT));
#else
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index dc51dbfc88..e7e964a128 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -871,6 +871,9 @@ void QWindowsWindow::destroyWindow()
qDebug() << __FUNCTION__ << this << window() << m_data.hwnd;
if (m_data.hwnd) { // Stop event dispatching before Window is destroyed.
setFlag(WithinDestroy);
+ QWindowsContext *context = QWindowsContext::instance();
+ if (context->windowUnderMouse() == window())
+ context->clearWindowUnderMouse();
if (hasMouseCapture())
setMouseGrabEnabled(false);
unregisterDropSite();
@@ -893,7 +896,7 @@ void QWindowsWindow::destroyWindow()
#endif // !Q_OS_WINCE
if (m_data.hwnd != GetDesktopWindow())
DestroyWindow(m_data.hwnd);
- QWindowsContext::instance()->removeWindow(m_data.hwnd);
+ context->removeWindow(m_data.hwnd);
m_data.hwnd = 0;
}
}
@@ -1795,6 +1798,7 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
}
#endif // !Q_OS_WINCE
+#ifndef QT_NO_CURSOR
// Return the default cursor (Arrow) from QWindowsCursor's cache.
static inline QWindowsWindowCursor defaultCursor(const QWindow *w)
{
@@ -1805,6 +1809,24 @@ static inline QWindowsWindowCursor defaultCursor(const QWindow *w)
return QWindowsWindowCursor(Qt::ArrowCursor);
}
+// Check whether to apply a new cursor. Either the window in question is
+// currently under mouse, or it is the parent of the window under mouse and
+// there is no other window with an explicitly set cursor in-between.
+static inline bool applyNewCursor(const QWindow *w)
+{
+ const QWindow *underMouse = QWindowsContext::instance()->windowUnderMouse();
+ if (underMouse == w)
+ return true;
+ for (const QWindow *p = underMouse; p ; p = p->parent()) {
+ if (p == w)
+ return true;
+ if (!QWindowsWindow::baseWindowOf(p)->cursor().isNull())
+ return false;
+ }
+ return false;
+}
+#endif // !QT_NO_CURSOR
+
/*!
\brief Applies to cursor property set on the window to the global cursor.
@@ -1826,23 +1848,6 @@ void QWindowsWindow::applyCursor()
#endif
}
-// Check whether to apply a new cursor. Either the window in question is
-// currently under mouse, or it is the parent of the window under mouse and
-// there is no other window with an explicitly set cursor in-between.
-static inline bool applyNewCursor(const QWindow *w)
-{
- const QWindow *underMouse = QWindowsContext::instance()->windowUnderMouse();
- if (underMouse == w)
- return true;
- for (const QWindow *p = underMouse; p ; p = p->parent()) {
- if (p == w)
- return true;
- if (!QWindowsWindow::baseWindowOf(p)->cursor().isNull())
- return false;
- }
- return false;
-}
-
void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
{
#ifndef QT_NO_CURSOR