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

Side by Side Diff: ash/display/display_controller.cc

Issue 902123002: Fix initial hiding and centering cursor on Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | ash/display/mouse_cursor_event_filter_unittest.cc » ('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 "ash/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 10
(...skipping 12 matching lines...) Expand all
23 #include "ash/shell.h" 23 #include "ash/shell.h"
24 #include "ash/shell_delegate.h" 24 #include "ash/shell_delegate.h"
25 #include "ash/wm/coordinate_conversion.h" 25 #include "ash/wm/coordinate_conversion.h"
26 #include "base/command_line.h" 26 #include "base/command_line.h"
27 #include "base/stl_util.h" 27 #include "base/stl_util.h"
28 #include "base/strings/stringprintf.h" 28 #include "base/strings/stringprintf.h"
29 #include "base/strings/utf_string_conversions.h" 29 #include "base/strings/utf_string_conversions.h"
30 #include "ui/aura/client/capture_client.h" 30 #include "ui/aura/client/capture_client.h"
31 #include "ui/aura/client/focus_client.h" 31 #include "ui/aura/client/focus_client.h"
32 #include "ui/aura/client/screen_position_client.h" 32 #include "ui/aura/client/screen_position_client.h"
33 #include "ui/aura/env.h"
33 #include "ui/aura/window.h" 34 #include "ui/aura/window.h"
34 #include "ui/aura/window_event_dispatcher.h" 35 #include "ui/aura/window_event_dispatcher.h"
35 #include "ui/aura/window_property.h" 36 #include "ui/aura/window_property.h"
36 #include "ui/aura/window_tracker.h" 37 #include "ui/aura/window_tracker.h"
37 #include "ui/aura/window_tree_host.h" 38 #include "ui/aura/window_tree_host.h"
38 #include "ui/compositor/compositor.h" 39 #include "ui/compositor/compositor.h"
39 #include "ui/compositor/compositor_vsync_manager.h" 40 #include "ui/compositor/compositor_vsync_manager.h"
40 #include "ui/gfx/display.h" 41 #include "ui/gfx/display.h"
41 #include "ui/gfx/screen.h" 42 #include "ui/gfx/screen.h"
42 #include "ui/wm/public/activation_client.h" 43 #include "ui/wm/public/activation_client.h"
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 display_info_list.push_back(display_manager->GetDisplayInfo( 531 display_info_list.push_back(display_manager->GetDisplayInfo(
531 primary_display_id)); 532 primary_display_id));
532 display_info_list.push_back(display_manager->GetDisplayInfo( 533 display_info_list.push_back(display_manager->GetDisplayInfo(
533 ScreenUtil::GetSecondaryDisplay().id())); 534 ScreenUtil::GetSecondaryDisplay().id()));
534 GetDisplayManager()->set_force_bounds_changed(true); 535 GetDisplayManager()->set_force_bounds_changed(true);
535 GetDisplayManager()->UpdateDisplays(display_info_list); 536 GetDisplayManager()->UpdateDisplays(display_info_list);
536 GetDisplayManager()->set_force_bounds_changed(false); 537 GetDisplayManager()->set_force_bounds_changed(false);
537 } 538 }
538 539
539 void DisplayController::EnsurePointerInDisplays() { 540 void DisplayController::EnsurePointerInDisplays() {
541 if (!aura::Env::GetInstance()->mouse_moved() &&
pkotwicz 2015/02/06 16:12:44 I am unsure whether checking whether the mouse was
542 Shell::initially_hide_cursor()) {
543 // Do not move the cursor if the cursor has not yet been moved and the
544 // cursor is initially hidden. Moving the cursor generates a mouse event
545 // which shows the cursor.
546 return;
547 }
548
540 // If the mouse is currently on a display in native location, 549 // If the mouse is currently on a display in native location,
541 // use the same native location. Otherwise find the display closest 550 // use the same native location. Otherwise find the display closest
542 // to the current cursor location in screen coordinates. 551 // to the current cursor location in screen coordinates.
543 552
544 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); 553 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint();
545 gfx::Point target_location_in_native; 554 gfx::Point target_location_in_native;
546 int64 closest_distance_squared = -1; 555 int64 closest_distance_squared = -1;
547 DisplayManager* display_manager = GetDisplayManager(); 556 DisplayManager* display_manager = GetDisplayManager();
548 557
549 aura::Window* dst_root_window = NULL; 558 aura::Window* dst_root_window = NULL;
(...skipping 23 matching lines...) Expand all
573 aura::client::GetScreenPositionClient(root_window); 582 aura::client::GetScreenPositionClient(root_window);
574 client->ConvertPointFromScreen(root_window, &center); 583 client->ConvertPointFromScreen(root_window, &center);
575 root_window->GetHost()->ConvertPointToNativeScreen(&center); 584 root_window->GetHost()->ConvertPointToNativeScreen(&center);
576 dst_root_window = root_window; 585 dst_root_window = root_window;
577 target_location_in_native = center; 586 target_location_in_native = center;
578 closest_distance_squared = distance_squared; 587 closest_distance_squared = distance_squared;
579 } 588 }
580 } 589 }
581 dst_root_window->GetHost()->ConvertPointFromNativeScreen( 590 dst_root_window->GetHost()->ConvertPointFromNativeScreen(
582 &target_location_in_native); 591 &target_location_in_native);
583 dst_root_window->MoveCursorTo(target_location_in_native); 592 dst_root_window->MoveCursorTo(target_location_in_native);
oshima 2015/02/10 22:01:57 This was added to make sure that X cursor stays in
pkotwicz 2015/02/12 01:52:55 This bug occurs on both X and Ozone so we need to
oshima 2015/02/12 02:08:57 My point is that this method was added because cur
pkotwicz 2015/02/12 02:37:41 How do you suggest fixing this bug on CrOS X11 (or
584 } 593 }
585 594
586 bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow( 595 bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow(
587 const aura::Window* window, 596 const aura::Window* window,
588 const gfx::Insets& insets) { 597 const gfx::Insets& insets) {
589 const aura::Window* root_window = window->GetRootWindow(); 598 const aura::Window* root_window = window->GetRootWindow();
590 int64 id = GetRootWindowSettings(root_window)->display_id; 599 int64 id = GetRootWindowSettings(root_window)->display_id;
591 // if id is |kInvaildDisplayID|, it's being deleted. 600 // if id is |kInvaildDisplayID|, it's being deleted.
592 DCHECK(id != gfx::Display::kInvalidDisplayID); 601 DCHECK(id != gfx::Display::kInvalidDisplayID);
593 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets); 602 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 std::string name = 819 std::string name =
811 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; 820 root_windows[i] == primary ? "aura_root_0" : "aura_root_x";
812 gfx::AcceleratedWidget xwindow = 821 gfx::AcceleratedWidget xwindow =
813 root_windows[i]->GetHost()->GetAcceleratedWidget(); 822 root_windows[i]->GetHost()->GetAcceleratedWidget();
814 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); 823 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str());
815 } 824 }
816 #endif 825 #endif
817 } 826 }
818 827
819 } // namespace ash 828 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/mouse_cursor_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698