| 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/XKBlib.h> | 7 #include <X11/XKBlib.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 104 } |
| 105 delegate_->ProcessXEvent(xevent); | 105 delegate_->ProcessXEvent(xevent); |
| 106 PostDispatchEvent(xevent); | 106 PostDispatchEvent(xevent); |
| 107 if (have_cookie) | 107 if (have_cookie) |
| 108 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 108 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void X11EventSource::PostDispatchEvent(XEvent* xevent) { | 111 void X11EventSource::PostDispatchEvent(XEvent* xevent) { |
| 112 if (xevent->type == GenericEvent && | 112 if (xevent->type == GenericEvent && |
| 113 (xevent->xgeneric.evtype == XI_HierarchyChanged || | 113 (xevent->xgeneric.evtype == XI_HierarchyChanged || |
| 114 xevent->xgeneric.evtype == XI_DeviceChanged)) { | 114 (xevent->xgeneric.evtype == XI_DeviceChanged && |
| 115 static_cast<XIDeviceChangedEvent*>(xevent->xcookie.data)->reason == |
| 116 XIDeviceChange))) { |
| 115 ui::UpdateDeviceList(); | 117 ui::UpdateDeviceList(); |
| 116 hotplug_event_handler_->OnHotplugEvent(); | 118 hotplug_event_handler_->OnHotplugEvent(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 if (xevent->type == EnterNotify && | 121 if (xevent->type == EnterNotify && |
| 120 xevent->xcrossing.detail != NotifyInferior && | 122 xevent->xcrossing.detail != NotifyInferior && |
| 121 xevent->xcrossing.mode != NotifyUngrab) { | 123 xevent->xcrossing.mode != NotifyUngrab) { |
| 122 // Clear stored scroll data | 124 // Clear stored scroll data |
| 123 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); | 125 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); |
| 124 } | 126 } |
| 125 } | 127 } |
| 126 | 128 |
| 127 void X11EventSource::StopCurrentEventStream() { | 129 void X11EventSource::StopCurrentEventStream() { |
| 128 continue_stream_ = false; | 130 continue_stream_ = false; |
| 129 } | 131 } |
| 130 | 132 |
| 131 void X11EventSource::OnDispatcherListChanged() { | 133 void X11EventSource::OnDispatcherListChanged() { |
| 132 if (!hotplug_event_handler_) { | 134 if (!hotplug_event_handler_) { |
| 133 hotplug_event_handler_.reset(new X11HotplugEventHandler()); | 135 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
| 134 // Force the initial device query to have an update list of active devices. | 136 // Force the initial device query to have an update list of active devices. |
| 135 hotplug_event_handler_->OnHotplugEvent(); | 137 hotplug_event_handler_->OnHotplugEvent(); |
| 136 } | 138 } |
| 137 } | 139 } |
| 138 | 140 |
| 139 } // namespace ui | 141 } // namespace ui |
| OLD | NEW |