Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1945423002: views/mus: Connect cursor events to the mus window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add temporary if check. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/mus/native_widget_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 2410
2411 aura::Window* root_window = window_->GetRootWindow(); 2411 aura::Window* root_window = window_->GetRootWindow();
2412 if (!root_window) 2412 if (!root_window)
2413 return; 2413 return;
2414 2414
2415 display::Screen* screen = display::Screen::GetScreen(); 2415 display::Screen* screen = display::Screen::GetScreen();
2416 DCHECK(screen); 2416 DCHECK(screen);
2417 2417
2418 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint(); 2418 gfx::Point cursor_screen_point = screen->GetCursorScreenPoint();
2419 2419
2420 #if !defined(OS_CHROMEOS) 2420 #if defined(OS_WIN)
2421 // Ignore cursor update messages if the window under the cursor is not us. 2421 // Ignore cursor update messages if the window under the cursor is not us.
2422 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint( 2422 aura::Window* window_at_screen_point = screen->GetWindowAtScreenPoint(
2423 cursor_screen_point); 2423 cursor_screen_point);
2424 #if defined(OS_WIN) 2424
2425 // On Windows we may fail to retrieve the aura Window at the current cursor 2425 // On Windows we may fail to retrieve the aura Window at the current cursor
2426 // position. This is because the WindowFromPoint API may return the legacy 2426 // position. This is because the WindowFromPoint API may return the legacy
2427 // window which is not associated with an aura Window. In this case we need 2427 // window which is not associated with an aura Window. In this case we need
2428 // to get the aura window for the parent of the legacy window. 2428 // to get the aura window for the parent of the legacy window.
2429 if (!window_at_screen_point && legacy_render_widget_host_HWND_) { 2429 if (!window_at_screen_point && legacy_render_widget_host_HWND_) {
2430 HWND hwnd_at_point = ::WindowFromPoint(cursor_screen_point.ToPOINT()); 2430 HWND hwnd_at_point = ::WindowFromPoint(cursor_screen_point.ToPOINT());
2431 2431
2432 if (hwnd_at_point == legacy_render_widget_host_HWND_->hwnd()) 2432 if (hwnd_at_point == legacy_render_widget_host_HWND_->hwnd())
2433 hwnd_at_point = legacy_render_widget_host_HWND_->GetParent(); 2433 hwnd_at_point = legacy_render_widget_host_HWND_->GetParent();
2434 2434
2435 display::win::ScreenWin* screen_win = 2435 display::win::ScreenWin* screen_win =
2436 static_cast<display::win::ScreenWin*>(screen); 2436 static_cast<display::win::ScreenWin*>(screen);
2437 window_at_screen_point = screen_win->GetNativeWindowFromHWND( 2437 window_at_screen_point = screen_win->GetNativeWindowFromHWND(
2438 hwnd_at_point); 2438 hwnd_at_point);
2439 } 2439 }
2440 #endif 2440
2441 if (!window_at_screen_point || 2441 if (!window_at_screen_point ||
2442 (window_at_screen_point->GetRootWindow() != root_window)) { 2442 (window_at_screen_point->GetRootWindow() != root_window)) {
2443 return; 2443 return;
2444 } 2444 }
2445 #elif !defined(OS_CHROMEOS)
2446 if (!screen->IsWindowUnderCursor(window_))
2447 return;
2445 #endif 2448 #endif
2446 2449
2447 gfx::Point root_window_point = cursor_screen_point; 2450 gfx::Point root_window_point = cursor_screen_point;
2448 aura::client::ScreenPositionClient* screen_position_client = 2451 aura::client::ScreenPositionClient* screen_position_client =
2449 aura::client::GetScreenPositionClient(root_window); 2452 aura::client::GetScreenPositionClient(root_window);
2450 if (screen_position_client) { 2453 if (screen_position_client) {
2451 screen_position_client->ConvertPointFromScreen( 2454 screen_position_client->ConvertPointFromScreen(
2452 root_window, &root_window_point); 2455 root_window, &root_window_point);
2453 } 2456 }
2454 2457
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 2958
2956 //////////////////////////////////////////////////////////////////////////////// 2959 ////////////////////////////////////////////////////////////////////////////////
2957 // RenderWidgetHostViewBase, public: 2960 // RenderWidgetHostViewBase, public:
2958 2961
2959 // static 2962 // static
2960 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2963 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2961 GetScreenInfoForWindow(results, NULL); 2964 GetScreenInfoForWindow(results, NULL);
2962 } 2965 }
2963 2966
2964 } // namespace content 2967 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/native_widget_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698