OLD | NEW |
---|---|
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/base/win/hwnd_util.h" | 5 #include "ui/base/win/hwnd_util.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/win/metro.h" | |
9 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
11 | 12 |
12 namespace ui { | 13 namespace ui { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Adjust the window to fit. | 17 // Adjust the window to fit. |
17 void AdjustWindowToFit(HWND hwnd, const RECT& bounds, bool fit_to_monitor) { | 18 void AdjustWindowToFit(HWND hwnd, const RECT& bounds, bool fit_to_monitor) { |
18 if (fit_to_monitor) { | 19 if (fit_to_monitor) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; | 175 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; |
175 if (base::i18n::IsRTL()) | 176 if (base::i18n::IsRTL()) |
176 flags |= TPM_RIGHTALIGN; | 177 flags |= TPM_RIGHTALIGN; |
177 HMENU system_menu = GetSystemMenu(window, FALSE); | 178 HMENU system_menu = GetSystemMenu(window, FALSE); |
178 int command = TrackPopupMenu(system_menu, flags, screen_x, screen_y, 0, | 179 int command = TrackPopupMenu(system_menu, flags, screen_x, screen_y, 0, |
179 window, NULL); | 180 window, NULL); |
180 if (command) | 181 if (command) |
181 SendMessage(window, WM_SYSCOMMAND, command, 0); | 182 SendMessage(window, WM_SYSCOMMAND, command, 0); |
182 } | 183 } |
183 | 184 |
185 extern "C" { | |
186 typedef HWND (*RootWindow)(); | |
187 } | |
188 | |
189 HWND GetRootWindow(bool is_child_window) { | |
190 HMODULE metro = base::win::GetMetroModule(); | |
191 if (!metro) { | |
sky
2012/05/01 15:40:39
nit: no {}
| |
192 return is_child_window ? ::GetDesktopWindow() : HWND_DESKTOP; | |
193 } | |
194 // In windows 8 metro-mode the root window is not the desktop. | |
195 RootWindow root_window = | |
196 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); | |
197 return root_window(); | |
198 } | |
199 | |
184 } // namespace ui | 200 } // namespace ui |
OLD | NEW |