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

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

Issue 1465803003: mus: Let clients set the cursor of their window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync pass the nacl breakage Created 5 years 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: ui/views/mus/platform_window_mus.cc
diff --git a/ui/views/mus/platform_window_mus.cc b/ui/views/mus/platform_window_mus.cc
index 132e4b4e7f6ae5ef0f103a25845898c9c2a6ace8..2aaa5ac34556ecb87019ba10228798589997a75e 100644
--- a/ui/views/mus/platform_window_mus.cc
+++ b/ui/views/mus/platform_window_mus.cc
@@ -23,6 +23,7 @@ PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate,
: delegate_(delegate),
mus_window_(mus_window),
show_state_(mus::mojom::SHOW_STATE_RESTORED),
+ last_cursor_(mus::mojom::CURSOR_NULL),
has_capture_(false) {
DCHECK(delegate_);
DCHECK(mus_window_);
@@ -54,6 +55,17 @@ void PlatformWindowMus::Activate() {
mus_window_->SetFocus();
}
+void PlatformWindowMus::SetCursorById(mus::mojom::Cursor cursor) {
+ if (last_cursor_ != cursor) {
+ // The ui::PlatformWindow interface uses ui::PlatformCursor at this level,
+ // instead of ui::Cursor. All of the cursor abstractions in ui right now are
+ // sort of leaky; despite being nominally cross platform, they all drop down
+ // to platform types almost immediately, which makes them unusable as
+ // transport types.
+ mus_window_->SetStandardCursor(cursor);
+ }
+}
+
void PlatformWindowMus::Show() {
mus_window_->SetVisible(true);
}
@@ -147,6 +159,12 @@ void PlatformWindowMus::OnWindowFocusChanged(mus::Window* gained_focus,
delegate_->OnActivationChanged(false);
}
+void PlatformWindowMus::OnWindowCursorChanged(mus::Window* window,
+ mus::mojom::Cursor cursor) {
+ if (window == mus_window_)
sky 2015/12/01 21:48:01 DCHECK?
+ last_cursor_ = cursor;
+}
+
void PlatformWindowMus::OnWindowInputEvent(mus::Window* view,
const mus::mojom::EventPtr& event) {
scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event>>());
« components/mus/ws/window_tree_impl.cc ('K') | « ui/views/mus/platform_window_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698