OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/platform/x11/x11_event_source.h" | 5 #include "ui/events/platform/x11/x11_event_source.h" |
6 | 6 |
7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
8 #include <X11/X.h> | 8 #include <X11/X.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 uint32_t action = DispatchEvent(xevent); | 129 uint32_t action = DispatchEvent(xevent); |
130 if (have_cookie) | 130 if (have_cookie) |
131 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 131 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
132 return action; | 132 return action; |
133 } | 133 } |
134 | 134 |
135 uint32_t X11EventSource::DispatchEvent(XEvent* xevent) { | 135 uint32_t X11EventSource::DispatchEvent(XEvent* xevent) { |
136 uint32_t action = PlatformEventSource::DispatchEvent(xevent); | 136 uint32_t action = PlatformEventSource::DispatchEvent(xevent); |
137 if (xevent->type == GenericEvent && | 137 if (xevent->type == GenericEvent && |
138 xevent->xgeneric.evtype == XI_HierarchyChanged) { | 138 (xevent->xgeneric.evtype == XI_HierarchyChanged || |
| 139 xevent->xgeneric.evtype == XI_DeviceChanged)) { |
139 ui::UpdateDeviceList(); | 140 ui::UpdateDeviceList(); |
140 hotplug_event_handler_->OnHotplugEvent(); | 141 hotplug_event_handler_->OnHotplugEvent(); |
141 } | 142 } |
| 143 |
| 144 if (xevent->type == EnterNotify && |
| 145 xevent->xcrossing.detail != NotifyInferior && |
| 146 xevent->xcrossing.mode != NotifyUngrab) { |
| 147 // Clear stored scroll data |
| 148 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); |
| 149 } |
142 return action; | 150 return action; |
143 } | 151 } |
144 | 152 |
145 void X11EventSource::StopCurrentEventStream() { | 153 void X11EventSource::StopCurrentEventStream() { |
146 continue_stream_ = false; | 154 continue_stream_ = false; |
147 } | 155 } |
148 | 156 |
149 void X11EventSource::OnDispatcherListChanged() { | 157 void X11EventSource::OnDispatcherListChanged() { |
150 if (!hotplug_event_handler_) { | 158 if (!hotplug_event_handler_) { |
151 hotplug_event_handler_.reset(new X11HotplugEventHandler()); | 159 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
152 // Force the initial device query to have an update list of active devices. | 160 // Force the initial device query to have an update list of active devices. |
153 hotplug_event_handler_->OnHotplugEvent(); | 161 hotplug_event_handler_->OnHotplugEvent(); |
154 } | 162 } |
155 } | 163 } |
156 | 164 |
157 } // namespace ui | 165 } // namespace ui |
OLD | NEW |