diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2012-12-12 10:22:36 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-10 14:09:59 (GMT) |
commit | e11bb8e02fa1f2f933784b9d6d6483c5547e5522 (patch) | |
tree | be8c261ddc9188f570de30aa3320efba0558dc32 | |
parent | 6ec12fb227f49efbea234861169f84feb98c2275 (diff) | |
download | Qt-e11bb8e02fa1f2f933784b9d6d6483c5547e5522.zip Qt-e11bb8e02fa1f2f933784b9d6d6483c5547e5522.tar.gz Qt-e11bb8e02fa1f2f933784b9d6d6483c5547e5522.tar.bz2 |
Fix title bar height of Aero wizard on Windows 8.
Windows 8 no longer allows for negative values to WM_NCCALCSIZE
to shrink the title bar.
Task-number: QTBUG-28435
Change-Id: Ib6aa95a98663c4dc8e9a18407b5d49a0daeab8f9
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qtbase/5fb6331a17a5c43b91daddf4a30e46ccbd1419b5)
-rw-r--r-- | src/gui/dialogs/qwizard_win.cpp | 26 | ||||
-rw-r--r-- | src/gui/dialogs/qwizard_win_p.h | 6 |
2 files changed, 23 insertions, 9 deletions
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp index 303a1c6..67141f6 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/gui/dialogs/qwizard_win.cpp @@ -390,12 +390,15 @@ bool QVistaHelper::winEvent(MSG* msg, long* result) } break; } - case WM_NCCALCSIZE: { - NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam; - *result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam); - lpncsp->rgrc[0].top -= (vistaState() == VistaAero ? titleBarSize() : 0); + case WM_NCCALCSIZE: + if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8 && vistaState() == VistaAero) { + NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam; + *result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam); + lpncsp->rgrc[0].top -= titleBarSize(); + } else { + return false; // Negative margins no longer work on Windows 8. + } break; - } default: LRESULT lResult; // Pass to DWM to handle @@ -767,6 +770,19 @@ int QVistaHelper::titleOffset() return leftMargin() + iconOffset; } +int QVistaHelper::topOffset() +{ + if (vistaState() != VistaAero) + return titleBarSize() + 3; + static const int aeroOffset = + QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS7 ? + QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13); + int result = aeroOffset; + if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8) + result += titleBarSize(); + return result; +} + QT_END_NAMESPACE #endif // QT_NO_STYLE_WINDOWSVISTA diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h index e4818a2..3043c9c 100644 --- a/src/gui/dialogs/qwizard_win_p.h +++ b/src/gui/dialogs/qwizard_win_p.h @@ -105,10 +105,8 @@ public: return int(QStyleHelper::dpiScaled( QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6)); } - static int topOffset() { - static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? - QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13); - return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); } + static int topOffset(); + private: static HFONT getCaptionFont(HANDLE hTheme); bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc); |