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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 gfx::Point DesktopHostWin::QueryMouseLocation() { | 219 gfx::Point DesktopHostWin::QueryMouseLocation() { |
220 POINT pt; | 220 POINT pt; |
221 GetCursorPos(&pt); | 221 GetCursorPos(&pt); |
222 ScreenToClient(hwnd(), &pt); | 222 ScreenToClient(hwnd(), &pt); |
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) { |
| 229 ::PostMessage( |
| 230 hwnd(), native_event.message, native_event.wParam, native_event.lParam); |
| 231 } |
| 232 |
228 void DesktopHostWin::OnClose() { | 233 void DesktopHostWin::OnClose() { |
229 // TODO: this obviously shouldn't be here. | 234 // TODO: this obviously shouldn't be here. |
230 MessageLoopForUI::current()->Quit(); | 235 MessageLoopForUI::current()->Quit(); |
231 } | 236 } |
232 | 237 |
233 LRESULT DesktopHostWin::OnKeyEvent(UINT message, | 238 LRESULT DesktopHostWin::OnKeyEvent(UINT message, |
234 WPARAM w_param, | 239 WPARAM w_param, |
235 LPARAM l_param) { | 240 LPARAM l_param) { |
236 MSG msg = { hwnd(), message, w_param, l_param }; | 241 MSG msg = { hwnd(), message, w_param, l_param }; |
237 KeyEvent keyev(msg, message == WM_CHAR); | 242 KeyEvent keyev(msg, message == WM_CHAR); |
(...skipping 20 matching lines...) Expand all Loading... |
258 } | 263 } |
259 | 264 |
260 void DesktopHostWin::OnSize(UINT param, const CSize& size) { | 265 void DesktopHostWin::OnSize(UINT param, const CSize& size) { |
261 // Minimizing resizes the window to 0x0 which causes our layout to go all | 266 // Minimizing resizes the window to 0x0 which causes our layout to go all |
262 // screwy, so we just ignore it. | 267 // screwy, so we just ignore it. |
263 if (param != SIZE_MINIMIZED) | 268 if (param != SIZE_MINIMIZED) |
264 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); | 269 desktop_->OnHostResized(gfx::Size(size.cx, size.cy)); |
265 } | 270 } |
266 | 271 |
267 } // namespace aura | 272 } // namespace aura |
OLD | NEW |