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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 have_cookie = true; | 127 have_cookie = true; |
128 } | 128 } |
129 | 129 |
130 uint32_t action = PlatformEventSource::DispatchEvent(xevent); | 130 uint32_t action = PlatformEventSource::DispatchEvent(xevent); |
131 if (xevent->type == GenericEvent && | 131 if (xevent->type == GenericEvent && |
132 xevent->xgeneric.evtype == XI_HierarchyChanged) { | 132 xevent->xgeneric.evtype == XI_HierarchyChanged) { |
133 ui::UpdateDeviceList(); | 133 ui::UpdateDeviceList(); |
134 hotplug_event_handler_->OnHotplugEvent(); | 134 hotplug_event_handler_->OnHotplugEvent(); |
135 } | 135 } |
136 | 136 |
| 137 if ((xevent->type == EnterNotify || xevent->type == LeaveNotify) && |
| 138 xevent->xcrossing.mode == NotifyNormal) { |
| 139 // Clear stored scroll data |
| 140 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); |
| 141 } |
| 142 |
137 if (have_cookie) | 143 if (have_cookie) |
138 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 144 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
139 return action; | 145 return action; |
140 } | 146 } |
141 | 147 |
142 void X11EventSource::StopCurrentEventStream() { | 148 void X11EventSource::StopCurrentEventStream() { |
143 continue_stream_ = false; | 149 continue_stream_ = false; |
144 } | 150 } |
145 | 151 |
146 void X11EventSource::OnDispatcherListChanged() { | 152 void X11EventSource::OnDispatcherListChanged() { |
147 if (!hotplug_event_handler_) { | 153 if (!hotplug_event_handler_) { |
148 hotplug_event_handler_.reset(new X11HotplugEventHandler()); | 154 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
149 // Force the initial device query to have an update list of active devices. | 155 // Force the initial device query to have an update list of active devices. |
150 hotplug_event_handler_->OnHotplugEvent(); | 156 hotplug_event_handler_->OnHotplugEvent(); |
151 } | 157 } |
152 } | 158 } |
153 | 159 |
154 } // namespace ui | 160 } // namespace ui |
OLD | NEW |