Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Unified Diff: ui/views/widget/widget_hwnd_utils.cc

Issue 581953002: [Win] Update HWND style when SizeConstraintsChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hidpi
Patch Set: Update to make use of CanMinimize. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/widget_hwnd_utils.cc
diff --git a/ui/views/widget/widget_hwnd_utils.cc b/ui/views/widget/widget_hwnd_utils.cc
index ac313bb74c89967a7578605bf0e9eda80330d020..29f6ce00a3fd2444e68d1afe28c4db782cff9e1f 100644
--- a/ui/views/widget/widget_hwnd_utils.cc
+++ b/ui/views/widget/widget_hwnd_utils.cc
@@ -81,14 +81,19 @@ void CalculateWindowStylesFromInitParams(
}
// Else, no break. Fall through to TYPE_WINDOW.
case Widget::InitParams::TYPE_WINDOW: {
- *style |= WS_SYSMENU | WS_CAPTION;
- bool can_resize = widget_delegate->CanResize();
- bool can_maximize = widget_delegate->CanMaximize();
- if (can_maximize) {
- *style |= WS_OVERLAPPEDWINDOW;
- } else if (can_resize || params.remove_standard_frame) {
- *style |= WS_OVERLAPPED | WS_THICKFRAME;
- }
+ // WS_OVERLAPPEDWINDOW is equivalent to:
+ // WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
+ // WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
+ *style |= WS_OVERLAPPEDWINDOW;
+ if (!widget_delegate->CanMaximize())
+ *style &= ~WS_MAXIMIZEBOX;
+ if (!widget_delegate->CanMinimize())
+ *style &= ~WS_MINIMIZEBOX;
+ if (!widget_delegate->CanResize())
+ *style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
+ if (params.remove_standard_frame)
+ *style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
+
if (native_widget_delegate->IsDialogBox()) {
*style |= DS_MODALFRAME;
// NOTE: Turning this off means we lose the close button, which is bad.

Powered by Google App Engine
This is Rietveld 408576698