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

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

Issue 1259913003: MacViews: Implement Tab Dragging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150529-ViewsBrowser-DisableCertificateDialog
Patch Set: update comments, still a TODO Created 5 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/cocoa/views_nswindow_delegate.mm ('k') | no next file » | 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 61656430231141041fdf9811229efb67cd5a3370..a60da71075efc3defaf531a4aefda23fa8287cb5 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -34,6 +34,16 @@
@end
+extern "C" {
+
+typedef int32 CGSWindow;
+typedef int32 CGSConnection;
+CGSConnection _CGSDefaultConnection();
+OSStatus CGSGetWindowBounds(
+ CGSConnection connection, CGSWindow window, CGRect* bounds);
+
+}
+
namespace views {
namespace {
@@ -50,6 +60,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
////////////////////////////////////////////////////////////////////////////////
@@ -180,7 +204,7 @@ void NativeWidgetMac::ReorderNativeViews() {
}
void NativeWidgetMac::ViewRemoved(View* view) {
- NOTIMPLEMENTED();
+ //NOTIMPLEMENTED();
}
void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) {
@@ -274,7 +298,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 {
@@ -516,12 +540,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) {
« no previous file with comments | « ui/views/cocoa/views_nswindow_delegate.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698