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

Unified Diff: components/exo/wm_helper_ash.cc

Issue 2780623002: exo: Fix multi-display hardware cursor (Closed)
Patch Set: Rebase properly Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/exo/wm_helper_ash.cc
diff --git a/components/exo/wm_helper_ash.cc b/components/exo/wm_helper_ash.cc
index 453b547c04004730be765dfbccbdd5d27eabcd9e..40674a979531294031dcc72448a6012e5ca38ec0 100644
--- a/components/exo/wm_helper_ash.cc
+++ b/components/exo/wm_helper_ash.cc
@@ -7,7 +7,9 @@
#include "ash/common/accessibility_delegate.h"
#include "ash/common/system/tray/system_tray_notifier.h"
#include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
+#include "ash/root_window_controller.h"
#include "ash/shell.h"
+#include "ash/wm/ash_native_cursor_manager.h"
#include "base/memory/singleton.h"
#include "ui/aura/client/focus_client.h"
#include "ui/display/manager/display_manager.h"
@@ -23,6 +25,7 @@ WMHelperAsh::WMHelperAsh() {
ash::Shell::GetInstance()->AddShellObserver(this);
ash::Shell::GetInstance()->activation_client()->AddObserver(this);
ash::Shell::GetInstance()->cursor_manager()->AddObserver(this);
+ ash::Shell::GetInstance()->native_cursor_manager()->AddObserver(this);
ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this);
aura::client::FocusClient* focus_client =
aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
@@ -38,6 +41,7 @@ WMHelperAsh::~WMHelperAsh() {
aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
focus_client->RemoveObserver(this);
ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
+ ash::Shell::GetInstance()->native_cursor_manager()->RemoveObserver(this);
ash::Shell::GetInstance()->cursor_manager()->RemoveObserver(this);
ash::Shell::GetInstance()->activation_client()->RemoveObserver(this);
ash::Shell::GetInstance()->RemoveShellObserver(this);
@@ -54,9 +58,13 @@ const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo(
display_id);
}
-aura::Window* WMHelperAsh::GetContainer(int container_id) {
- return ash::Shell::GetContainer(ash::Shell::GetRootWindowForNewWindows(),
- container_id);
+aura::Window* WMHelperAsh::GetContainer(int64_t display_id, int container_id) {
+ ash::RootWindowController* controller =
+ ash::Shell::GetRootWindowControllerWithDisplayId(display_id);
+ return ash::Shell::GetContainer(
+ controller ? controller->GetRootWindow()
+ : ash::Shell::GetRootWindowForNewWindows(),
+ container_id);
}
aura::Window* WMHelperAsh::GetActiveWindow() const {
@@ -110,6 +118,12 @@ void WMHelperAsh::PlayEarcon(int sound_key) const {
sound_key);
}
+void WMHelperAsh::SetCursor(gfx::NativeCursor cursor) {
+ ash::Shell* shell = ash::Shell::GetInstance();
+ static_cast<wm::NativeCursorManager*>(shell->native_cursor_manager())
+ ->SetCursor(cursor, shell->cursor_manager());
+}
+
void WMHelperAsh::OnWindowActivated(
aura::client::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
@@ -130,6 +144,10 @@ void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) {
NotifyCursorSetChanged(cursor_set);
}
+void WMHelperAsh::OnCursorDisplayChanging(const display::Display& display) {
+ NotifyCursorDisplayChanging(display);
+}
+
void WMHelperAsh::OnAccessibilityModeChanged(
ash::AccessibilityNotificationVisibility notify) {
NotifyAccessibilityModeChanged();

Powered by Google App Engine
This is Rietveld 408576698