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/views/widget/desktop_aura/desktop_root_window_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
6 | 6 |
7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 return false; | 460 return false; |
461 } | 461 } |
462 POINT pt = {0}; | 462 POINT pt = {0}; |
463 ::GetCursorPos(&pt); | 463 ::GetCursorPos(&pt); |
464 *location_return = | 464 *location_return = |
465 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); | 465 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); |
466 return true; | 466 return true; |
467 } | 467 } |
468 | 468 |
469 bool DesktopRootWindowHostWin::ConfineCursorToRootWindow() { | 469 bool DesktopRootWindowHostWin::ConfineCursorToRootWindow() { |
470 return false; | 470 RECT window_rect = root_window_->GetBoundsInScreen().ToRECT(); |
| 471 ::ClipCursor(&window_rect); |
| 472 return true; |
471 } | 473 } |
472 | 474 |
473 void DesktopRootWindowHostWin::UnConfineCursor() { | 475 void DesktopRootWindowHostWin::UnConfineCursor() { |
| 476 ::ClipCursor(NULL); |
474 } | 477 } |
475 | 478 |
476 void DesktopRootWindowHostWin::OnCursorVisibilityChanged(bool show) { | 479 void DesktopRootWindowHostWin::OnCursorVisibilityChanged(bool show) { |
| 480 ::ShowCursor(!!show); |
477 } | 481 } |
478 | 482 |
479 void DesktopRootWindowHostWin::MoveCursorTo(const gfx::Point& location) { | 483 void DesktopRootWindowHostWin::MoveCursorTo(const gfx::Point& location) { |
480 POINT cursor_location = location.ToPOINT(); | 484 POINT cursor_location = location.ToPOINT(); |
481 ::ClientToScreen(GetHWND(), &cursor_location); | 485 ::ClientToScreen(GetHWND(), &cursor_location); |
482 ::SetCursorPos(cursor_location.x, cursor_location.y); | 486 ::SetCursorPos(cursor_location.x, cursor_location.y); |
483 } | 487 } |
484 | 488 |
485 void DesktopRootWindowHostWin::SetFocusWhenShown(bool focus_when_shown) { | 489 void DesktopRootWindowHostWin::SetFocusWhenShown(bool focus_when_shown) { |
486 } | 490 } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 | 873 |
870 // static | 874 // static |
871 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 875 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
872 internal::NativeWidgetDelegate* native_widget_delegate, | 876 internal::NativeWidgetDelegate* native_widget_delegate, |
873 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 877 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
874 return new DesktopRootWindowHostWin(native_widget_delegate, | 878 return new DesktopRootWindowHostWin(native_widget_delegate, |
875 desktop_native_widget_aura); | 879 desktop_native_widget_aura); |
876 } | 880 } |
877 | 881 |
878 } // namespace views | 882 } // namespace views |
OLD | NEW |