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

Unified Diff: ui/views/widget/native_widget_mac.mm

Issue 283053002: Add compositing, layers to app_list_demo Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto master -- probably slightly broken Created 6 years, 4 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/views/views_delegate.cc ('k') | ui/views_content_client/views_content_client_main_parts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « ui/views/views_delegate.cc ('k') | ui/views_content_client/views_content_client_main_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698