| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 DCHECK(context_factory); | 1268 DCHECK(context_factory); |
| 1269 ui::ContextFactoryPrivate* context_factory_private = | 1269 ui::ContextFactoryPrivate* context_factory_private = |
| 1270 ViewsDelegate::GetInstance()->GetContextFactoryPrivate(); | 1270 ViewsDelegate::GetInstance()->GetContextFactoryPrivate(); |
| 1271 | 1271 |
| 1272 AddCompositorSuperview(); | 1272 AddCompositorSuperview(); |
| 1273 | 1273 |
| 1274 compositor_widget_.reset(new ui::AcceleratedWidgetMac()); | 1274 compositor_widget_.reset(new ui::AcceleratedWidgetMac()); |
| 1275 compositor_.reset(new ui::Compositor( | 1275 compositor_.reset(new ui::Compositor( |
| 1276 context_factory_private->AllocateFrameSinkId(), context_factory, | 1276 context_factory_private->AllocateFrameSinkId(), context_factory, |
| 1277 context_factory_private, GetCompositorTaskRunner(), | 1277 context_factory_private, GetCompositorTaskRunner(), |
| 1278 false /* enable_surface_synchronization */)); | 1278 false /* enable_surface_synchronization */, |
| 1279 false /* enable_pixel_canvas */)); |
| 1279 compositor_->SetAcceleratedWidget(compositor_widget_->accelerated_widget()); | 1280 compositor_->SetAcceleratedWidget(compositor_widget_->accelerated_widget()); |
| 1280 compositor_widget_->SetNSView(this); | 1281 compositor_widget_->SetNSView(this); |
| 1281 } | 1282 } |
| 1282 | 1283 |
| 1283 void BridgedNativeWidget::InitCompositor() { | 1284 void BridgedNativeWidget::InitCompositor() { |
| 1284 DCHECK(layer()); | 1285 DCHECK(layer()); |
| 1285 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); | 1286 float scale_factor = GetDeviceScaleFactorFromView(compositor_superview_); |
| 1286 gfx::Size size_in_dip = GetClientAreaSize(); | 1287 gfx::Size size_in_dip = GetClientAreaSize(); |
| 1287 compositor_->SetScaleAndSize(scale_factor, | 1288 compositor_->SetScaleAndSize(scale_factor, |
| 1288 ConvertSizeToPixel(scale_factor, size_in_dip)); | 1289 ConvertSizeToPixel(scale_factor, size_in_dip)); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1430 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
| 1430 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1431 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
| 1431 // changes. Previously we tried adding an NSView and removing it, but for some | 1432 // changes. Previously we tried adding an NSView and removing it, but for some |
| 1432 // reason it required reposting the mouse-down event, and didn't always work. | 1433 // reason it required reposting the mouse-down event, and didn't always work. |
| 1433 // Calling the below seems to be an effective solution. | 1434 // Calling the below seems to be an effective solution. |
| 1434 [window_ setMovableByWindowBackground:NO]; | 1435 [window_ setMovableByWindowBackground:NO]; |
| 1435 [window_ setMovableByWindowBackground:YES]; | 1436 [window_ setMovableByWindowBackground:YES]; |
| 1436 } | 1437 } |
| 1437 | 1438 |
| 1438 } // namespace views | 1439 } // namespace views |
| OLD | NEW |