From 12b88cc7bbb1378f0e7420aaf35294e8dca01086 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 26 Jan 2012 11:01:13 +0100 Subject: QSizeGrip: Fix Windows. Reactivate the old Windows code. Change-Id: Ied467cf83d89c76a0fa8edf3c76bb207cc2a70e0 Reviewed-by: Oliver Wolff --- src/widgets/widgets/qsizegrip.cpp | 47 +++++++++++++++++++-------------------- src/widgets/widgets/qsizegrip.h | 3 --- 2 files changed, 23 insertions(+), 27 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index 4db06779ee..557481179f 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -54,8 +54,9 @@ #if defined(Q_WS_X11) #include -#elif defined (Q_WS_WIN) -#include "qt_windows.h" +#elif defined (Q_OS_WIN) +# include +# include "private/qapplication_p.h" #endif #ifdef Q_WS_MAC #include @@ -64,13 +65,18 @@ #include #include -#define SZ_SIZEBOTTOMRIGHT 0xf008 -#define SZ_SIZEBOTTOMLEFT 0xf007 -#define SZ_SIZETOPLEFT 0xf004 -#define SZ_SIZETOPRIGHT 0xf005 - QT_BEGIN_NAMESPACE +#if defined (Q_OS_WIN) +# define SZ_SIZEBOTTOMRIGHT 0xf008 +# define SZ_SIZEBOTTOMLEFT 0xf007 +# define SZ_SIZETOPLEFT 0xf004 +# define SZ_SIZETOPRIGHT 0xf005 + +HMENU qt_getWindowsSystemMenu(const QWidget *w); + +#endif + static QWidget *qt_sizegrip_topLevelWidget(QWidget* w) { while (w && !w->isWindow() && w->windowType() != Qt::SubWindow) @@ -317,7 +323,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) return; } #endif // Q_WS_X11 -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) { uint orientation = 0; if (d->atBottom()) @@ -326,10 +332,10 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e) orientation = d->atLeft() ? SZ_SIZETOPLEFT : SZ_SIZETOPRIGHT; ReleaseCapture(); - PostMessage(tlw->winId(), WM_SYSCOMMAND, orientation, 0); + PostMessage(QApplicationPrivate::getHWNDForWidget(tlw), WM_SYSCOMMAND, orientation, 0); return; } -#endif // Q_WS_WIN +#endif // Q_OS_WIN // Find available desktop/workspace geometry. QRect availableGeometry; @@ -411,12 +417,13 @@ void QSizeGrip::mouseMoveEvent(QMouseEvent * e) && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) return; #endif -#ifdef Q_WS_WIN - if (tlw->isWindow() && GetSystemMenu(tlw->winId(), FALSE) != 0 && internalWinId() - && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) { - MSG msg; - while(PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)); - return; +#ifdef Q_OS_WIN + if (tlw->isWindow() && qt_getWindowsSystemMenu(tlw) && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) { + if (const HWND hwnd = QApplicationPrivate::getHWNDForWidget(tlw)) { + MSG msg; + while (PeekMessage(&msg, hwnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) ; + return; + } } #endif @@ -541,14 +548,6 @@ bool QSizeGrip::event(QEvent *event) return QWidget::event(event); } -#ifdef Q_WS_WIN -/*! \reimp */ -bool QSizeGrip::winEvent( MSG *m, long *result ) -{ - return QWidget::winEvent(m, result); -} -#endif - QT_END_NAMESPACE #include "moc_qsizegrip.cpp" diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h index 44b27b2976..8dccebb973 100644 --- a/src/widgets/widgets/qsizegrip.h +++ b/src/widgets/widgets/qsizegrip.h @@ -71,9 +71,6 @@ protected: void hideEvent(QHideEvent *hideEvent); bool eventFilter(QObject *, QEvent *); bool event(QEvent *); -#ifdef Q_WS_WIN - bool winEvent(MSG *m, long *result); -#endif public: -- cgit v1.2.3