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

Side by Side 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: Address comments Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/widget_hwnd_utils.h" 5 #include "ui/views/widget/widget_hwnd_utils.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // Set type-dependent style attributes. 74 // Set type-dependent style attributes.
75 switch (params.type) { 75 switch (params.type) {
76 case Widget::InitParams::TYPE_PANEL: 76 case Widget::InitParams::TYPE_PANEL:
77 *ex_style |= WS_EX_TOPMOST; 77 *ex_style |= WS_EX_TOPMOST;
78 if (params.remove_standard_frame) { 78 if (params.remove_standard_frame) {
79 *style |= WS_POPUP; 79 *style |= WS_POPUP;
80 break; 80 break;
81 } 81 }
82 // Else, no break. Fall through to TYPE_WINDOW. 82 // Else, no break. Fall through to TYPE_WINDOW.
83 case Widget::InitParams::TYPE_WINDOW: { 83 case Widget::InitParams::TYPE_WINDOW: {
84 *style |= WS_SYSMENU | WS_CAPTION; 84 // WS_OVERLAPPEDWINDOW is equivalent to:
85 bool can_resize = widget_delegate->CanResize(); 85 // WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
86 bool can_maximize = widget_delegate->CanMaximize(); 86 // WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
87 if (can_maximize) { 87 *style |= WS_OVERLAPPEDWINDOW;
88 *style |= WS_OVERLAPPEDWINDOW; 88 if (!widget_delegate->CanMaximize())
89 } else if (can_resize || params.remove_standard_frame) { 89 *style &= ~WS_MAXIMIZEBOX;
90 *style |= WS_OVERLAPPED | WS_THICKFRAME; 90 if (!widget_delegate->CanMinimize())
91 } 91 *style &= ~WS_MINIMIZEBOX;
92 if (!widget_delegate->CanResize())
93 *style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
94 if (params.remove_standard_frame)
95 *style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
96
92 if (native_widget_delegate->IsDialogBox()) { 97 if (native_widget_delegate->IsDialogBox()) {
93 *style |= DS_MODALFRAME; 98 *style |= DS_MODALFRAME;
94 // NOTE: Turning this off means we lose the close button, which is bad. 99 // NOTE: Turning this off means we lose the close button, which is bad.
95 // Turning it on though means the user can maximize or size the window 100 // Turning it on though means the user can maximize or size the window
96 // from the system menu, which is worse. We may need to provide our own 101 // from the system menu, which is worse. We may need to provide our own
97 // menu to get the close button to appear properly. 102 // menu to get the close button to appear properly.
98 // style &= ~WS_SYSMENU; 103 // style &= ~WS_SYSMENU;
99 104
100 // Set the WS_POPUP style for modal dialogs. This ensures that the owner 105 // Set the WS_POPUP style for modal dialogs. This ensures that the owner
101 // window is activated on destruction. This style should not be set for 106 // window is activated on destruction. This style should not be set for
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 DWORD class_style = 0; 158 DWORD class_style = 0;
154 CalculateWindowStylesFromInitParams(params, widget_delegate, 159 CalculateWindowStylesFromInitParams(params, widget_delegate,
155 native_widget_delegate, &style, &ex_style, 160 native_widget_delegate, &style, &ex_style,
156 &class_style); 161 &class_style);
157 handler->set_initial_class_style(class_style); 162 handler->set_initial_class_style(class_style);
158 handler->set_window_style(handler->window_style() | style); 163 handler->set_window_style(handler->window_style() | style);
159 handler->set_window_ex_style(handler->window_ex_style() | ex_style); 164 handler->set_window_ex_style(handler->window_ex_style() | ex_style);
160 } 165 }
161 166
162 } // namespace views 167 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698