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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 #include "ui/wm/public/transient_window_client.h" | 91 #include "ui/wm/public/transient_window_client.h" |
92 #include "ui/wm/public/window_types.h" | 92 #include "ui/wm/public/window_types.h" |
93 | 93 |
94 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
95 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 95 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
96 #include "content/browser/accessibility/browser_accessibility_win.h" | 96 #include "content/browser/accessibility/browser_accessibility_win.h" |
97 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 97 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
98 #include "content/common/plugin_constants_win.h" | 98 #include "content/common/plugin_constants_win.h" |
99 #include "ui/base/win/hidden_window.h" | 99 #include "ui/base/win/hidden_window.h" |
100 #include "ui/gfx/gdi_util.h" | 100 #include "ui/gfx/gdi_util.h" |
101 #include "ui/gfx/screen_win.h" | |
101 #include "ui/gfx/win/dpi.h" | 102 #include "ui/gfx/win/dpi.h" |
102 #endif | 103 #endif |
103 | 104 |
104 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 105 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
105 #include "content/common/input_messages.h" | 106 #include "content/common/input_messages.h" |
106 #include "ui/events/linux/text_edit_command_auralinux.h" | 107 #include "ui/events/linux/text_edit_command_auralinux.h" |
107 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" | 108 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h" |
108 #endif | 109 #endif |
109 | 110 |
110 using gfx::RectToSkIRect; | 111 using gfx::RectToSkIRect; |
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2464 } | 2465 } |
2465 | 2466 |
2466 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2467 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
2467 if (host_->GetProcess()->FastShutdownStarted()) | 2468 if (host_->GetProcess()->FastShutdownStarted()) |
2468 return; | 2469 return; |
2469 | 2470 |
2470 aura::Window* root_window = window_->GetRootWindow(); | 2471 aura::Window* root_window = window_->GetRootWindow(); |
2471 if (!root_window) | 2472 if (!root_window) |
2472 return; | 2473 return; |
2473 | 2474 |
2474 gfx::Point root_window_point = | 2475 gfx::Screen* screen = gfx::Screen::GetScreenFor(GetNativeView()); |
2475 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 2476 DCHECK(screen); |
2477 | |
2478 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); | |
2479 | |
2480 // Ignore cursor update messages if the window under the cursor is not us. | |
2481 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( | |
2482 cursor_screen_point);; | |
sky
2015/11/13 16:12:18
nit: only one ';'.
ananta
2015/11/13 20:09:41
Done.
| |
2483 #if defined(OS_WIN) | |
2484 // On Windows we may fail to retrieve the aura Window at the current cursor | |
2485 // position. This is because the WindowFromPoint API may return the legacy | |
2486 // window which is not associated with an aura Window. In this case we need | |
2487 // to get the aura window for the parent of the legacy window. | |
2488 if (!window_at_screen_point) { | |
2489 HWND hwnd_at_point = ::WindowFromPoint(cursor_screen_point.ToPOINT()); | |
2490 if (legacy_render_widget_host_HWND_ && | |
2491 (hwnd_at_point == legacy_render_widget_host_HWND_->hwnd())) { | |
2492 hwnd_at_point = legacy_render_widget_host_HWND_->GetParent(); | |
2493 } | |
2494 gfx::ScreenWin* screen_win = static_cast<gfx::ScreenWin*>(screen); | |
sky
2015/11/13 16:12:18
What happens if running in metro mode?
ananta
2015/11/13 20:09:41
In metro mode we should not be hitting the if (!wi
| |
2495 DCHECK(screen_win); | |
2496 window_at_screen_point = screen_win->GetNativeWindowFromHWND( | |
2497 hwnd_at_point); | |
2498 } | |
2499 #endif | |
2500 if (!window_at_screen_point || | |
2501 (window_at_screen_point->GetRootWindow() != root_window)) { | |
2502 return; | |
2503 } | |
2504 | |
2505 gfx::Point root_window_point = cursor_screen_point; | |
2476 aura::client::ScreenPositionClient* screen_position_client = | 2506 aura::client::ScreenPositionClient* screen_position_client = |
2477 aura::client::GetScreenPositionClient(root_window); | 2507 aura::client::GetScreenPositionClient(root_window); |
2478 if (screen_position_client) { | 2508 if (screen_position_client) { |
2479 screen_position_client->ConvertPointFromScreen( | 2509 screen_position_client->ConvertPointFromScreen( |
2480 root_window, &root_window_point); | 2510 root_window, &root_window_point); |
2481 } | 2511 } |
2482 | 2512 |
2483 if (root_window->GetEventHandlerForPoint(root_window_point) != window_) | 2513 if (root_window->GetEventHandlerForPoint(root_window_point) != window_) |
2484 return; | 2514 return; |
2485 | 2515 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2913 | 2943 |
2914 //////////////////////////////////////////////////////////////////////////////// | 2944 //////////////////////////////////////////////////////////////////////////////// |
2915 // RenderWidgetHostViewBase, public: | 2945 // RenderWidgetHostViewBase, public: |
2916 | 2946 |
2917 // static | 2947 // static |
2918 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2948 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2919 GetScreenInfoForWindow(results, NULL); | 2949 GetScreenInfoForWindow(results, NULL); |
2920 } | 2950 } |
2921 | 2951 |
2922 } // namespace content | 2952 } // namespace content |
OLD | NEW |