| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 467 } |
| 468 case ButtonPress: | 468 case ButtonPress: |
| 469 case ButtonRelease: { | 469 case ButtonRelease: { |
| 470 int flags = GetEventFlagsFromXState(xev.xbutton.state); | 470 int flags = GetEventFlagsFromXState(xev.xbutton.state); |
| 471 const EventType type = EventTypeFromXEvent(xev); | 471 const EventType type = EventTypeFromXEvent(xev); |
| 472 if (type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) | 472 if (type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) |
| 473 flags |= GetEventFlagsForButton(xev.xbutton.button); | 473 flags |= GetEventFlagsForButton(xev.xbutton.button); |
| 474 return flags; | 474 return flags; |
| 475 } | 475 } |
| 476 case EnterNotify: | 476 case EnterNotify: |
| 477 // EnterNotify creates ET_MOUSE_MOVED. Mark as synthesized as this is not |
| 478 // a real mouse move event. |
| 479 return GetEventFlagsFromXState(xev.xcrossing.state) | EF_IS_SYNTHESIZED; |
| 477 case LeaveNotify: | 480 case LeaveNotify: |
| 478 return GetEventFlagsFromXState(xev.xcrossing.state); | 481 return GetEventFlagsFromXState(xev.xcrossing.state); |
| 479 case MotionNotify: | 482 case MotionNotify: |
| 480 return GetEventFlagsFromXState(xev.xmotion.state); | 483 return GetEventFlagsFromXState(xev.xmotion.state); |
| 481 case GenericEvent: { | 484 case GenericEvent: { |
| 482 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev.xcookie.data); | 485 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev.xcookie.data); |
| 483 | 486 |
| 484 switch (xievent->evtype) { | 487 switch (xievent->evtype) { |
| 485 case XI_TouchBegin: | 488 case XI_TouchBegin: |
| 486 case XI_TouchUpdate: | 489 case XI_TouchUpdate: |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 } | 812 } |
| 810 | 813 |
| 811 void ResetTimestampRolloverCountersForTesting( | 814 void ResetTimestampRolloverCountersForTesting( |
| 812 std::unique_ptr<base::TickClock> tick_clock) { | 815 std::unique_ptr<base::TickClock> tick_clock) { |
| 813 g_last_seen_timestamp_ms = 0; | 816 g_last_seen_timestamp_ms = 0; |
| 814 g_rollover_ms = 0; | 817 g_rollover_ms = 0; |
| 815 SetEventTickClockForTesting(std::move(tick_clock)); | 818 SetEventTickClockForTesting(std::move(tick_clock)); |
| 816 } | 819 } |
| 817 | 820 |
| 818 } // namespace ui | 821 } // namespace ui |
| OLD | NEW |