| 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& xevent) { |
| 119 XGenericEventCookie* cookie = &xevent->xcookie; | 119 XGenericEventCookie* cookie = &xevent->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 } | 126 } |
| 127 void TooltipManagerViews::DidProcessEvent(const base::NativeEvent& msg) { |
| 128 } |
| 129 |
| 127 #elif defined(OS_WIN) | 130 #elif defined(OS_WIN) |
| 128 void TooltipManagerViews::WillProcessMessage(const MSG& msg) { | 131 base::EventStatus TooltipManagerViews::WillProcessEvent(const MSG& msg) { |
| 129 if (msg.message == WM_MOUSEMOVE) | 132 if (msg.message == WM_MOUSEMOVE) |
| 130 OnMouseMoved(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); | 133 OnMouseMoved(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); |
| 134 return base::EVENT_CONTINUE; |
| 131 } | 135 } |
| 132 | 136 |
| 133 void TooltipManagerViews::DidProcessMessage(const MSG& msg) { | 137 void TooltipManagerViews::DidProcessEvent(const MSG& msg) { |
| 134 } | 138 } |
| 135 #endif | 139 #endif |
| 136 | 140 |
| 137 void TooltipManagerViews::TooltipTimerFired() { | 141 void TooltipManagerViews::TooltipTimerFired() { |
| 138 if (tooltip_widget_->IsVisible()) { | 142 if (tooltip_widget_->IsVisible()) { |
| 139 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); | 143 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); |
| 140 } else { | 144 } else { |
| 141 tooltip_view_ = GetViewForTooltip(curr_mouse_pos_.x(), curr_mouse_pos_.y(), | 145 tooltip_view_ = GetViewForTooltip(curr_mouse_pos_.x(), curr_mouse_pos_.y(), |
| 142 false); | 146 false); |
| 143 Update(); | 147 Update(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (tooltip_timer_.IsRunning()) | 221 if (tooltip_timer_.IsRunning()) |
| 218 tooltip_timer_.Reset(); | 222 tooltip_timer_.Reset(); |
| 219 curr_mouse_pos_.SetPoint(x, y); | 223 curr_mouse_pos_.SetPoint(x, y); |
| 220 | 224 |
| 221 // If tooltip is visible, we may want to hide it. If it is not, we are ok. | 225 // If tooltip is visible, we may want to hide it. If it is not, we are ok. |
| 222 if (tooltip_widget_->IsVisible()) | 226 if (tooltip_widget_->IsVisible()) |
| 223 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); | 227 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); |
| 224 } | 228 } |
| 225 | 229 |
| 226 } // namespace views | 230 } // namespace views |
| OLD | NEW |