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

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

Issue 7358005: Makes sure widget is created at right size before showing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment Created 9 years, 5 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
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/native_widget_win.h" 5 #include "views/widget/native_widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 // NOTE: Be careful not to activate any windows here (for example, calling 887 // NOTE: Be careful not to activate any windows here (for example, calling
888 // ShowWindow(SW_HIDE) will automatically activate another window). This 888 // ShowWindow(SW_HIDE) will automatically activate another window). This
889 // code can be called while a window is being deactivated, and activating 889 // code can be called while a window is being deactivated, and activating
890 // another window will screw up the activation that is already in progress. 890 // another window will screw up the activation that is already in progress.
891 SetWindowPos(NULL, 0, 0, 0, 0, 891 SetWindowPos(NULL, 0, 0, 0, 0,
892 SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | 892 SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE |
893 SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); 893 SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER);
894 } 894 }
895 } 895 }
896 896
897 void NativeWidgetWin::ShowNativeWidget(ShowState state) { 897 void NativeWidgetWin::ShowMaximizedWithBounds(
898 const gfx::Rect& restored_bounds) {
899 WINDOWPLACEMENT placement = { 0 };
900 placement.length = sizeof(WINDOWPLACEMENT);
901 placement.showCmd = SW_SHOWMAXIMIZED;
902 placement.rcNormalPosition = restored_bounds.ToRECT();
903 SetWindowPlacement(hwnd(), &placement);
904 }
905
906 void NativeWidgetWin::ShowWithState(ShowState state) {
898 DWORD native_show_state; 907 DWORD native_show_state;
899 switch (state) { 908 switch (state) {
900 case SHOW_INACTIVE: 909 case SHOW_INACTIVE:
901 native_show_state = SW_SHOWNOACTIVATE; 910 native_show_state = SW_SHOWNOACTIVATE;
902 break; 911 break;
903 case SHOW_MAXIMIZED: 912 case SHOW_MAXIMIZED:
904 native_show_state = SW_SHOWMAXIMIZED; 913 native_show_state = SW_SHOWMAXIMIZED;
905 break; 914 break;
906 default: 915 default:
907 native_show_state = GetShowState(); 916 native_show_state = GetShowState();
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 // Set non-style attributes. 2215 // Set non-style attributes.
2207 ownership_ = params.ownership; 2216 ownership_ = params.ownership;
2208 2217
2209 DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS; 2218 DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
2210 DWORD ex_style = 0; 2219 DWORD ex_style = 0;
2211 DWORD class_style = CS_DBLCLKS; 2220 DWORD class_style = CS_DBLCLKS;
2212 2221
2213 // Set type-independent style attributes. 2222 // Set type-independent style attributes.
2214 if (params.child) 2223 if (params.child)
2215 style |= WS_CHILD | WS_VISIBLE; 2224 style |= WS_CHILD | WS_VISIBLE;
2225 if (params.maximize)
2226 style |= WS_MAXIMIZE;
2216 if (!params.accept_events) 2227 if (!params.accept_events)
2217 ex_style |= WS_EX_TRANSPARENT; 2228 ex_style |= WS_EX_TRANSPARENT;
2218 if (!params.can_activate) 2229 if (!params.can_activate)
2219 ex_style |= WS_EX_NOACTIVATE; 2230 ex_style |= WS_EX_NOACTIVATE;
2220 if (params.keep_on_top) 2231 if (params.keep_on_top)
2221 ex_style |= WS_EX_TOPMOST; 2232 ex_style |= WS_EX_TOPMOST;
2222 if (params.mirror_origin_in_rtl) 2233 if (params.mirror_origin_in_rtl)
2223 ex_style |= l10n_util::GetExtendedTooltipStyles(); 2234 ex_style |= l10n_util::GetExtendedTooltipStyles();
2224 if (params.transparent) 2235 if (params.transparent)
2225 ex_style |= WS_EX_LAYERED; 2236 ex_style |= WS_EX_LAYERED;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 return (GetKeyState(VK_LBUTTON) & 0x80) || 2579 return (GetKeyState(VK_LBUTTON) & 0x80) ||
2569 (GetKeyState(VK_RBUTTON) & 0x80) || 2580 (GetKeyState(VK_RBUTTON) & 0x80) ||
2570 (GetKeyState(VK_MBUTTON) & 0x80) || 2581 (GetKeyState(VK_MBUTTON) & 0x80) ||
2571 (GetKeyState(VK_XBUTTON1) & 0x80) || 2582 (GetKeyState(VK_XBUTTON1) & 0x80) ||
2572 (GetKeyState(VK_XBUTTON2) & 0x80); 2583 (GetKeyState(VK_XBUTTON2) & 0x80);
2573 } 2584 }
2574 2585
2575 } // namespace internal 2586 } // namespace internal
2576 2587
2577 } // namespace views 2588 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/native_widget_win.h ('k') | views/widget/widget.h » ('j') | views/widget/widget.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698