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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 #if defined(USE_WAYLAND) | 109 #if defined(USE_WAYLAND) |
110 base::MessagePumpObserver::EventStatus TooltipManagerViews::WillProcessEvent( | 110 base::MessagePumpObserver::EventStatus TooltipManagerViews::WillProcessEvent( |
111 ui::WaylandEvent* event) { | 111 ui::WaylandEvent* event) { |
112 if (event->type == ui::WAYLAND_MOTION) | 112 if (event->type == ui::WAYLAND_MOTION) |
113 OnMouseMoved(event->motion.x, event->motion.y); | 113 OnMouseMoved(event->motion.x, event->motion.y); |
114 return base::MessagePumpObserver::EVENT_CONTINUE; | 114 return base::MessagePumpObserver::EVENT_CONTINUE; |
115 } | 115 } |
116 #elif defined(USE_X11) | 116 #elif defined(USE_X11) |
117 base::MessagePumpObserver::EventStatus TooltipManagerViews::WillProcessXEvent( | 117 base::EventStatus TooltipManagerViews::WillProcessEvent( |
118 XEvent* xevent) { | 118 const base::NativeEvent& event) { |
119 XGenericEventCookie* cookie = &xevent->xcookie; | 119 XGenericEventCookie* cookie = &event->xcookie; |
120 if (cookie->evtype == XI_Motion) { | 120 if (cookie->evtype == XI_Motion) { |
121 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data); | 121 const XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data); |
122 OnMouseMoved(static_cast<int>(xievent->event_x), | 122 OnMouseMoved(static_cast<int>(xievent->event_x), |
123 static_cast<int>(xievent->event_y)); | 123 static_cast<int>(xievent->event_y)); |
124 } | 124 } |
125 return base::MessagePumpObserver::EVENT_CONTINUE; | 125 return base::EVENT_CONTINUE; |
| 126 } |
| 127 |
| 128 void TooltipManagerViews::DidProcessEvent(const base::NativeEvent& event) { |
126 } | 129 } |
127 #elif defined(OS_WIN) | 130 #elif defined(OS_WIN) |
128 void TooltipManagerViews::WillProcessMessage(const MSG& msg) { | 131 base::EventStatus TooltipManagerViews::WillProcessEvent( |
| 132 const base::NativeEvent& event) { |
129 if (msg.message == WM_MOUSEMOVE) | 133 if (msg.message == WM_MOUSEMOVE) |
130 OnMouseMoved(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); | 134 OnMouseMoved(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); |
| 135 return base::EVENT_CONTINUE; |
131 } | 136 } |
132 | 137 |
133 void TooltipManagerViews::DidProcessMessage(const MSG& msg) { | 138 void TooltipManagerViews::DidProcessEvent(const base::NativeEvent& event) { |
134 } | 139 } |
135 #endif | 140 #endif |
136 | 141 |
137 void TooltipManagerViews::TooltipTimerFired() { | 142 void TooltipManagerViews::TooltipTimerFired() { |
138 if (tooltip_widget_->IsVisible()) { | 143 if (tooltip_widget_->IsVisible()) { |
139 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); | 144 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); |
140 } else { | 145 } else { |
141 tooltip_view_ = GetViewForTooltip(curr_mouse_pos_.x(), curr_mouse_pos_.y(), | 146 tooltip_view_ = GetViewForTooltip(curr_mouse_pos_.x(), curr_mouse_pos_.y(), |
142 false); | 147 false); |
143 Update(); | 148 Update(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (tooltip_timer_.IsRunning()) | 222 if (tooltip_timer_.IsRunning()) |
218 tooltip_timer_.Reset(); | 223 tooltip_timer_.Reset(); |
219 curr_mouse_pos_.SetPoint(x, y); | 224 curr_mouse_pos_.SetPoint(x, y); |
220 | 225 |
221 // If tooltip is visible, we may want to hide it. If it is not, we are ok. | 226 // If tooltip is visible, we may want to hide it. If it is not, we are ok. |
222 if (tooltip_widget_->IsVisible()) | 227 if (tooltip_widget_->IsVisible()) |
223 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); | 228 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); |
224 } | 229 } |
225 | 230 |
226 } // namespace views | 231 } // namespace views |
OLD | NEW |