OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/base_event_utils.h" | 5 #include "ui/events/base_event_utils.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "ui/events/event_constants.h" | 13 #include "ui/events/event_constants.h" |
14 #include "ui/events/event_switches.h" | 14 #include "ui/events/event_switches.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
21 const int kSystemKeyModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN; | 21 const int kSystemKeyModifierMask = EF_ALT_DOWN | EF_COMMAND_DOWN; |
| 22 #elif defined(OS_MACOSX) |
| 23 // Alt modifier is used to input extended characters on Mac. |
| 24 const int kSystemKeyModifierMask = EF_COMMAND_DOWN; |
22 #else | 25 #else |
23 const int kSystemKeyModifierMask = EF_ALT_DOWN; | 26 const int kSystemKeyModifierMask = EF_ALT_DOWN; |
24 #endif // defined(OS_CHROMEOS) | 27 #endif // !defined(OS_CHROMEOS) && !defined(OS_MACOSX) |
25 | 28 |
26 } // namespace | 29 } // namespace |
27 | 30 |
28 base::StaticAtomicSequenceNumber g_next_event_id; | 31 base::StaticAtomicSequenceNumber g_next_event_id; |
29 | 32 |
30 uint32_t GetNextTouchEventId() { | 33 uint32_t GetNextTouchEventId() { |
31 // Set the first touch event ID to 1 because we set id to 0 for other types | 34 // Set the first touch event ID to 1 because we set id to 0 for other types |
32 // of events. | 35 // of events. |
33 uint32_t id = g_next_event_id.GetNext(); | 36 uint32_t id = g_next_event_id.GetNext(); |
34 if (id == 0) | 37 if (id == 0) |
(...skipping 24 matching lines...) Expand all Loading... |
59 double EventTimeStampToSeconds(base::TimeTicks time_stamp) { | 62 double EventTimeStampToSeconds(base::TimeTicks time_stamp) { |
60 return (time_stamp - base::TimeTicks()).InSecondsF(); | 63 return (time_stamp - base::TimeTicks()).InSecondsF(); |
61 } | 64 } |
62 | 65 |
63 base::TimeTicks EventTimeStampFromSeconds(double time_stamp_seconds) { | 66 base::TimeTicks EventTimeStampFromSeconds(double time_stamp_seconds) { |
64 return base::TimeTicks() + base::TimeDelta::FromSecondsD(time_stamp_seconds); | 67 return base::TimeTicks() + base::TimeDelta::FromSecondsD(time_stamp_seconds); |
65 } | 68 } |
66 | 69 |
67 } // namespace ui | 70 } // namespace ui |
68 | 71 |
OLD | NEW |