| OLD | NEW |
| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 namespace ui { | 264 namespace ui { |
| 265 | 265 |
| 266 void UpdateDeviceList() { | 266 void UpdateDeviceList() { |
| 267 XDisplay* display = gfx::GetXDisplay(); | 267 XDisplay* display = gfx::GetXDisplay(); |
| 268 DeviceListCacheX::GetInstance()->UpdateDeviceList(display); | 268 DeviceListCacheX::GetInstance()->UpdateDeviceList(display); |
| 269 TouchFactory::GetInstance()->UpdateDeviceList(display); | 269 TouchFactory::GetInstance()->UpdateDeviceList(display); |
| 270 DeviceDataManagerX11::GetInstance()->UpdateDeviceList(display); | 270 DeviceDataManagerX11::GetInstance()->UpdateDeviceList(display); |
| 271 } | 271 } |
| 272 | 272 |
| 273 EventType EventTypeFromNative(const base::NativeEvent& native_event) { | 273 EventType EventTypeFromNative(const base::NativeEvent& native_event) { |
| 274 // Allow the DeviceDataManager to block the event. If blocked return |
| 275 // ET_UNKNOWN as the type so this event will not be further processed. |
| 276 // NOTE: During some events unittests there is no device data manager. |
| 277 if (DeviceDataManager::HasInstance() && |
| 278 static_cast<DeviceDataManagerX11*>(DeviceDataManager::GetInstance())-> |
| 279 IsEventBlocked(native_event)) { |
| 280 return ET_UNKNOWN; |
| 281 } |
| 282 |
| 274 switch (native_event->type) { | 283 switch (native_event->type) { |
| 275 case KeyPress: | 284 case KeyPress: |
| 276 return ET_KEY_PRESSED; | 285 return ET_KEY_PRESSED; |
| 277 case KeyRelease: | 286 case KeyRelease: |
| 278 return ET_KEY_RELEASED; | 287 return ET_KEY_RELEASED; |
| 279 case ButtonPress: | 288 case ButtonPress: |
| 280 if (static_cast<int>(native_event->xbutton.button) >= kMinWheelButton && | 289 if (static_cast<int>(native_event->xbutton.button) >= kMinWheelButton && |
| 281 static_cast<int>(native_event->xbutton.button) <= kMaxWheelButton) | 290 static_cast<int>(native_event->xbutton.button) <= kMaxWheelButton) |
| 282 return ET_MOUSEWHEEL; | 291 return ET_MOUSEWHEEL; |
| 283 return ET_MOUSE_PRESSED; | 292 return ET_MOUSE_PRESSED; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 DeviceDataManagerX11::GetInstance()->GetGestureTimes( | 741 DeviceDataManagerX11::GetInstance()->GetGestureTimes( |
| 733 native_event, start_time, end_time); | 742 native_event, start_time, end_time); |
| 734 return true; | 743 return true; |
| 735 } | 744 } |
| 736 | 745 |
| 737 bool IsTouchpadEvent(const base::NativeEvent& event) { | 746 bool IsTouchpadEvent(const base::NativeEvent& event) { |
| 738 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); | 747 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); |
| 739 } | 748 } |
| 740 | 749 |
| 741 } // namespace ui | 750 } // namespace ui |
| OLD | NEW |