OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
991 | 991 |
992 if (shelf_->launcher() && shelf_->launcher()->IsShowingMenu()) | 992 if (shelf_->launcher() && shelf_->launcher()->IsShowingMenu()) |
993 return SHELF_AUTO_HIDE_SHOWN; | 993 return SHELF_AUTO_HIDE_SHOWN; |
994 | 994 |
995 if (shelf_->launcher() && shelf_->launcher()->IsShowingOverflowBubble()) | 995 if (shelf_->launcher() && shelf_->launcher()->IsShowingOverflowBubble()) |
996 return SHELF_AUTO_HIDE_SHOWN; | 996 return SHELF_AUTO_HIDE_SHOWN; |
997 | 997 |
998 if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive()) | 998 if (shelf_->IsActive() || shelf_->status_area_widget()->IsActive()) |
999 return SHELF_AUTO_HIDE_SHOWN; | 999 return SHELF_AUTO_HIDE_SHOWN; |
1000 | 1000 |
1001 // Don't show if the user is dragging the mouse. | |
1002 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) | |
1003 return SHELF_AUTO_HIDE_HIDDEN; | |
flackr
2013/09/16 20:55:06
Won't this only work for mouse drags and not touch
varkha
2013/09/17 04:36:43
Correct on both accounts. Dragging on empty deskto
| |
1004 | |
1001 const std::vector<aura::Window*> windows = | 1005 const std::vector<aura::Window*> windows = |
1002 ash::MruWindowTracker::BuildWindowList(false); | 1006 ash::MruWindowTracker::BuildWindowList(false); |
1003 | 1007 |
1004 // Process the window list and check if there are any visible windows. | 1008 // Process the window list and check if there are any visible windows. |
1005 bool visible_window = false; | 1009 bool visible_window = false; |
1006 for (size_t i = 0; i < windows.size(); ++i) { | 1010 for (size_t i = 0; i < windows.size(); ++i) { |
1007 if (windows[i] && windows[i]->IsVisible() && | 1011 if (windows[i] && windows[i]->IsVisible() && |
1008 !ash::wm::IsWindowMinimized(windows[i]) && | 1012 !ash::wm::IsWindowMinimized(windows[i]) && |
1009 root_window_ == windows[i]->GetRootWindow()) { | 1013 root_window_ == windows[i]->GetRootWindow()) { |
1010 visible_window = true; | 1014 visible_window = true; |
1011 break; | 1015 break; |
1012 } | 1016 } |
1013 } | 1017 } |
1014 // If there are no visible windows do not hide the shelf. | 1018 // If there are no visible windows do not hide the shelf. |
1015 if (!visible_window) | 1019 if (!visible_window) |
1016 return SHELF_AUTO_HIDE_SHOWN; | 1020 return SHELF_AUTO_HIDE_SHOWN; |
1017 | 1021 |
1018 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) | 1022 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) |
1019 return gesture_drag_auto_hide_state_; | 1023 return gesture_drag_auto_hide_state_; |
1020 | 1024 |
1021 // Don't show if the user is dragging the mouse. | |
1022 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) | |
1023 return SHELF_AUTO_HIDE_HIDDEN; | |
1024 | |
1025 // Ignore the mouse position if mouse events are disabled. | 1025 // Ignore the mouse position if mouse events are disabled. |
1026 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( | 1026 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( |
1027 shelf_->GetNativeWindow()->GetRootWindow()); | 1027 shelf_->GetNativeWindow()->GetRootWindow()); |
1028 if (!cursor_client->IsMouseEventsEnabled()) | 1028 if (!cursor_client->IsMouseEventsEnabled()) |
1029 return SHELF_AUTO_HIDE_HIDDEN; | 1029 return SHELF_AUTO_HIDE_HIDDEN; |
1030 | 1030 |
1031 gfx::Rect shelf_region = shelf_->GetWindowBoundsInScreen(); | 1031 gfx::Rect shelf_region = shelf_->GetWindowBoundsInScreen(); |
1032 if (shelf_->status_area_widget() && | 1032 if (shelf_->status_area_widget() && |
1033 shelf_->status_area_widget()->IsMessageBubbleShown() && | 1033 shelf_->status_area_widget()->IsMessageBubbleShown() && |
1034 IsVisible()) { | 1034 IsVisible()) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1149 return gfx::Insets(0, distance, 0, 0); | 1149 return gfx::Insets(0, distance, 0, 0); |
1150 case SHELF_ALIGNMENT_TOP: | 1150 case SHELF_ALIGNMENT_TOP: |
1151 return gfx::Insets(0, 0, distance, 0); | 1151 return gfx::Insets(0, 0, distance, 0); |
1152 } | 1152 } |
1153 NOTREACHED(); | 1153 NOTREACHED(); |
1154 return gfx::Insets(); | 1154 return gfx::Insets(); |
1155 } | 1155 } |
1156 | 1156 |
1157 } // namespace internal | 1157 } // namespace internal |
1158 } // namespace ash | 1158 } // namespace ash |
OLD | NEW |