OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/tooltip_manager_views.h" | 5 #include "views/widget/tooltip_manager_views.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #endif | 10 #endif |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 switch (event.type()) { | 89 switch (event.type()) { |
90 case ui::ET_MOUSE_EXITED: | 90 case ui::ET_MOUSE_EXITED: |
91 // Mouse is exiting this widget. Stop showing the tooltip and the timer. | 91 // Mouse is exiting this widget. Stop showing the tooltip and the timer. |
92 if (tooltip_timer_.IsRunning()) | 92 if (tooltip_timer_.IsRunning()) |
93 tooltip_timer_.Stop(); | 93 tooltip_timer_.Stop(); |
94 if (tooltip_widget_->IsVisible()) | 94 if (tooltip_widget_->IsVisible()) |
95 tooltip_widget_->Hide(); | 95 tooltip_widget_->Hide(); |
96 break; | 96 break; |
97 case ui::ET_MOUSE_ENTERED: | 97 case ui::ET_MOUSE_ENTERED: |
98 // Mouse just entered this widget. Start the timer to show the tooltip. | 98 // Mouse just entered this widget. Start the timer to show the tooltip. |
99 CHECK(!tooltip_timer_.IsRunning()); | 99 if (tooltip_timer_.IsRunning()) |
| 100 tooltip_timer_.Stop(); |
100 tooltip_timer_.Start(FROM_HERE, | 101 tooltip_timer_.Start(FROM_HERE, |
101 base::TimeDelta::FromMilliseconds(kTooltipTimeoutMs), | 102 base::TimeDelta::FromMilliseconds(kTooltipTimeoutMs), |
102 this, &TooltipManagerViews::TooltipTimerFired); | 103 this, &TooltipManagerViews::TooltipTimerFired); |
103 break; | 104 break; |
104 case ui::ET_MOUSE_MOVED: | 105 case ui::ET_MOUSE_MOVED: |
105 OnMouseMoved(event.location().x(), event.location().y()); | 106 OnMouseMoved(event.location().x(), event.location().y()); |
106 break; | 107 break; |
107 case ui::ET_MOUSE_PRESSED: | 108 case ui::ET_MOUSE_PRESSED: |
108 case ui::ET_MOUSE_RELEASED: | 109 case ui::ET_MOUSE_RELEASED: |
109 case ui::ET_MOUSE_DRAGGED: | 110 case ui::ET_MOUSE_DRAGGED: |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (tooltip_timer_.IsRunning()) | 230 if (tooltip_timer_.IsRunning()) |
230 tooltip_timer_.Reset(); | 231 tooltip_timer_.Reset(); |
231 curr_mouse_pos_.SetPoint(x, y); | 232 curr_mouse_pos_.SetPoint(x, y); |
232 | 233 |
233 // If tooltip is visible, we may want to hide it. If it is not, we are ok. | 234 // If tooltip is visible, we may want to hide it. If it is not, we are ok. |
234 if (tooltip_widget_->IsVisible()) | 235 if (tooltip_widget_->IsVisible()) |
235 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); | 236 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); |
236 } | 237 } |
237 | 238 |
238 } // namespace views | 239 } // namespace views |
OLD | NEW |