| 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 f307abddba85e17fd28e663327522fdd9d25a34b..f1877a7a2cb85fa0dc7c6fc4e71d4f65e46b5cc3 100644
|
| --- a/ui/views/widget/native_widget_mac.mm
|
| +++ b/ui/views/widget/native_widget_mac.mm
|
| @@ -37,6 +37,16 @@
|
|
|
| @end
|
|
|
| +extern "C" {
|
| +
|
| +typedef int32_t CGSWindow;
|
| +typedef int32_t CGSConnection;
|
| +CGSConnection _CGSDefaultConnection();
|
| +OSStatus CGSGetWindowBounds(
|
| + CGSConnection connection, CGSWindow window, CGRect* bounds);
|
| +
|
| +}
|
| +
|
| namespace views {
|
| namespace {
|
|
|
| @@ -60,6 +70,20 @@ NSInteger StyleMaskForParams(const Widget::InitParams& params) {
|
| return NSBorderlessWindowMask;
|
| }
|
|
|
| +// -[NSWindow frame] doesn't update during a window drag. This is not what
|
| +// toolkit-views expects, so ask the window server directly.
|
| +NSRect FrameIncludingDrag(NSWindow* window) {
|
| + CGRect bounds = NSZeroRect;
|
| + CGSGetWindowBounds(_CGSDefaultConnection(), [window windowNumber], &bounds);
|
| + NSRect rect = ScreenRectToNSRect(gfx::Rect(bounds));
|
| +
|
| + // If no mouse buttons are down, there is no drag. So it should match the
|
| + // window frame.
|
| + //DCHECK([NSEvent pressedMouseButtons] == 0 ||
|
| + // NSEqualRects(rect, [window frame]));
|
| + return rect;
|
| +}
|
| +
|
| } // namespace
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -201,8 +225,8 @@ void NativeWidgetMac::ViewRemoved(View* view) {
|
| // TODO(tapted): Something for drag and drop might be needed here in future.
|
| // See http://crbug.com/464581. A NOTIMPLEMENTED() here makes a lot of spam,
|
| // so only emit it when a drag and drop could be likely.
|
| - if (IsMouseButtonDown())
|
| - NOTIMPLEMENTED();
|
| + // if (IsMouseButtonDown())
|
| + // NOTIMPLEMENTED();
|
| }
|
|
|
| void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) {
|
| @@ -296,7 +320,7 @@ gfx::Rect NativeWidgetMac::GetWindowBoundsInScreen() const {
|
| gfx::Rect NativeWidgetMac::GetClientAreaBoundsInScreen() const {
|
| NSWindow* window = GetNativeWindow();
|
| return gfx::ScreenRectFromNSRect(
|
| - [window contentRectForFrameRect:[window frame]]);
|
| + [window contentRectForFrameRect:FrameIncludingDrag(window)]);
|
| }
|
|
|
| gfx::Rect NativeWidgetMac::GetRestoredBounds() const {
|
| @@ -548,12 +572,18 @@ Widget::MoveLoopResult NativeWidgetMac::RunMoveLoop(
|
| const gfx::Vector2d& drag_offset,
|
| Widget::MoveLoopSource source,
|
| Widget::MoveLoopEscapeBehavior escape_behavior) {
|
| - NOTIMPLEMENTED();
|
| - return Widget::MOVE_LOOP_CANCELED;
|
| + if (!bridge_)
|
| + return Widget::MOVE_LOOP_CANCELED;
|
| +
|
| + DLOG(INFO) << "RunMoveLoop: " << source << " , " << escape_behavior
|
| + << " offset=" << drag_offset.ToString();
|
| +
|
| + return bridge_->RunMoveLoop(drag_offset);
|
| }
|
|
|
| void NativeWidgetMac::EndMoveLoop() {
|
| - NOTIMPLEMENTED();
|
| + if (bridge_)
|
| + bridge_->EndMoveLoop();
|
| }
|
|
|
| void NativeWidgetMac::SetVisibilityChangedAnimationsEnabled(bool value) {
|
|
|