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

Side by Side Diff: views/widget/widget_win.cc

Issue 6331006: Make the code for unmaximizing the window during SetBounds much simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | views/widget/widget_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/widget/widget_win.h" 5 #include "views/widget/widget_win.h"
6 6
7 #include "app/l10n_util_win.h" 7 #include "app/l10n_util_win.h"
8 #include "app/system_monitor.h" 8 #include "app/system_monitor.h"
9 #include "app/view_prop.h" 9 #include "app/view_prop.h"
10 #include "app/win/hwnd_util.h" 10 #include "app/win/hwnd_util.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 233
234 GetClientRect(&crect); 234 GetClientRect(&crect);
235 POINT p = {0, 0}; 235 POINT p = {0, 0};
236 ClientToScreen(hwnd(), &p); 236 ClientToScreen(hwnd(), &p);
237 out->SetRect(crect.left + p.x, crect.top + p.y, 237 out->SetRect(crect.left + p.x, crect.top + p.y,
238 crect.Width(), crect.Height()); 238 crect.Width(), crect.Height());
239 } 239 }
240 240
241 void WidgetWin::SetBounds(const gfx::Rect& bounds) { 241 void WidgetWin::SetBounds(const gfx::Rect& bounds) {
242 if (IsZoomed()) 242 LONG style = GetWindowLong(GWL_STYLE);
243 ShowWindow(SW_SHOWNOACTIVATE); 243 if (style & WS_MAXIMIZE)
244 SetWindowLong(GWL_STYLE, style & ~WS_MAXIMIZE);
244 SetWindowPos(NULL, bounds.x(), bounds.y(), bounds.width(), bounds.height(), 245 SetWindowPos(NULL, bounds.x(), bounds.y(), bounds.width(), bounds.height(),
245 SWP_NOACTIVATE | SWP_NOZORDER); 246 SWP_NOACTIVATE | SWP_NOZORDER);
246 } 247 }
247 248
248 void WidgetWin::MoveAbove(Widget* other) { 249 void WidgetWin::MoveAbove(Widget* other) {
249 gfx::Rect bounds; 250 gfx::Rect bounds;
250 GetBounds(&bounds, false); 251 GetBounds(&bounds, false);
251 SetWindowPos(other->GetNativeView(), bounds.x(), bounds.y(), 252 SetWindowPos(other->GetNativeView(), bounds.x(), bounds.y(),
252 bounds.width(), bounds.height(), SWP_NOACTIVATE); 253 bounds.width(), bounds.height(), SWP_NOACTIVATE);
253 } 254 }
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { 1360 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) {
1360 return Widget::GetWidgetFromNativeView(native_window); 1361 return Widget::GetWidgetFromNativeView(native_window);
1361 } 1362 }
1362 1363
1363 // static 1364 // static
1364 void Widget::NotifyLocaleChanged() { 1365 void Widget::NotifyLocaleChanged() {
1365 NOTIMPLEMENTED(); 1366 NOTIMPLEMENTED();
1366 } 1367 }
1367 1368
1368 } // namespace views 1369 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | views/widget/widget_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698