Index: ui/views/widget/native_widget_mac.mm |
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm |
index f40c2f476281fbcb4ba69d29ecb56291ff407a46..47209c2a73be21b0bcc04e52e92e554e2244d692 100644 |
--- a/ui/views/widget/native_widget_mac.mm |
+++ b/ui/views/widget/native_widget_mac.mm |
@@ -129,8 +129,7 @@ bool NativeWidgetMac::ShouldUseNativeFrame() const { |
} |
bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const { |
- NOTIMPLEMENTED(); |
- return false; |
+ return true; |
} |
void NativeWidgetMac::FrameTypeChanged() { |
@@ -160,18 +159,15 @@ Widget* NativeWidgetMac::GetTopLevelWidget() { |
} |
const ui::Compositor* NativeWidgetMac::GetCompositor() const { |
- NOTIMPLEMENTED(); |
- return NULL; |
+ return bridge_->layer() ? bridge_->layer()->GetCompositor() : NULL; |
} |
ui::Compositor* NativeWidgetMac::GetCompositor() { |
- NOTIMPLEMENTED(); |
- return NULL; |
+ return bridge_->layer() ? bridge_->layer()->GetCompositor() : NULL; |
} |
ui::Layer* NativeWidgetMac::GetLayer() { |
- NOTIMPLEMENTED(); |
- return NULL; |
+ return bridge_->GetOrCreateLayer(); |
} |
void NativeWidgetMac::ReorderNativeViews() { |
@@ -198,16 +194,19 @@ TooltipManager* NativeWidgetMac::GetTooltipManager() const { |
} |
void NativeWidgetMac::SetCapture() { |
- NOTIMPLEMENTED(); |
+ // Basic mouse capture to simulate ::SetCapture() from Windows. Capture on OSX |
+ // is automatic for mouse drag events. This allows mouse move events to also |
+ // be sent to responders, but only when the mouse is over the window. To get |
+ // move events outside the window, Mac will need an event tap. |
+ [GetNativeWindow() setAcceptsMouseMovedEvents:YES]; |
} |
void NativeWidgetMac::ReleaseCapture() { |
- NOTIMPLEMENTED(); |
+ [GetNativeWindow() setAcceptsMouseMovedEvents:NO]; |
} |
bool NativeWidgetMac::HasCapture() const { |
- NOTIMPLEMENTED(); |
- return false; |
+ return [GetNativeWindow() acceptsMouseMovedEvents]; |
} |
InputMethod* NativeWidgetMac::CreateInputMethod() { |
@@ -271,9 +270,8 @@ gfx::Rect NativeWidgetMac::GetRestoredBounds() const { |
} |
void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) { |
- [GetNativeWindow() setFrame:gfx::ScreenRectToNSRect(bounds) |
- display:YES |
- animate:NO]; |
+ if (bridge_) |
+ bridge_->SetBounds(bounds); |
} |
void NativeWidgetMac::SetSize(const gfx::Size& size) { |
@@ -456,6 +454,9 @@ void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { |
// TODO(tapted): This should use setNeedsDisplayInRect:, once the coordinate |
// system of |rect| has been converted. |
[GetNativeView() setNeedsDisplay:YES]; |
+ if (bridge_ && bridge_->layer()) { |
+ bridge_->layer()->SchedulePaint(rect); |
+ } |
} |
void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { |