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

Unified Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2830703003: [views-mus] Support custom cursors. (Closed)
Patch Set: fix cast_shell_linux Created 3 years, 8 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
« no previous file with comments | « ui/base/cursor/cursor_data.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/desktop_window_tree_host_mus.cc
diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc
index a5ad059bb0cd3e03a9b9a199c8f5fd7492c03d6f..1d054acf685c69ca66204eba3cb872745f867e9b 100644
--- a/ui/views/mus/desktop_window_tree_host_mus.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus.cc
@@ -35,6 +35,10 @@
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_client.h"
+#if defined(USE_OZONE)
+#include "ui/base/cursor/ozone/cursor_data_factory_ozone.h"
+#endif
+
namespace views {
namespace {
@@ -131,8 +135,21 @@ class NativeCursorManagerMus : public wm::NativeCursorManager {
void SetCursor(gfx::NativeCursor cursor,
wm::NativeCursorManagerDelegate* delegate) override {
- aura::WindowPortMus::Get(window_)->SetPredefinedCursor(
- ui::mojom::CursorType(cursor.native_type()));
+ ui::CursorData mojo_cursor;
+ if (cursor.platform()) {
+#if defined(USE_OZONE)
+ mojo_cursor =
+ ui::CursorDataFactoryOzone::GetCursorData(cursor.platform());
+#else
+ NOTIMPLEMENTED()
+ << "Can't pass native platform cursors on non-ozone platforms";
+ mojo_cursor = ui::CursorData(ui::CursorType::kPointer);
+#endif
+ } else {
+ mojo_cursor = ui::CursorData(cursor.native_type());
+ }
+
+ aura::WindowPortMus::Get(window_)->SetCursor(mojo_cursor);
delegate->CommitCursor(cursor);
}
@@ -143,8 +160,8 @@ class NativeCursorManagerMus : public wm::NativeCursorManager {
if (visible) {
SetCursor(delegate->GetCursor(), delegate);
} else {
- aura::WindowPortMus::Get(window_)->SetPredefinedCursor(
- ui::mojom::CursorType::kNone);
+ aura::WindowPortMus::Get(window_)->SetCursor(
+ ui::CursorData(ui::CursorType::kNone));
}
}
« no previous file with comments | « ui/base/cursor/cursor_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698