diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 22:10:45 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 22:10:45 +0000 |
commit | b6bd792646c353a221bdee885e363fd1d4ac9b35 (patch) | |
tree | 1830ede7aa7a0a555b55fe260f5f0b605125ed11 /ui/views/widget/root_view.cc | |
parent | 5cda035ba3e2ac4914b5ffb7e1cd60897dd8f08b (diff) | |
download | chromium_src-b6bd792646c353a221bdee885e363fd1d4ac9b35.zip chromium_src-b6bd792646c353a221bdee885e363fd1d4ac9b35.tar.gz chromium_src-b6bd792646c353a221bdee885e363fd1d4ac9b35.tar.bz2 |
Makes the tabstrip switch between stacked and shrink modes based on
whether the a mouse or touch input is used. Heres the specific
semantics used:
. If we detect 3 mouse moves within 200ms we assume the user is using
a mouse and switch to shrink.
. On release we switch immediately based on the flags in the event.
Ideally we would switch to stacked on mouse enter, but because windows
generates events without telling us they are from a touch device we
have to infer based on time. When we convert all views to touch events
we can likely simplify this code.
BUG=128741
TEST=none
R=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10413067
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget/root_view.cc')
-rw-r--r-- | ui/views/widget/root_view.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc index 872dff6..f2025c6 100644 --- a/ui/views/widget/root_view.cc +++ b/ui/views/widget/root_view.cc @@ -30,10 +30,10 @@ enum EventType { // |view| is the view receiving |event|. This function sends the event to all // the Views up the hierarchy that has |notify_enter_exit_on_child_| flag turned // on, but does not contain |sibling|. -void NotifyEnterExitOfDescendeant(const MouseEvent& event, - EventType type, - View* view, - View* sibling) { +void NotifyEnterExitOfDescendant(const MouseEvent& event, + EventType type, + View* view, + View* sibling) { for (View* p = view->parent(); p; p = p->parent()) { if (!p->notify_enter_exit_on_child()) continue; @@ -326,10 +326,10 @@ void RootView::OnMouseMoved(const MouseEvent& event) { if (v && v != this) { if (v != mouse_move_handler_) { if (mouse_move_handler_ != NULL && - (!mouse_move_handler_->notify_enter_exit_on_child() || - !mouse_move_handler_->Contains(v))) { + (!mouse_move_handler_->notify_enter_exit_on_child() || + !mouse_move_handler_->Contains(v))) { mouse_move_handler_->OnMouseExited(e); - NotifyEnterExitOfDescendeant(e, EVENT_EXIT, mouse_move_handler_, v); + NotifyEnterExitOfDescendant(e, EVENT_EXIT, mouse_move_handler_, v); } View* old_handler = mouse_move_handler_; mouse_move_handler_ = v; @@ -337,7 +337,7 @@ void RootView::OnMouseMoved(const MouseEvent& event) { if (!mouse_move_handler_->notify_enter_exit_on_child() || !mouse_move_handler_->Contains(old_handler)) { mouse_move_handler_->OnMouseEntered(entered_event); - NotifyEnterExitOfDescendeant(entered_event, EVENT_ENTER, v, + NotifyEnterExitOfDescendant(entered_event, EVENT_ENTER, v, old_handler); } } @@ -347,7 +347,7 @@ void RootView::OnMouseMoved(const MouseEvent& event) { widget_->SetCursor(mouse_move_handler_->GetCursor(moved_event)); } else if (mouse_move_handler_ != NULL) { mouse_move_handler_->OnMouseExited(e); - NotifyEnterExitOfDescendeant(e, EVENT_EXIT, mouse_move_handler_, v); + NotifyEnterExitOfDescendant(e, EVENT_EXIT, mouse_move_handler_, v); // On Aura the non-client area extends slightly outside the root view for // some windows. Let the non-client cursor handling code set the cursor // as we do above. @@ -359,7 +359,7 @@ void RootView::OnMouseMoved(const MouseEvent& event) { void RootView::OnMouseExited(const MouseEvent& event) { if (mouse_move_handler_ != NULL) { mouse_move_handler_->OnMouseExited(event); - NotifyEnterExitOfDescendeant(event, EVENT_EXIT, mouse_move_handler_, NULL); + NotifyEnterExitOfDescendant(event, EVENT_EXIT, mouse_move_handler_, NULL); mouse_move_handler_ = NULL; } } |