OLD | NEW |
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 "ui/aura/desktop_host_win.h" | 5 #include "ui/aura/desktop_host_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 const gfx::Size size = GetSize(); | 223 const gfx::Size size = GetSize(); |
224 return gfx::Point(max(0, min(size.width(), static_cast<int>(pt.x))), | 224 return gfx::Point(max(0, min(size.width(), static_cast<int>(pt.x))), |
225 max(0, min(size.height(), static_cast<int>(pt.y)))); | 225 max(0, min(size.height(), static_cast<int>(pt.y)))); |
226 } | 226 } |
227 | 227 |
228 void DesktopHostWin::PostNativeEvent(const base::NativeEvent& native_event) { | 228 void DesktopHostWin::PostNativeEvent(const base::NativeEvent& native_event) { |
229 ::PostMessage( | 229 ::PostMessage( |
230 hwnd(), native_event.message, native_event.wParam, native_event.lParam); | 230 hwnd(), native_event.message, native_event.wParam, native_event.lParam); |
231 } | 231 } |
232 | 232 |
| 233 void DesktopHostWin::ConvertPointToNativeScreen(gfx::Point* point) const { |
| 234 RECT r; |
| 235 GetClientRect(hwnd(), &r); |
| 236 point->Offset(r.left, r.top); |
| 237 } |
| 238 |
233 void DesktopHostWin::OnClose() { | 239 void DesktopHostWin::OnClose() { |
234 // TODO: this obviously shouldn't be here. | 240 // TODO: this obviously shouldn't be here. |
235 MessageLoopForUI::current()->Quit(); | 241 MessageLoopForUI::current()->Quit(); |
236 } | 242 } |
237 | 243 |
238 LRESULT DesktopHostWin::OnKeyEvent(UINT message, | 244 LRESULT DesktopHostWin::OnKeyEvent(UINT message, |
239 WPARAM w_param, | 245 WPARAM w_param, |
240 LPARAM l_param) { | 246 LPARAM l_param) { |
241 MSG msg = { hwnd(), message, w_param, l_param }; | 247 MSG msg = { hwnd(), message, w_param, l_param }; |
242 KeyEvent keyev(msg, message == WM_CHAR); | 248 KeyEvent keyev(msg, message == WM_CHAR); |
(...skipping 20 matching lines...) Expand all Loading... |
263 } | 269 } |
264 | 270 |
265 void DesktopHostWin::OnSize(UINT param, const CSize& size) { | 271 void DesktopHostWin::OnSize(UINT param, const CSize& size) { |
266 // Minimizing resizes the window to 0x0 which causes our layout to go all | 272 // Minimizing resizes the window to 0x0 which causes our layout to go all |
267 // screwy, so we just ignore it. | 273 // screwy, so we just ignore it. |
268 if (param != SIZE_MINIMIZED) | 274 if (param != SIZE_MINIMIZED) |
269 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); | 275 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); |
270 } | 276 } |
271 | 277 |
272 } // namespace aura | 278 } // namespace aura |
OLD | NEW |