| 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/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/XKBlib.h> | 8 #include <X11/XKBlib.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) { | 231 void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) { |
| 232 bool have_cookie = false; | 232 bool have_cookie = false; |
| 233 if (xevent->type == GenericEvent && | 233 if (xevent->type == GenericEvent && |
| 234 XGetEventData(xevent->xgeneric.display, &xevent->xcookie)) { | 234 XGetEventData(xevent->xgeneric.display, &xevent->xcookie)) { |
| 235 have_cookie = true; | 235 have_cookie = true; |
| 236 } | 236 } |
| 237 | 237 |
| 238 dispatching_event_ = xevent; | 238 dispatching_event_ = xevent; |
| 239 | 239 |
| 240 delegate_->ProcessXEvent(xevent); | 240 if (!filter_ || !filter_->OnPlatformEvent(xevent)) { |
| 241 delegate_->ProcessXEvent(xevent); |
| 242 } else { |
| 243 LOG(ERROR) << "Block XEvent " << xevent; |
| 244 } |
| 241 PostDispatchEvent(xevent); | 245 PostDispatchEvent(xevent); |
| 242 | 246 |
| 243 dispatching_event_ = nullptr; | 247 dispatching_event_ = nullptr; |
| 244 | 248 |
| 245 if (have_cookie) | 249 if (have_cookie) |
| 246 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 250 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
| 247 } | 251 } |
| 248 | 252 |
| 249 void X11EventSource::PostDispatchEvent(XEvent* xevent) { | 253 void X11EventSource::PostDispatchEvent(XEvent* xevent) { |
| 250 bool should_update_device_list = false; | 254 bool should_update_device_list = false; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 297 } |
| 294 | 298 |
| 295 void X11EventSource::OnDispatcherListChanged() { | 299 void X11EventSource::OnDispatcherListChanged() { |
| 296 if (!hotplug_event_handler_) { | 300 if (!hotplug_event_handler_) { |
| 297 hotplug_event_handler_.reset(new X11HotplugEventHandler()); | 301 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
| 298 // Force the initial device query to have an update list of active devices. | 302 // Force the initial device query to have an update list of active devices. |
| 299 hotplug_event_handler_->OnHotplugEvent(); | 303 hotplug_event_handler_->OnHotplugEvent(); |
| 300 } | 304 } |
| 301 } | 305 } |
| 302 | 306 |
| 307 void X11EventSource::set_platform_key_event_filter( |
| 308 keyboard_lock::PlatformKeyEventFilter* filter) { |
| 309 filter_ = filter; |
| 310 } |
| 311 |
| 303 } // namespace ui | 312 } // namespace ui |
| OLD | NEW |