summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 17:21:12 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-27 17:21:12 +0000
commit31156a610d1091e73ee5e5b644c152938bdc0bb3 (patch)
treeb40df18c26ff2974214e5206db8411313bdd15ff /ash
parent1be67944d87c73fabfc70c7fc19467a4413b1e31 (diff)
downloadchromium_src-31156a610d1091e73ee5e5b644c152938bdc0bb3.zip
chromium_src-31156a610d1091e73ee5e5b644c152938bdc0bb3.tar.gz
chromium_src-31156a610d1091e73ee5e5b644c152938bdc0bb3.tar.bz2
Notable changes:
- Merges TwoFingerDragHandler and ToplevelWindowEventHandler This fixes crashes due to: --- The existence of multiple WindowResizers --- Display configuration changes during a two finger drag - Properly ends window dragging once the third finger is placed on screen. - Fixes crash as a result of accidentally right clicking during a mouse drag - Removes DetachToBrowserTabDragControllerTestTouch.DetachToOwnWindowTwoFingers and replaces the test with a new test - It used to be the case that putting a second finger down during a tab drag would have no effect but putting a third finger down would revert the drag. Now putting a second and third finger down during a a tab drag revert the drag. This seems to be the intended behavior based on https://chromiumcodereview.appspot.com/10543061 BUG=324038 TEST=Manual, see bug Review URL: https://codereview.chromium.org/99923011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp2
-rw-r--r--ash/wm/gestures/two_finger_drag_handler.cc208
-rw-r--r--ash/wm/gestures/two_finger_drag_handler.h58
-rw-r--r--ash/wm/system_gesture_event_filter.cc9
-rw-r--r--ash/wm/system_gesture_event_filter.h2
-rw-r--r--ash/wm/toplevel_window_event_handler.cc151
-rw-r--r--ash/wm/toplevel_window_event_handler.h22
7 files changed, 140 insertions, 312 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 77279fb..b14c275 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -501,8 +501,6 @@
'wm/gestures/system_pinch_handler.h',
'wm/gestures/tray_gesture_handler.cc',
'wm/gestures/tray_gesture_handler.h',
- 'wm/gestures/two_finger_drag_handler.cc',
- 'wm/gestures/two_finger_drag_handler.h',
'wm/image_cursors.cc',
'wm/image_cursors.h',
'wm/immersive_fullscreen_controller.cc',
diff --git a/ash/wm/gestures/two_finger_drag_handler.cc b/ash/wm/gestures/two_finger_drag_handler.cc
deleted file mode 100644
index 6056419..0000000
--- a/ash/wm/gestures/two_finger_drag_handler.cc
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/wm/gestures/two_finger_drag_handler.h"
-
-#include "ash/wm/window_resizer.h"
-#include "ash/wm/window_state.h"
-#include "ash/wm/window_util.h"
-#include "ash/wm/workspace/snap_sizer.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_delegate.h"
-#include "ui/base/hit_test.h"
-#include "ui/events/event.h"
-#include "ui/events/event_constants.h"
-#include "ui/wm/public/window_types.h"
-
-namespace {
-
-enum Edge {
- TOP = 1 << 0,
- LEFT = 1 << 1,
- BOTTOM = 1 << 2,
- RIGHT = 1 << 3
-};
-
-// Returns the bitfield of Edge which corresponds to |hittest_component|.
-int GetEdges(int hittest_component) {
- switch (hittest_component) {
- case HTTOPLEFT:
- return TOP | LEFT;
- case HTTOP:
- return TOP;
- case HTTOPRIGHT:
- return TOP | RIGHT;
- case HTRIGHT:
- return RIGHT;
- case HTGROWBOX:
- case HTBOTTOMRIGHT:
- return BOTTOM | RIGHT;
- case HTBOTTOM:
- return BOTTOM;
- case HTBOTTOMLEFT:
- return BOTTOM | LEFT;
- case HTLEFT:
- return LEFT;
- default:
- return 0;
- }
-}
-
-// Returns whether |window| can be moved via a two finger drag given
-// the hittest results of the two fingers.
-bool CanStartTwoFingerDrag(aura::Window* window,
- int hittest_component1,
- int hittest_component2) {
- if (ash::wm::GetWindowState(window)->IsNormalShowState() &&
- window->type() == ui::wm::WINDOW_TYPE_NORMAL) {
- int edges1 = GetEdges(hittest_component1);
- int edges2 = GetEdges(hittest_component2);
- return (edges1 == edges2 || (edges1 & edges2) != 0);
- }
- return false;
-}
-
-} // namespace
-
-namespace ash {
-namespace internal {
-
-TwoFingerDragHandler::TwoFingerDragHandler()
- : first_finger_hittest_(HTNOWHERE),
- in_gesture_drag_(false) {
-}
-
-TwoFingerDragHandler::~TwoFingerDragHandler() {
-}
-
-bool TwoFingerDragHandler::ProcessGestureEvent(aura::Window* target,
- const ui::GestureEvent& event) {
- if (!target->delegate())
- return false;
-
- if (event.type() == ui::ET_GESTURE_BEGIN &&
- event.details().touch_points() == 1) {
- first_finger_hittest_ =
- target->delegate()->GetNonClientComponent(event.location());
- return false;
- }
-
- wm::WindowState* window_state = wm::GetWindowState(target);
-
- if (event.type() == ui::ET_GESTURE_BEGIN &&
- event.details().touch_points() == 2) {
- int second_finger_hittest =
- target->delegate()->GetNonClientComponent(event.location());
- if (!in_gesture_drag_ &&
- CanStartTwoFingerDrag(
- target, first_finger_hittest_, second_finger_hittest)) {
- in_gesture_drag_ = true;
- target->AddObserver(this);
- // Only create a new WindowResizer if one doesn't already exist
- // for the target window.
- window_resizer_ = CreateWindowResizer(
- target,
- event.details().bounding_box().CenterPoint(),
- HTCAPTION,
- aura::client::WINDOW_MOVE_SOURCE_TOUCH);
- return true;
- }
-
- return false;
- }
-
- if (!in_gesture_drag_) {
- // Consume all two-finger gestures on a normal window.
- return event.details().touch_points() == 2 &&
- target->type() == ui::wm::WINDOW_TYPE_NORMAL &&
- window_state->IsNormalShowState();
- }
-
- // Since |in_gesture_drag_| is true a resizer was either created above or
- // it was created elsewhere and can be found in |window_state|.
- WindowResizer* any_window_resizer = window_resizer_ ?
- window_resizer_.get() : window_state->window_resizer();
- DCHECK(any_window_resizer);
-
- if (target != any_window_resizer->GetTarget())
- return false;
-
- switch (event.type()) {
- case ui::ET_GESTURE_BEGIN:
- if (event.details().touch_points() > 2) {
- if (window_resizer_)
- window_resizer_->CompleteDrag();
- Reset(target);
- }
- return false;
-
- case ui::ET_GESTURE_SCROLL_BEGIN:
- case ui::ET_GESTURE_PINCH_BEGIN:
- case ui::ET_GESTURE_SCROLL_END:
- return true;
-
- case ui::ET_GESTURE_MULTIFINGER_SWIPE: {
- // For a swipe, the window either maximizes, minimizes, or snaps. In this
- // case, complete the drag, and do the appropriate action.
- if (window_resizer_)
- window_resizer_->CompleteDrag();
- Reset(target);
- if (event.details().swipe_up()) {
- if (window_state->CanMaximize())
- window_state->Maximize();
- } else if (event.details().swipe_down() && window_state->CanMinimize()) {
- window_state->Minimize();
- } else if (window_state->CanSnap()) {
- internal::SnapSizer::SnapWindow(window_state,
- event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE :
- internal::SnapSizer::RIGHT_EDGE);
- }
- return true;
- }
-
- case ui::ET_GESTURE_PINCH_UPDATE:
- case ui::ET_GESTURE_SCROLL_UPDATE:
- any_window_resizer->Drag(event.details().bounding_box().CenterPoint(),
- event.flags());
- return true;
-
- case ui::ET_GESTURE_PINCH_END:
- if (window_resizer_)
- window_resizer_->CompleteDrag();
- Reset(target);
- return true;
-
- case ui::ET_GESTURE_END:
- if (event.details().touch_points() == 2) {
- if (window_resizer_)
- window_resizer_->RevertDrag();
- Reset(target);
- return true;
- }
- break;
-
- default:
- break;
- }
-
- return false;
-}
-
-void TwoFingerDragHandler::Reset(aura::Window* window) {
- window->RemoveObserver(this);
- window_resizer_.reset();
- in_gesture_drag_ = false;
-}
-
-void TwoFingerDragHandler::OnWindowVisibilityChanged(aura::Window* window,
- bool visible) {
- Reset(window);
-}
-
-void TwoFingerDragHandler::OnWindowDestroying(aura::Window* window) {
- Reset(window);
-}
-
-} // namespace internal
-} // namespace ash
diff --git a/ash/wm/gestures/two_finger_drag_handler.h b/ash/wm/gestures/two_finger_drag_handler.h
deleted file mode 100644
index 11b7f51..0000000
--- a/ash/wm/gestures/two_finger_drag_handler.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_
-#define ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "ui/aura/window_observer.h"
-
-namespace aura {
-class Window;
-}
-
-namespace ui {
-class GestureEvent;
-}
-
-namespace ash {
-
-class WindowResizer;
-
-namespace internal {
-
-// This handles 2-finger drag gestures to move toplevel windows.
-class TwoFingerDragHandler : public aura::WindowObserver {
- public:
- TwoFingerDragHandler();
- virtual ~TwoFingerDragHandler();
-
- // Processes a gesture event and starts a drag, or updates/ends an in-progress
- // drag. Returns true if the event has been handled and should not be
- // processed any farther, false otherwise.
- bool ProcessGestureEvent(aura::Window* target, const ui::GestureEvent& event);
-
- private:
- void Reset(aura::Window* window);
-
- // Overridden from aura::WindowObserver.
- virtual void OnWindowVisibilityChanged(aura::Window* window,
- bool visible) OVERRIDE;
- virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
-
- int first_finger_hittest_;
-
- // Set to true while a drag initiated with two-finger gesture is in progress.
- bool in_gesture_drag_;
-
- scoped_ptr<WindowResizer> window_resizer_;
-
- DISALLOW_COPY_AND_ASSIGN(TwoFingerDragHandler);
-};
-
-}
-} // namespace ash
-
-#endif // ASH_WM_GESTURES_TWO_FINGER_DRAG_HANDLER_H_
diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc
index eb206b9..a3c492d 100644
--- a/ash/wm/system_gesture_event_filter.cc
+++ b/ash/wm/system_gesture_event_filter.cc
@@ -14,7 +14,6 @@
#include "ash/wm/gestures/long_press_affordance_handler.h"
#include "ash/wm/gestures/overview_gesture_handler.h"
#include "ash/wm/gestures/system_pinch_handler.h"
-#include "ash/wm/gestures/two_finger_drag_handler.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/aura/root_window.h"
@@ -44,8 +43,7 @@ namespace internal {
SystemGestureEventFilter::SystemGestureEventFilter()
: system_gestures_enabled_(CommandLine::ForCurrentProcess()->
HasSwitch(ash::switches::kAshEnableAdvancedGestures)),
- long_press_affordance_(new LongPressAffordanceHandler),
- two_finger_drag_(new TwoFingerDragHandler) {
+ long_press_affordance_(new LongPressAffordanceHandler) {
if (switches::UseOverviewMode())
overview_gesture_handler_.reset(new OverviewGestureHandler);
}
@@ -81,11 +79,6 @@ void SystemGestureEventFilter::OnGestureEvent(ui::GestureEvent* event) {
ash::TouchUMA::GetInstance()->RecordGestureEvent(target, *event);
long_press_affordance_->ProcessEvent(target, event);
- if (two_finger_drag_->ProcessGestureEvent(target, *event)) {
- event->StopPropagation();
- return;
- }
-
if (overview_gesture_handler_ &&
overview_gesture_handler_->ProcessGestureEvent(*event)) {
event->StopPropagation();
diff --git a/ash/wm/system_gesture_event_filter.h b/ash/wm/system_gesture_event_filter.h
index 0609802..bc57b7c 100644
--- a/ash/wm/system_gesture_event_filter.h
+++ b/ash/wm/system_gesture_event_filter.h
@@ -33,7 +33,6 @@ class LongPressAffordanceHandler;
class OverviewGestureHandler;
class SystemPinchHandler;
class TouchUMA;
-class TwoFingerDragHandler;
// An event filter which handles system level gesture events.
class SystemGestureEventFilter : public ui::EventHandler,
@@ -68,7 +67,6 @@ class SystemGestureEventFilter : public ui::EventHandler,
scoped_ptr<LongPressAffordanceHandler> long_press_affordance_;
scoped_ptr<OverviewGestureHandler> overview_gesture_handler_;
- scoped_ptr<TwoFingerDragHandler> two_finger_drag_;
DISALLOW_COPY_AND_ASSIGN(SystemGestureEventFilter);
};
diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc
index 635860f..399b5c2 100644
--- a/ash/wm/toplevel_window_event_handler.cc
+++ b/ash/wm/toplevel_window_event_handler.cc
@@ -36,6 +36,35 @@ namespace ash {
namespace {
+// Returns whether |window| can be moved via a two finger drag given
+// the hittest results of the two fingers.
+bool CanStartTwoFingerMove(aura::Window* window,
+ int window_component1,
+ int window_component2) {
+ // We allow moving a window via two fingers when the hittest components are
+ // HTCLIENT. This is done so that a window can be dragged via two fingers when
+ // the tab strip is full and hitting the caption area is difficult. We check
+ // the window type and the show state so that we do not steal touches from the
+ // web contents.
+ if (!ash::wm::GetWindowState(window)->IsNormalShowState() ||
+ window->type() != ui::wm::WINDOW_TYPE_NORMAL) {
+ return false;
+ }
+ int component1_behavior =
+ WindowResizer::GetBoundsChangeForWindowComponent(window_component1);
+ int component2_behavior =
+ WindowResizer::GetBoundsChangeForWindowComponent(window_component2);
+ return (component1_behavior & WindowResizer::kBoundsChange_Resizes) == 0 &&
+ (component2_behavior & WindowResizer::kBoundsChange_Resizes) == 0;
+}
+
+// Returns whether |window| can be moved or resized via one finger given
+// |window_component|.
+bool CanStartOneFingerDrag(int window_component) {
+ return WindowResizer::GetBoundsChangeForWindowComponent(
+ window_component) != 0;
+}
+
gfx::Point ConvertPointToParent(aura::Window* window,
const gfx::Point& point) {
gfx::Point result(point);
@@ -43,6 +72,11 @@ gfx::Point ConvertPointToParent(aura::Window* window,
return result;
}
+// Returns the window component containing |event|'s location.
+int GetWindowComponent(aura::Window* window, const ui::LocatedEvent& event) {
+ return window->delegate()->GetNonClientComponent(event.location());
+}
+
} // namespace
// ScopedWindowResizer ---------------------------------------------------------
@@ -58,6 +92,9 @@ class ToplevelWindowEventHandler::ScopedWindowResizer
WindowResizer* resizer);
virtual ~ScopedWindowResizer();
+ // Returns true if the drag moves the window and does not resize.
+ bool IsMove() const;
+
WindowResizer* resizer() { return resizer_.get(); }
// WindowObserver overrides:
@@ -90,6 +127,11 @@ ToplevelWindowEventHandler::ScopedWindowResizer::~ScopedWindowResizer() {
wm::GetWindowState(resizer_->GetTarget())->RemoveObserver(this);
}
+bool ToplevelWindowEventHandler::ScopedWindowResizer::IsMove() const {
+ return resizer_->details().bounds_change ==
+ WindowResizer::kBoundsChange_Repositions;
+}
+
void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowHierarchyChanging(
const HierarchyChangeParams& params) {
if (params.receiver != resizer_->GetTarget())
@@ -117,9 +159,10 @@ void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowDestroying(
// ToplevelWindowEventHandler --------------------------------------------------
ToplevelWindowEventHandler::ToplevelWindowEventHandler()
- : in_move_loop_(false),
- drag_reverted_(false),
+ : first_finger_hittest_(HTNOWHERE),
+ in_move_loop_(false),
in_gesture_drag_(false),
+ drag_reverted_(false),
destroyed_(NULL) {
Shell::GetInstance()->display_controller()->AddObserver(this);
}
@@ -182,10 +225,17 @@ void ToplevelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) {
return;
}
+ if (event->details().touch_points() > 2) {
+ if (window_resizer_.get()) {
+ CompleteDrag(DRAG_COMPLETE);
+ event->StopPropagation();
+ }
+ return;
+ }
+
switch (event->type()) {
case ui::ET_GESTURE_TAP_DOWN: {
- int component =
- target->delegate()->GetNonClientComponent(event->location());
+ int component = GetWindowComponent(target, *event);
if (!(WindowResizer::GetBoundsChangeForWindowComponent(component) &
WindowResizer::kBoundsChange_Resizes))
return;
@@ -200,14 +250,51 @@ void ToplevelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) {
Shell::GetInstance()->resize_shadow_controller();
if (controller)
controller->HideShadow(target);
+
+ if (window_resizer_.get() &&
+ (event->details().touch_points() == 1 ||
+ !CanStartOneFingerDrag(first_finger_hittest_))) {
+ CompleteDrag(DRAG_COMPLETE);
+ event->StopPropagation();
+ }
+ return;
+ }
+ case ui::ET_GESTURE_BEGIN: {
+ if (event->details().touch_points() == 1) {
+ first_finger_hittest_ = GetWindowComponent(target, *event);
+ } else if (window_resizer_.get()) {
+ if (!window_resizer_->IsMove()) {
+ // The transition from resizing with one finger to resizing with two
+ // fingers causes unintended resizing because the location of
+ // ET_GESTURE_SCROLL_UPDATE jumps from the position of the first
+ // finger to the position in the middle of the two fingers. For this
+ // reason two finger resizing is not supported.
+ CompleteDrag(DRAG_COMPLETE);
+ event->StopPropagation();
+ }
+ } else {
+ int second_finger_hittest = GetWindowComponent(target, *event);
+ if (CanStartTwoFingerMove(
+ target, first_finger_hittest_, second_finger_hittest)) {
+ gfx::Point location_in_parent =
+ event->details().bounding_box().CenterPoint();
+ AttemptToStartDrag(target, location_in_parent, HTCAPTION,
+ aura::client::WINDOW_MOVE_SOURCE_TOUCH);
+ event->StopPropagation();
+ }
+ }
return;
}
case ui::ET_GESTURE_SCROLL_BEGIN: {
- if (in_gesture_drag_)
+ // The one finger drag is not started in ET_GESTURE_BEGIN to avoid the
+ // window jumping upon initiating a two finger drag. When a one finger
+ // drag is converted to a two finger drag, a jump occurs because the
+ // location of the ET_GESTURE_SCROLL_UPDATE event switches from the single
+ // finger's position to the position in the middle of the two fingers.
+ if (window_resizer_.get())
return;
- int component =
- target->delegate()->GetNonClientComponent(event->location());
- if (WindowResizer::GetBoundsChangeForWindowComponent(component) == 0)
+ int component = GetWindowComponent(target, *event);
+ if (!CanStartOneFingerDrag(component))
return;
gfx::Point location_in_parent(
ConvertPointToParent(target, event->location()));
@@ -220,30 +307,33 @@ void ToplevelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) {
break;
}
- if (!in_gesture_drag_)
+ if (!window_resizer_.get())
return;
switch (event->type()) {
- case ui::ET_GESTURE_SCROLL_UPDATE: {
+ case ui::ET_GESTURE_SCROLL_UPDATE:
HandleDrag(target, event);
event->StopPropagation();
return;
- }
case ui::ET_GESTURE_SCROLL_END:
+ // We must complete the drag here instead of as a result of ET_GESTURE_END
+ // because otherwise the drag will be reverted when EndMoveLoop() is
+ // called.
+ // TODO(pkotwicz): Pass drag completion status to
+ // WindowMoveClient::EndMoveLoop().
CompleteDrag(DRAG_COMPLETE);
event->StopPropagation();
return;
- case ui::ET_SCROLL_FLING_START: {
+ case ui::ET_SCROLL_FLING_START:
CompleteDrag(DRAG_COMPLETE);
- int component =
- target->delegate()->GetNonClientComponent(event->location());
- if (component != HTCAPTION)
- return;
-
- wm::WindowState* window_state = wm::GetWindowState(target);
- if (!window_state->IsNormalShowState())
+ // TODO(pkotwicz): Fix tests which inadvertantly start flings and check
+ // window_resizer_->IsMove() instead of the hittest component at |event|'s
+ // location.
+ if (GetWindowComponent(target, *event) != HTCAPTION ||
+ !wm::GetWindowState(target)->IsNormalShowState()) {
return;
+ }
if (event->details().velocity_y() > kMinVertVelocityForWindowMinimize) {
SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MINIMIZED);
@@ -259,7 +349,22 @@ void ToplevelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) {
}
event->StopPropagation();
return;
- }
+ case ui::ET_GESTURE_MULTIFINGER_SWIPE:
+ if (!wm::GetWindowState(target)->IsNormalShowState())
+ return;
+
+ CompleteDrag(DRAG_COMPLETE);
+
+ if (event->details().swipe_down())
+ SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MINIMIZED);
+ else if (event->details().swipe_up())
+ SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MAXIMIZED);
+ else if (event->details().swipe_right())
+ SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_RIGHT_SNAPPED);
+ else
+ SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_LEFT_SNAPPED);
+ event->StopPropagation();
+ return;
default:
return;
}
@@ -344,6 +449,7 @@ void ToplevelWindowEventHandler::CompleteDrag(DragCompletionStatus status) {
}
drag_reverted_ = (status == DRAG_REVERT);
+ first_finger_hittest_ = HTNOWHERE;
in_gesture_drag_ = false;
if (in_move_loop_)
quit_closure_.Run();
@@ -358,8 +464,7 @@ void ToplevelWindowEventHandler::HandleMousePressed(
// We also update the current window component here because for the
// mouse-drag-release-press case, where the mouse is released and
// pressed without mouse move event.
- int component =
- target->delegate()->GetNonClientComponent(event->location());
+ int component = GetWindowComponent(target, *event);
if ((event->flags() &
(ui::EF_IS_DOUBLE_CLICK | ui::EF_IS_TRIPLE_CLICK)) == 0 &&
WindowResizer::GetBoundsChangeForWindowComponent(component)) {
@@ -369,7 +474,7 @@ void ToplevelWindowEventHandler::HandleMousePressed(
aura::client::WINDOW_MOVE_SOURCE_MOUSE);
event->StopPropagation();
} else {
- window_resizer_.reset();
+ CompleteDrag(DRAG_COMPLETE);
}
}
diff --git a/ash/wm/toplevel_window_event_handler.h b/ash/wm/toplevel_window_event_handler.h
index 5717690..084573e 100644
--- a/ash/wm/toplevel_window_event_handler.h
+++ b/ash/wm/toplevel_window_event_handler.h
@@ -74,15 +74,12 @@ class ASH_EXPORT ToplevelWindowEventHandler
void HandleMouseReleased(aura::Window* target, ui::MouseEvent* event);
// Called during a drag to resize/position the window.
- // The return value is returned by OnMouseEvent() above.
void HandleDrag(aura::Window* target, ui::LocatedEvent* event);
// Called during mouse moves to update window resize shadows.
- // Return value is returned by OnMouseEvent() above.
void HandleMouseMoved(aura::Window* target, ui::LocatedEvent* event);
// Called for mouse exits to hide window resize shadows.
- // Return value is returned by OnMouseEvent() above.
void HandleMouseExited(aura::Window* target, ui::LocatedEvent* event);
// Sets |window|'s show type to |new_show_type|. Called after the drag has
@@ -93,20 +90,23 @@ class ASH_EXPORT ToplevelWindowEventHandler
// Invoked from ScopedWindowResizer if the window is destroyed.
void ResizerWindowDestroyed();
+ // The hittest result for the first finger at the time that it initially
+ // touched the screen. |first_finger_hittest_| is one of ui/base/hit_test.h
+ int first_finger_hittest_;
+
+ // The window bounds when the drag was started. When a window is minimized,
+ // maximized or snapped via a swipe/fling gesture, the restore bounds should
+ // be set to the bounds of the window when the drag was started.
+ gfx::Rect pre_drag_window_bounds_;
+
// Are we running a nested message loop from RunMoveLoop().
bool in_move_loop_;
- // Whether the drag was reverted. Set by CompleteDrag().
- bool drag_reverted_;
-
// Is a window move/resize in progress because of gesture events?
bool in_gesture_drag_;
- // The window bounds before it started the drag.
- // When a window is moved using a touch gesture, and it is swiped up/down
- // maximize/minimize, the restore bounds should be set to the bounds of the
- // window when the drag started.
- gfx::Rect pre_drag_window_bounds_;
+ // Whether the drag was reverted. Set by CompleteDrag().
+ bool drag_reverted_;
scoped_ptr<ScopedWindowResizer> window_resizer_;