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

Unified Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 891003004: MacViews: Implement SetCursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150129-MacViews-Bringup5
Patch Set: cl format Created 5 years, 11 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: ui/views/cocoa/bridged_native_widget.mm
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
index 4062f9a2608908700384ada4a7dd91cabd089532..96d0170b7b5f2c5d8376ce76a6661a2ecdfbcbe8 100644
--- a/ui/views/cocoa/bridged_native_widget.mm
+++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -204,6 +204,14 @@ void BridgedNativeWidget::AcquireCapture() {
return; // Capture on hidden windows is disallowed.
mouse_capture_.reset(new CocoaMouseCapture(this));
+
+ // Initiating global event capture with addGlobalMonitorForEventsMatchingMask:
+ // will reset the mouse cursor to an arrow. Asking the window for an update
+ // here will restore what we want. However, it can sometimes cause the cursor
+ // to flicker, once, on the initial mouseDown.
+ // TOOD(tapted): Make this unnecessary by only asking for global mouse capture
+ // for the cases that need it (e.g. menus, but not drag and drop).
+ [window_ cursorUpdate:[NSApp currentEvent]];
}
void BridgedNativeWidget::ReleaseCapture() {
@@ -230,6 +238,10 @@ void* BridgedNativeWidget::GetNativeWindowProperty(const char* name) const {
return [[GetWindowProperties() objectForKey:key] pointerValue];
}
+void BridgedNativeWidget::SetCursor(NSCursor* cursor) {
+ [window_delegate_ setCursor:cursor];
+}
+
void BridgedNativeWidget::OnWindowWillClose() {
if (parent_)
parent_->RemoveChildWindow(this);

Powered by Google App Engine
This is Rietveld 408576698