| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/x/events_x_utils.h" | 5 #include "ui/events/x/events_x_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 370 |
| 371 } // namespace | 371 } // namespace |
| 372 | 372 |
| 373 namespace ui { | 373 namespace ui { |
| 374 | 374 |
| 375 EventType EventTypeFromXEvent(const XEvent& xev) { | 375 EventType EventTypeFromXEvent(const XEvent& xev) { |
| 376 // Allow the DeviceDataManager to block the event. If blocked return | 376 // Allow the DeviceDataManager to block the event. If blocked return |
| 377 // ET_UNKNOWN as the type so this event will not be further processed. | 377 // ET_UNKNOWN as the type so this event will not be further processed. |
| 378 // NOTE: During some events unittests there is no device data manager. | 378 // NOTE: During some events unittests there is no device data manager. |
| 379 if (DeviceDataManager::HasInstance() && | 379 if (DeviceDataManager::HasInstance() && |
| 380 static_cast<DeviceDataManagerX11*>(DeviceDataManager::GetInstance()) | 380 DeviceDataManagerX11::GetInstance()->IsEventBlocked(xev)) { |
| 381 ->IsEventBlocked(xev)) { | |
| 382 return ET_UNKNOWN; | 381 return ET_UNKNOWN; |
| 383 } | 382 } |
| 384 | 383 |
| 385 switch (xev.type) { | 384 switch (xev.type) { |
| 386 case KeyPress: | 385 case KeyPress: |
| 387 return ET_KEY_PRESSED; | 386 return ET_KEY_PRESSED; |
| 388 case KeyRelease: | 387 case KeyRelease: |
| 389 return ET_KEY_RELEASED; | 388 return ET_KEY_RELEASED; |
| 390 case ButtonPress: | 389 case ButtonPress: |
| 391 if (static_cast<int>(xev.xbutton.button) >= kMinWheelButton && | 390 if (static_cast<int>(xev.xbutton.button) >= kMinWheelButton && |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 | 827 |
| 829 void ResetTimestampRolloverCountersForTesting( | 828 void ResetTimestampRolloverCountersForTesting( |
| 830 std::unique_ptr<base::TickClock> tick_clock) { | 829 std::unique_ptr<base::TickClock> tick_clock) { |
| 831 g_last_seen_timestamp_ms = 0; | 830 g_last_seen_timestamp_ms = 0; |
| 832 g_rollover_ms = 0; | 831 g_rollover_ms = 0; |
| 833 g_bogus_x11_timestamps = false; | 832 g_bogus_x11_timestamps = false; |
| 834 g_tick_clock.Get() = std::move(tick_clock); | 833 g_tick_clock.Get() = std::move(tick_clock); |
| 835 } | 834 } |
| 836 | 835 |
| 837 } // namespace ui | 836 } // namespace ui |
| OLD | NEW |