diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-31 18:33:24 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-31 18:33:24 +0000 |
commit | ceb36f7d5cec71407b265aba887cd64216d24731 (patch) | |
tree | ea977c72eb7882c1629a5c78f56b1a9e7e3e6b60 /ui/views | |
parent | 80211f670f34191d80b875086aaf7b5b06a743d4 (diff) | |
download | chromium_src-ceb36f7d5cec71407b265aba887cd64216d24731.zip chromium_src-ceb36f7d5cec71407b265aba887cd64216d24731.tar.gz chromium_src-ceb36f7d5cec71407b265aba887cd64216d24731.tar.bz2 |
Add Vector2d classes that represent offsets, instead of using Point.
Previously Point served two purposes, to be a position in 2d space, and also
an offset from the origin. This introduces a Vector2d class to represent an
offset, allowing typesafety checks for geometric operations.
The following are now the case:
Point +/- Vector = Point
- A point plus/minus an offset gives you a point at a position offset by the
vector.
Vector +/- Vector = Vector
- Two offsets can be added together to make a new offset.
Point - Point = Vector
- Subtracting one point from another gives you the offset between the two
points.
We add some new methods to perform these operations:
Rect::OffsetFromOrigin() gives the offset between the position of the rect
and the origin.
Point::OffsetFromOrigin() gives the offset between the point and the origin.
PointAtOffsetFromOrigin(Vector2d) converts a Vector2d to a Point at the given
offset away from the origin.
Rect::Offset(), Point::Add(), and Point::Subtract() now receive a Vector2d
instead of a point.
BUG=147395
R=sky
Review URL: https://codereview.chromium.org/11269022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165198 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
28 files changed, 49 insertions, 51 deletions
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc index eb47a90..f35e143 100644 --- a/ui/views/bubble/bubble_delegate.cc +++ b/ui/views/bubble/bubble_delegate.cc @@ -351,7 +351,8 @@ gfx::Rect BubbleDelegateView::GetBubbleBounds() { #if defined(OS_WIN) && !defined(USE_AURA) gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); - client_bounds.Offset(border_widget_->GetWindowBoundsInScreen().origin()); + client_bounds.Offset( + border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); return client_bounds; } #endif diff --git a/ui/views/button_drag_utils.cc b/ui/views/button_drag_utils.cc index 8bdfe94..c1b37b5 100644 --- a/ui/views/button_drag_utils.cc +++ b/ui/views/button_drag_utils.cc @@ -47,7 +47,7 @@ void SetURLAndDragImage(const GURL& url, views::GetCanvasForDragImage(widget, prefsize)); button.PaintButton(canvas.get(), views::TextButton::PB_FOR_DRAG); drag_utils::SetDragImageOnDataObject(*canvas, prefsize, - gfx::Point(prefsize.width() / 2, prefsize.height() / 2), data); + gfx::Vector2d(prefsize.width() / 2, prefsize.height() / 2), data); } } // namespace button_drag_utils diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 87eeca4..796b45f 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -450,10 +450,8 @@ void MenuController::OnMouseDragged(SubmenuView* source, return; if (possible_drag_) { - if (View::ExceededDragThreshold(event.x() - press_pt_.x(), - event.y() - press_pt_.y())) { + if (View::ExceededDragThreshold(event.location() - press_pt_)) StartDrag(source, press_pt_); - } return; } MenuItemView* mouse_menu = NULL; @@ -859,7 +857,8 @@ void MenuController::StartDrag(SubmenuView* source, OSExchangeData data; item->GetDelegate()->WriteDragData(item, &data); - drag_utils::SetDragImageOnDataObject(*canvas, item->size(), press_loc, + drag_utils::SetDragImageOnDataObject(*canvas, item->size(), + press_loc.OffsetFromOrigin(), &data); StopScrolling(); int drag_ops = item->GetDelegate()->GetDragOperations(item); diff --git a/ui/views/controls/menu/menu_image_util.cc b/ui/views/controls/menu/menu_image_util.cc index 02e6ae9..c4545087 100644 --- a/ui/views/controls/menu/menu_image_util.cc +++ b/ui/views/controls/menu/menu_image_util.cc @@ -43,7 +43,7 @@ class RadioButtonImageSource : public gfx::CanvasImageSource { virtual ~RadioButtonImageSource() {} virtual void Draw(gfx::Canvas* canvas) OVERRIDE { - canvas->Translate(gfx::Point(1, 1)); + canvas->Translate(gfx::Vector2d(1, 1)); SkPoint gradient_points[3]; gradient_points[0].iset(0, 0); diff --git a/ui/views/controls/slider.cc b/ui/views/controls/slider.cc index c6e575f..140df74 100644 --- a/ui/views/controls/slider.cc +++ b/ui/views/controls/slider.cc @@ -199,7 +199,7 @@ void Slider::OnPaint(gfx::Canvas* canvas) { int middle = std::max(full, images_[LEFT]->width()); canvas->Save(); - canvas->Translate(gfx::Point(kBarInsetX, bar_cy)); + canvas->Translate(gfx::Vector2d(kBarInsetX, bar_cy)); canvas->DrawImageInt(*images_[LEFT], 0, 0); canvas->DrawImageInt(*images_[RIGHT], bar_width - images_[RIGHT]->width(), diff --git a/ui/views/controls/table/table_view_win.cc b/ui/views/controls/table/table_view_win.cc index 1538dd8..7ce46c0 100644 --- a/ui/views/controls/table/table_view_win.cc +++ b/ui/views/controls/table/table_view_win.cc @@ -517,7 +517,7 @@ LRESULT CALLBACK TableView::TableWndProc(HWND window, static bool select_on_mouse_up = false; // If the mouse is down, this is the location of the mouse down message. - static int mouse_down_x, mouse_down_y; + CR_DEFINE_STATIC_LOCAL(gfx::Point, mouse_down_pos, ()); switch (message) { case WM_CONTEXTMENU: { @@ -647,8 +647,8 @@ LRESULT CALLBACK TableView::TableWndProc(HWND window, table_view->ignore_listview_change_ = true; in_mouse_down = true; select_on_mouse_up = false; - mouse_down_x = GET_X_LPARAM(l_param); - mouse_down_y = GET_Y_LPARAM(l_param); + mouse_down_pos.set_x(GET_X_LPARAM(l_param)); + mouse_down_pos.set_y(GET_Y_LPARAM(l_param)); int model_index = table_view->ViewToModel(view_index); bool select = true; if (w_param & MK_CONTROL) { @@ -709,9 +709,8 @@ LRESULT CALLBACK TableView::TableWndProc(HWND window, case WM_MOUSEMOVE: { if (in_mouse_down) { - int x = GET_X_LPARAM(l_param); - int y = GET_Y_LPARAM(l_param); - if (View::ExceededDragThreshold(x - mouse_down_x, y - mouse_down_y)) { + gfx::Point mouse_pos(GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param)); + if (View::ExceededDragThreshold(mouse_pos - mouse_down_pos)) { // We're about to start drag and drop, which results in no mouse up. // Release capture and reset state. ReleaseCapture(); diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index 02e4c49..28ccdcb 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -112,8 +112,7 @@ bool NativeTextfieldViews::OnMousePressed(const ui::MouseEvent& event) { bool NativeTextfieldViews::ExceededDragThresholdFromLastClickLocation( const ui::MouseEvent& event) { - gfx::Point location_delta = event.location().Subtract(last_click_location_); - return ExceededDragThreshold(location_delta.x(), location_delta.y()); + return ExceededDragThreshold(event.location() - last_click_location_); } bool NativeTextfieldViews::OnMouseDragged(const ui::MouseEvent& event) { diff --git a/ui/views/painter.cc b/ui/views/painter.cc index 4275c54..99c537c 100644 --- a/ui/views/painter.cc +++ b/ui/views/painter.cc @@ -171,7 +171,7 @@ void Painter::PaintPainterAt(gfx::Canvas* canvas, const gfx::Rect& rect) { DCHECK(canvas && painter); canvas->Save(); - canvas->Translate(rect.origin()); + canvas->Translate(rect.OffsetFromOrigin()); painter->Paint(canvas, rect.size()); canvas->Restore(); } diff --git a/ui/views/view.cc b/ui/views/view.cc index 660128b..8faa77b 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc @@ -624,7 +624,7 @@ void View::ConvertPointToTarget(const View* source, // API defines NULL |source| as returning the point in screen coordinates. if (!source) { *point = point->Subtract( - root->GetWidget()->GetClientAreaBoundsInScreen().origin()); + root->GetWidget()->GetClientAreaBoundsInScreen().OffsetFromOrigin()); } } @@ -653,8 +653,7 @@ void View::ConvertPointToScreen(const View* src, gfx::Point* p) { const Widget* widget = src->GetWidget(); if (widget) { ConvertPointToWidget(src, p); - gfx::Rect r = widget->GetClientAreaBoundsInScreen(); - p->SetPoint(p->x() + r.x(), p->y() + r.y()); + *p = p->Add(widget->GetClientAreaBoundsInScreen().OffsetFromOrigin()); } } @@ -666,15 +665,14 @@ void View::ConvertPointFromScreen(const View* dst, gfx::Point* p) { const views::Widget* widget = dst->GetWidget(); if (!widget) return; - const gfx::Rect r = widget->GetClientAreaBoundsInScreen(); - p->Offset(-r.x(), -r.y()); + *p = p->Add(-widget->GetClientAreaBoundsInScreen().OffsetFromOrigin()); views::View::ConvertPointFromWidget(dst, p); } gfx::Rect View::ConvertRectToParent(const gfx::Rect& rect) const { gfx::Rect x_rect = rect; GetTransform().TransformRect(&x_rect); - x_rect.Offset(GetMirroredPosition()); + x_rect.Offset(GetMirroredPosition().OffsetFromOrigin()); return x_rect; } @@ -725,7 +723,7 @@ void View::Paint(gfx::Canvas* canvas) { // Non-empty clip, translate the graphics such that 0,0 corresponds to // where this view is located (related to its parent). - canvas->Translate(GetMirroredPosition()); + canvas->Translate(GetMirroredPosition().OffsetFromOrigin()); canvas->Transform(GetTransform()); PaintCommon(canvas); @@ -1041,9 +1039,9 @@ void View::OnDragDone() { } // static -bool View::ExceededDragThreshold(int delta_x, int delta_y) { - return (abs(delta_x) > GetHorizontalDragThreshold() || - abs(delta_y) > GetVerticalDragThreshold()); +bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { + return (abs(delta.x()) > GetHorizontalDragThreshold() || + abs(delta.y()) > GetVerticalDragThreshold()); } // Scrolling ------------------------------------------------------------------- @@ -1527,7 +1525,7 @@ void View::PaintCommon(gfx::Canvas* canvas) { // request the canvas to be flipped. ScopedCanvas scoped(canvas); if (FlipCanvasOnPaintForRTLUI()) { - canvas->Translate(gfx::Point(width(), 0)); + canvas->Translate(gfx::Vector2d(width(), 0)); canvas->Scale(-1, 1); } @@ -1939,9 +1937,8 @@ bool View::ProcessMouseDragged(const ui::MouseEvent& event, // done. ContextMenuController* context_menu_controller = context_menu_controller_; const bool possible_drag = drag_info->possible_drag; - if (possible_drag && ExceededDragThreshold( - drag_info->start_pt.x() - event.x(), - drag_info->start_pt.y() - event.y())) { + if (possible_drag && + ExceededDragThreshold(drag_info->start_pt - event.location())) { if (!drag_controller_ || drag_controller_->CanStartDragForView( this, drag_info->start_pt, event.location())) diff --git a/ui/views/view.h b/ui/views/view.h index 65b2247..3f05eeb 100644 --- a/ui/views/view.h +++ b/ui/views/view.h @@ -23,6 +23,7 @@ #include "ui/compositor/layer_owner.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" +#include "ui/gfx/vector2d.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/focus_border.h" @@ -859,7 +860,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, // Returns true if the mouse was dragged enough to start a drag operation. // delta_x and y are the distance the mouse was dragged. - static bool ExceededDragThreshold(int delta_x, int delta_y); + static bool ExceededDragThreshold(const gfx::Vector2d& delta); // Accessibility ------------------------------------------------------------- diff --git a/ui/views/widget/desktop_native_widget_aura.cc b/ui/views/widget/desktop_native_widget_aura.cc index 8dd2a44..73ef5de 100644 --- a/ui/views/widget/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_native_widget_aura.cc @@ -400,7 +400,7 @@ void DesktopNativeWidgetAura::SetInactiveRenderingDisabled(bool value) { } Widget::MoveLoopResult DesktopNativeWidgetAura::RunMoveLoop( - const gfx::Point& drag_offset) { + const gfx::Vector2d& drag_offset) { return desktop_root_window_host_->RunMoveLoop(drag_offset); } diff --git a/ui/views/widget/desktop_native_widget_aura.h b/ui/views/widget/desktop_native_widget_aura.h index 3f2f247..608cd86 100644 --- a/ui/views/widget/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_native_widget_aura.h @@ -120,7 +120,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE; virtual Widget::MoveLoopResult RunMoveLoop( - const gfx::Point& drag_offset) OVERRIDE; + const gfx::Vector2d& drag_offset) OVERRIDE; virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; diff --git a/ui/views/widget/desktop_root_window_host.h b/ui/views/widget/desktop_root_window_host.h index eedd3d9..0f175d3 100644 --- a/ui/views/widget/desktop_root_window_host.h +++ b/ui/views/widget/desktop_root_window_host.h @@ -82,7 +82,8 @@ class VIEWS_EXPORT DesktopRootWindowHost { virtual void ClearNativeFocus() = 0; - virtual Widget::MoveLoopResult RunMoveLoop(const gfx::Point& drag_offset) = 0; + virtual Widget::MoveLoopResult RunMoveLoop( + const gfx::Vector2d& drag_offset) = 0; virtual void EndMoveLoop() = 0; virtual void SetVisibilityChangedAnimationsEnabled(bool value) = 0; diff --git a/ui/views/widget/desktop_root_window_host_linux.cc b/ui/views/widget/desktop_root_window_host_linux.cc index 6dadcd0..b05fcf3 100644 --- a/ui/views/widget/desktop_root_window_host_linux.cc +++ b/ui/views/widget/desktop_root_window_host_linux.cc @@ -525,7 +525,7 @@ void DesktopRootWindowHostLinux::ClearNativeFocus() { } Widget::MoveLoopResult DesktopRootWindowHostLinux::RunMoveLoop( - const gfx::Point& drag_offset) { + const gfx::Vector2d& drag_offset) { SetCapture(); if (x11_window_move_client_->RunMoveLoop(content_window_, drag_offset) == diff --git a/ui/views/widget/desktop_root_window_host_linux.h b/ui/views/widget/desktop_root_window_host_linux.h index b8f6fe9..e24c5b9 100644 --- a/ui/views/widget/desktop_root_window_host_linux.h +++ b/ui/views/widget/desktop_root_window_host_linux.h @@ -124,7 +124,7 @@ class VIEWS_EXPORT DesktopRootWindowHostLinux virtual void SetWindowTitle(const string16& title) OVERRIDE; virtual void ClearNativeFocus() OVERRIDE; virtual Widget::MoveLoopResult RunMoveLoop( - const gfx::Point& drag_offset) OVERRIDE; + const gfx::Vector2d& drag_offset) OVERRIDE; virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; virtual bool ShouldUseNativeFrame() OVERRIDE; diff --git a/ui/views/widget/desktop_root_window_host_win.cc b/ui/views/widget/desktop_root_window_host_win.cc index ec60ef3..c5b14f9 100644 --- a/ui/views/widget/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_root_window_host_win.cc @@ -264,7 +264,7 @@ void DesktopRootWindowHostWin::ClearNativeFocus() { } Widget::MoveLoopResult DesktopRootWindowHostWin::RunMoveLoop( - const gfx::Point& drag_offset) { + const gfx::Vector2d& drag_offset) { return message_handler_->RunMoveLoop(drag_offset) ? Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; } diff --git a/ui/views/widget/desktop_root_window_host_win.h b/ui/views/widget/desktop_root_window_host_win.h index 7aafddb..5880600 100644 --- a/ui/views/widget/desktop_root_window_host_win.h +++ b/ui/views/widget/desktop_root_window_host_win.h @@ -78,7 +78,7 @@ class VIEWS_EXPORT DesktopRootWindowHostWin virtual void SetWindowTitle(const string16& title) OVERRIDE; virtual void ClearNativeFocus() OVERRIDE; virtual Widget::MoveLoopResult RunMoveLoop( - const gfx::Point& drag_offset) OVERRIDE; + const gfx::Vector2d& drag_offset) OVERRIDE; virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; virtual bool ShouldUseNativeFrame() OVERRIDE; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index a37ebd2..85fafe1 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -592,7 +592,7 @@ void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { } Widget::MoveLoopResult NativeWidgetAura::RunMoveLoop( - const gfx::Point& drag_offset) { + const gfx::Vector2d& drag_offset) { if (window_->parent() && aura::client::GetWindowMoveClient(window_->parent())) { SetCapture(); diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index 1011f61..8f6157f 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h @@ -121,7 +121,7 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE; virtual Widget::MoveLoopResult RunMoveLoop( - const gfx::Point& drag_offset) OVERRIDE; + const gfx::Vector2d& drag_offset) OVERRIDE; virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; diff --git a/ui/views/widget/native_widget_private.h b/ui/views/widget/native_widget_private.h index 30f3848..c210a20 100644 --- a/ui/views/widget/native_widget_private.h +++ b/ui/views/widget/native_widget_private.h @@ -210,7 +210,8 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget { virtual void ClearNativeFocus() = 0; virtual gfx::Rect GetWorkAreaBoundsInScreen() const = 0; virtual void SetInactiveRenderingDisabled(bool value) = 0; - virtual Widget::MoveLoopResult RunMoveLoop(const gfx::Point& drag_offset) = 0; + virtual Widget::MoveLoopResult RunMoveLoop( + const gfx::Vector2d& drag_offset) = 0; virtual void EndMoveLoop() = 0; virtual void SetVisibilityChangedAnimationsEnabled(bool value) = 0; diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index 904e8c1..628b0cc 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -471,7 +471,7 @@ void NativeWidgetWin::SetInactiveRenderingDisabled(bool value) { } Widget::MoveLoopResult NativeWidgetWin::RunMoveLoop( - const gfx::Point& drag_offset) { + const gfx::Vector2d& drag_offset) { return message_handler_->RunMoveLoop(drag_offset) ? Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; } diff --git a/ui/views/widget/native_widget_win.h b/ui/views/widget/native_widget_win.h index 530e4cd..b50e925 100644 --- a/ui/views/widget/native_widget_win.h +++ b/ui/views/widget/native_widget_win.h @@ -164,7 +164,7 @@ class VIEWS_EXPORT NativeWidgetWin : public internal::NativeWidgetPrivate, virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; virtual void SetInactiveRenderingDisabled(bool value) OVERRIDE; virtual Widget::MoveLoopResult RunMoveLoop( - const gfx::Point& drag_offset) OVERRIDE; + const gfx::Vector2d& drag_offset) OVERRIDE; virtual void EndMoveLoop() OVERRIDE; virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index fef8cd2..8a42f91 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -483,7 +483,7 @@ void Widget::SetVisibilityChangedAnimationsEnabled(bool value) { native_widget_->SetVisibilityChangedAnimationsEnabled(value); } -Widget::MoveLoopResult Widget::RunMoveLoop(const gfx::Point& drag_offset) { +Widget::MoveLoopResult Widget::RunMoveLoop(const gfx::Vector2d& drag_offset) { return native_widget_->RunMoveLoop(drag_offset); } diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index 48f1295..224d7b6 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -331,7 +331,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // the move completes. |drag_offset| is the offset from the top left corner // of the window to the point where the cursor is dragging, and is used to // offset the bounds of the window from the cursor. - MoveLoopResult RunMoveLoop(const gfx::Point& drag_offset); + MoveLoopResult RunMoveLoop(const gfx::Vector2d& drag_offset); // Stops a previously started move loop. This is not immediate. void EndMoveLoop(); diff --git a/ui/views/widget/x11_desktop_window_move_client.cc b/ui/views/widget/x11_desktop_window_move_client.cc index adb6ff3..e17db87 100644 --- a/ui/views/widget/x11_desktop_window_move_client.cc +++ b/ui/views/widget/x11_desktop_window_move_client.cc @@ -71,7 +71,7 @@ ui::EventResult X11DesktopWindowMoveClient::PreHandleGestureEvent( aura::client::WindowMoveResult X11DesktopWindowMoveClient::RunMoveLoop( aura::Window* source, - const gfx::Point& drag_offset) { + const gfx::Vector2d& drag_offset) { DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. in_move_loop_ = true; window_offset_ = drag_offset; diff --git a/ui/views/widget/x11_desktop_window_move_client.h b/ui/views/widget/x11_desktop_window_move_client.h index f80bce6..9cb3a7c 100644 --- a/ui/views/widget/x11_desktop_window_move_client.h +++ b/ui/views/widget/x11_desktop_window_move_client.h @@ -36,7 +36,7 @@ class VIEWS_EXPORT X11DesktopWindowMoveClient // Overridden from aura::client::WindowMoveClient: virtual aura::client::WindowMoveResult RunMoveLoop( aura::Window* window, - const gfx::Point& drag_offset) OVERRIDE; + const gfx::Vector2d& drag_offset) OVERRIDE; virtual void EndMoveLoop() OVERRIDE; private: @@ -46,7 +46,7 @@ class VIEWS_EXPORT X11DesktopWindowMoveClient // Our cursor offset from the top left window origin when the drag // started. Used to calculate the window's new bounds relative to the current // location of the cursor. - gfx::Point window_offset_; + gfx::Vector2d window_offset_; base::Closure quit_closure_; }; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 0312549..70ed1bf 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -668,7 +668,7 @@ bool HWNDMessageHandler::IsMaximized() const { return !!::IsZoomed(hwnd()); } -bool HWNDMessageHandler::RunMoveLoop(const gfx::Point& drag_offset) { +bool HWNDMessageHandler::RunMoveLoop(const gfx::Vector2d& drag_offset) { ReleaseCapture(); MoveLoopMouseWatcher watcher(this); SendMessage(hwnd(), WM_SYSCOMMAND, SC_MOVE | 0x0002, GetMessagePos()); diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index 9a96340..96b9931 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h @@ -104,7 +104,7 @@ class VIEWS_EXPORT HWNDMessageHandler : public ui::WindowImpl, bool IsMinimized() const; bool IsMaximized() const; - bool RunMoveLoop(const gfx::Point& drag_offset); + bool RunMoveLoop(const gfx::Vector2d& drag_offset); void EndMoveLoop(); // Tells the HWND its client area has changed. |