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

Side by Side Diff: ui/base/win/window_impl.cc

Issue 10270029: Fullscreen can't use the desktop as a parent in metro mode (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | « ui/base/win/hwnd_util.cc ('k') | no next file » | 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) 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/window_impl.h" 5 #include "ui/base/win/window_impl.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/win/wrapped_window_proc.h" 12 #include "base/win/wrapped_window_proc.h"
13 #include "ui/base/win/hwnd_util.h" 13 #include "ui/base/win/hwnd_util.h"
14 14
15 namespace {
16
17 extern "C" {
18 typedef HWND (*GetRootWindow)();
19 }
20
21 HMODULE GetMetroDll() {
22 static HMODULE hm = ::GetModuleHandleA("metro_driver.dll");
23 return hm;
24 }
25
26 HWND RootWindow(bool is_child_window) {
27 HMODULE metro = GetMetroDll();
28 if (!metro) {
29 return is_child_window ? ::GetDesktopWindow() : HWND_DESKTOP;
30 }
31 GetRootWindow get_root_window =
32 reinterpret_cast<GetRootWindow>(::GetProcAddress(metro, "GetRootWindow"));
33 return get_root_window();
34 }
35
36 } // namespace
37
38 namespace ui { 15 namespace ui {
39 16
40 static const DWORD kWindowDefaultChildStyle = 17 static const DWORD kWindowDefaultChildStyle =
41 WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; 18 WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
42 static const DWORD kWindowDefaultStyle = WS_OVERLAPPEDWINDOW; 19 static const DWORD kWindowDefaultStyle = WS_OVERLAPPEDWINDOW;
43 static const DWORD kWindowDefaultExStyle = 0; 20 static const DWORD kWindowDefaultExStyle = 0;
44 21
45 /////////////////////////////////////////////////////////////////////////////// 22 ///////////////////////////////////////////////////////////////////////////////
46 // WindowImpl class tracking. 23 // WindowImpl class tracking.
47 24
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ui::SetWindowUserData(hwnd_, NULL); 134 ui::SetWindowUserData(hwnd_, NULL);
158 } 135 }
159 136
160 void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) { 137 void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) {
161 if (window_style_ == 0) 138 if (window_style_ == 0)
162 window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle; 139 window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle;
163 140
164 if (parent == HWND_DESKTOP) { 141 if (parent == HWND_DESKTOP) {
165 // Only non-child windows can have HWND_DESKTOP (0) as their parent. 142 // Only non-child windows can have HWND_DESKTOP (0) as their parent.
166 CHECK((window_style_ & WS_CHILD) == 0); 143 CHECK((window_style_ & WS_CHILD) == 0);
167 parent = RootWindow(false); 144 parent = GetWindowToParentTo(false);
168 } else if (parent == ::GetDesktopWindow()) { 145 } else if (parent == ::GetDesktopWindow()) {
169 // Any type of window can have the "Desktop Window" as their parent. 146 // Any type of window can have the "Desktop Window" as their parent.
170 parent = RootWindow(true); 147 parent = GetWindowToParentTo(true);
171 } else if (parent != HWND_MESSAGE) { 148 } else if (parent != HWND_MESSAGE) {
172 CHECK(::IsWindow(parent)); 149 CHECK(::IsWindow(parent));
173 } 150 }
174 151
175 int x, y, width, height; 152 int x, y, width, height;
176 if (bounds.IsEmpty()) { 153 if (bounds.IsEmpty()) {
177 x = y = width = height = CW_USEDEFAULT; 154 x = y = width = height = CW_USEDEFAULT;
178 } else { 155 } else {
179 x = bounds.x(); 156 x = bounds.x();
180 y = bounds.y(); 157 y = bounds.y();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 }; 257 };
281 ATOM atom = RegisterClassEx(&class_ex); 258 ATOM atom = RegisterClassEx(&class_ex);
282 CHECK(atom) << GetLastError(); 259 CHECK(atom) << GetLastError();
283 260
284 ClassRegistrar::GetInstance()->RegisterClass(class_info, name, atom); 261 ClassRegistrar::GetInstance()->RegisterClass(class_info, name, atom);
285 262
286 return name; 263 return name;
287 } 264 }
288 265
289 } // namespace ui 266 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/hwnd_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698