Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: ui/events/platform/x11/x11_event_source.cc

Issue 2879033002: Keyboard Lock Host implementation
Patch Set: Remove useless files Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/platform/x11/x11_event_source.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) { 232 void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) {
233 bool have_cookie = false; 233 bool have_cookie = false;
234 if (xevent->type == GenericEvent && 234 if (xevent->type == GenericEvent &&
235 XGetEventData(xevent->xgeneric.display, &xevent->xcookie)) { 235 XGetEventData(xevent->xgeneric.display, &xevent->xcookie)) {
236 have_cookie = true; 236 have_cookie = true;
237 } 237 }
238 238
239 dispatching_event_ = xevent; 239 dispatching_event_ = xevent;
240 240
241 delegate_->ProcessXEvent(xevent); 241 if (!filter_ || !filter_->OnPlatformEvent(xevent)) {
242 delegate_->ProcessXEvent(xevent);
243 } else {
244 LOG(ERROR) << "Block XEvent " << xevent;
245 }
242 PostDispatchEvent(xevent); 246 PostDispatchEvent(xevent);
243 247
244 dispatching_event_ = nullptr; 248 dispatching_event_ = nullptr;
245 249
246 if (have_cookie) 250 if (have_cookie)
247 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); 251 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie);
248 } 252 }
249 253
250 void X11EventSource::PostDispatchEvent(XEvent* xevent) { 254 void X11EventSource::PostDispatchEvent(XEvent* xevent) {
251 bool should_update_device_list = false; 255 bool should_update_device_list = false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 298 }
295 299
296 void X11EventSource::OnDispatcherListChanged() { 300 void X11EventSource::OnDispatcherListChanged() {
297 if (!hotplug_event_handler_) { 301 if (!hotplug_event_handler_) {
298 hotplug_event_handler_.reset(new X11HotplugEventHandler()); 302 hotplug_event_handler_.reset(new X11HotplugEventHandler());
299 // Force the initial device query to have an update list of active devices. 303 // Force the initial device query to have an update list of active devices.
300 hotplug_event_handler_->OnHotplugEvent(); 304 hotplug_event_handler_->OnHotplugEvent();
301 } 305 }
302 } 306 }
303 307
308 void X11EventSource::set_platform_key_event_filter(
309 keyboard_lock::PlatformKeyEventFilter* filter) {
310 filter_ = filter;
311 }
312
304 } // namespace ui 313 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/platform/x11/x11_event_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698