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

Side by Side Diff: ui/events/x/events_x.cc

Issue 313913004: Block internal PlatformEvents before they are dispatched in touchview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Block events from disabled devices through DeviceDataManager. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/event_constants.h" 5 #include "ui/events/event_constants.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string.h> 8 #include <string.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 namespace ui { 261 namespace ui {
262 262
263 void UpdateDeviceList() { 263 void UpdateDeviceList() {
264 XDisplay* display = gfx::GetXDisplay(); 264 XDisplay* display = gfx::GetXDisplay();
265 DeviceListCacheX::GetInstance()->UpdateDeviceList(display); 265 DeviceListCacheX::GetInstance()->UpdateDeviceList(display);
266 TouchFactory::GetInstance()->UpdateDeviceList(display); 266 TouchFactory::GetInstance()->UpdateDeviceList(display);
267 DeviceDataManager::GetInstance()->UpdateDeviceList(display); 267 DeviceDataManager::GetInstance()->UpdateDeviceList(display);
268 } 268 }
269 269
270 EventType EventTypeFromNative(const base::NativeEvent& native_event) { 270 EventType EventTypeFromNative(const base::NativeEvent& native_event) {
271 // Allow the DeviceDataManager to block the event. If blocked return
272 // ET_UNKNOWN as the type so this event will not be further processed.
273 if (DeviceDataManager::GetInstance()->EventBlocked(native_event))
274 return ET_UNKNOWN;
275
271 switch (native_event->type) { 276 switch (native_event->type) {
272 case KeyPress: 277 case KeyPress:
273 return ET_KEY_PRESSED; 278 return ET_KEY_PRESSED;
274 case KeyRelease: 279 case KeyRelease:
275 return ET_KEY_RELEASED; 280 return ET_KEY_RELEASED;
276 case ButtonPress: 281 case ButtonPress:
277 if (static_cast<int>(native_event->xbutton.button) >= kMinWheelButton && 282 if (static_cast<int>(native_event->xbutton.button) >= kMinWheelButton &&
278 static_cast<int>(native_event->xbutton.button) <= kMaxWheelButton) 283 static_cast<int>(native_event->xbutton.button) <= kMaxWheelButton)
279 return ET_MOUSEWHEEL; 284 return ET_MOUSEWHEEL;
280 return ET_MOUSE_PRESSED; 285 return ET_MOUSE_PRESSED;
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 DeviceDataManager::GetInstance()->GetGestureTimes( 726 DeviceDataManager::GetInstance()->GetGestureTimes(
722 native_event, start_time, end_time); 727 native_event, start_time, end_time);
723 return true; 728 return true;
724 } 729 }
725 730
726 bool IsTouchpadEvent(const base::NativeEvent& event) { 731 bool IsTouchpadEvent(const base::NativeEvent& event) {
727 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); 732 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event);
728 } 733 }
729 734
730 } // namespace ui 735 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698