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/aura/root_window_host_win.h" | 5 #include "ui/aura/root_window_host_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 MSG msg = { hwnd(), message, w_param, l_param }; | 244 MSG msg = { hwnd(), message, w_param, l_param }; |
245 ui::KeyEvent keyev(msg, message == WM_CHAR); | 245 ui::KeyEvent keyev(msg, message == WM_CHAR); |
246 SetMsgHandled(delegate_->OnHostKeyEvent(&keyev)); | 246 SetMsgHandled(delegate_->OnHostKeyEvent(&keyev)); |
247 return 0; | 247 return 0; |
248 } | 248 } |
249 | 249 |
250 LRESULT WindowTreeHostWin::OnMouseRange(UINT message, | 250 LRESULT WindowTreeHostWin::OnMouseRange(UINT message, |
251 WPARAM w_param, | 251 WPARAM w_param, |
252 LPARAM l_param) { | 252 LPARAM l_param) { |
253 MSG msg = { hwnd(), message, w_param, l_param, 0, | 253 MSG msg = { hwnd(), message, w_param, l_param, 0, |
254 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; | 254 { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } }; |
255 ui::MouseEvent event(msg); | 255 ui::MouseEvent event(msg); |
256 bool handled = false; | 256 bool handled = false; |
257 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) | 257 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) |
258 handled = delegate_->OnHostMouseEvent(&event); | 258 handled = delegate_->OnHostMouseEvent(&event); |
259 SetMsgHandled(handled); | 259 SetMsgHandled(handled); |
260 return 0; | 260 return 0; |
261 } | 261 } |
262 | 262 |
263 LRESULT WindowTreeHostWin::OnCaptureChanged(UINT message, | 263 LRESULT WindowTreeHostWin::OnCaptureChanged(UINT message, |
264 WPARAM w_param, | 264 WPARAM w_param, |
265 LPARAM l_param) { | 265 LPARAM l_param) { |
266 if (has_capture_) { | 266 if (has_capture_) { |
267 has_capture_ = false; | 267 has_capture_ = false; |
268 delegate_->OnHostLostWindowCapture(); | 268 delegate_->OnHostLostWindowCapture(); |
269 } | 269 } |
270 return 0; | 270 return 0; |
271 } | 271 } |
272 | 272 |
273 LRESULT WindowTreeHostWin::OnNCActivate(UINT message, | 273 LRESULT WindowTreeHostWin::OnNCActivate(UINT message, |
274 WPARAM w_param, | 274 WPARAM w_param, |
275 LPARAM l_param) { | 275 LPARAM l_param) { |
276 if (!!w_param) | 276 if (!!w_param) |
277 delegate_->OnHostActivated(); | 277 delegate_->OnHostActivated(); |
278 return DefWindowProc(hwnd(), message, w_param, l_param); | 278 return DefWindowProc(hwnd(), message, w_param, l_param); |
279 } | 279 } |
280 | 280 |
281 void WindowTreeHostWin::OnMove(const CPoint& point) { | 281 void WindowTreeHostWin::OnMove(const gfx::Point& point) { |
282 if (delegate_) | 282 if (delegate_) |
283 delegate_->OnHostMoved(gfx::Point(point.x, point.y)); | 283 delegate_->OnHostMoved(point); |
284 } | 284 } |
285 | 285 |
286 void WindowTreeHostWin::OnPaint(HDC dc) { | 286 void WindowTreeHostWin::OnPaint(HDC dc) { |
287 gfx::Rect damage_rect; | 287 gfx::Rect damage_rect; |
288 RECT update_rect = {0}; | 288 RECT update_rect = {0}; |
289 if (GetUpdateRect(hwnd(), &update_rect, FALSE)) | 289 if (GetUpdateRect(hwnd(), &update_rect, FALSE)) |
290 damage_rect = gfx::Rect(update_rect); | 290 damage_rect = gfx::Rect(update_rect); |
291 compositor()->ScheduleRedrawRect(damage_rect); | 291 compositor()->ScheduleRedrawRect(damage_rect); |
292 ValidateRect(hwnd(), NULL); | 292 ValidateRect(hwnd(), NULL); |
293 } | 293 } |
294 | 294 |
295 void WindowTreeHostWin::OnSize(UINT param, const CSize& size) { | 295 void WindowTreeHostWin::OnSize(UINT param, const gfx::Size& size) { |
296 // Minimizing resizes the window to 0x0 which causes our layout to go all | 296 // Minimizing resizes the window to 0x0 which causes our layout to go all |
297 // screwy, so we just ignore it. | 297 // screwy, so we just ignore it. |
298 if (delegate_ && param != SIZE_MINIMIZED) | 298 if (delegate_ && param != SIZE_MINIMIZED) |
299 NotifyHostResized(gfx::Size(size.cx, size.cy)); | 299 NotifyHostResized(size); |
300 } | 300 } |
301 | 301 |
302 namespace test { | 302 namespace test { |
303 | 303 |
304 // static | 304 // static |
305 void SetUsePopupAsRootWindowForTest(bool use) { | 305 void SetUsePopupAsRootWindowForTest(bool use) { |
306 use_popup_as_root_window_for_test = use; | 306 use_popup_as_root_window_for_test = use; |
307 } | 307 } |
308 | 308 |
309 } // namespace test | 309 } // namespace test |
310 | 310 |
311 } // namespace aura | 311 } // namespace aura |
OLD | NEW |