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

Unified Diff: components/mus/public/cpp/lib/window_tree_client_impl.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: Do it the other way + explicit checks that it is a mouse pointer. 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: components/mus/public/cpp/lib/window_tree_client_impl.cc
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc
index 2b094e96cdc0aa071aa8b3cd18e2d40e3d0b7f0d..331b8664c9836adb916850dae0ff6cf7403a24f8 100644
--- a/components/mus/public/cpp/lib/window_tree_client_impl.cc
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc
@@ -222,6 +222,20 @@ void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) {
tree_->SetCanFocus(window_id, can_focus);
}
+void WindowTreeClientImpl::SetPredefinedCursor(Id window_id,
+ mus::mojom::Cursor cursor_id) {
+ DCHECK(tree_);
+
+ Window* window = GetWindowById(window_id);
+ if (!window)
+ return;
+
+ // We make an inflight change thing here.
+ const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr(
+ new InFlightPredefinedCursorChange(window, window->predefined_cursor())));
+ tree_->SetPredefinedCursor(change_id, window_id, cursor_id);
+}
+
void WindowTreeClientImpl::SetVisible(Window* window, bool visible) {
DCHECK(tree_);
const uint32_t change_id = ScheduleInFlightChange(
@@ -597,6 +611,20 @@ void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) {
}
}
+void WindowTreeClientImpl::OnWindowPredefinedCursorChanged(
+ Id window_id,
+ mojom::Cursor cursor) {
+ Window* window = GetWindowById(window_id);
+ if (!window)
+ return;
+
+ InFlightPredefinedCursorChange new_change(window, cursor);
+ if (ApplyServerChangeToExistingInFlightChange(new_change))
+ return;
+
+ WindowPrivate(window).LocalSetPredefinedCursor(cursor);
+}
+
void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) {
scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
in_flight_map_.erase(change_id);
« no previous file with comments | « components/mus/public/cpp/lib/window_tree_client_impl.h ('k') | components/mus/public/cpp/tests/test_window_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698