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_utils.h" | 5 #include "ui/events/event_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 case ET_TOUCH_CANCELLED: | 56 case ET_TOUCH_CANCELLED: |
57 event.reset(new TouchEvent(native_event)); | 57 event.reset(new TouchEvent(native_event)); |
58 break; | 58 break; |
59 | 59 |
60 default: | 60 default: |
61 break; | 61 break; |
62 } | 62 } |
63 return event.Pass(); | 63 return event.Pass(); |
64 } | 64 } |
65 | 65 |
66 #if defined(OS_LINUX) | |
67 // From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp: | 66 // From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp: |
68 uint16 GetControlCharacterForKeycode(int windows_key_code, bool shift) { | 67 base::char16 GetControlCharacterForKeycode(int windows_key_code, bool shift) { |
69 if (windows_key_code >= ui::VKEY_A && | 68 if (windows_key_code >= ui::VKEY_A && |
70 windows_key_code <= ui::VKEY_Z) { | 69 windows_key_code <= ui::VKEY_Z) { |
71 // ctrl-A ~ ctrl-Z map to \x01 ~ \x1A | 70 // ctrl-A ~ ctrl-Z map to \x01 ~ \x1A |
72 return windows_key_code - ui::VKEY_A + 1; | 71 return windows_key_code - ui::VKEY_A + 1; |
73 } | 72 } |
74 if (shift) { | 73 if (shift) { |
75 // following graphics chars require shift key to input. | 74 // following graphics chars require shift key to input. |
76 switch (windows_key_code) { | 75 switch (windows_key_code) { |
77 // ctrl-@ maps to \x00 (Null byte) | 76 // ctrl-@ maps to \x00 (Null byte) |
78 case ui::VKEY_2: | 77 case ui::VKEY_2: |
(...skipping 22 matching lines...) Expand all Loading... |
101 // ctrl-Enter maps to \x0A (Line feed) | 100 // ctrl-Enter maps to \x0A (Line feed) |
102 case ui::VKEY_RETURN: | 101 case ui::VKEY_RETURN: |
103 return 0x0A; | 102 return 0x0A; |
104 // Returns 0 for all other keys to avoid inputting unexpected chars. | 103 // Returns 0 for all other keys to avoid inputting unexpected chars. |
105 default: | 104 default: |
106 break; | 105 break; |
107 } | 106 } |
108 } | 107 } |
109 return 0; | 108 return 0; |
110 } | 109 } |
111 #endif | |
112 | 110 |
113 int RegisterCustomEventType() { | 111 int RegisterCustomEventType() { |
114 return ++g_custom_event_types; | 112 return ++g_custom_event_types; |
115 } | 113 } |
116 | 114 |
117 base::TimeDelta EventTimeForNow() { | 115 base::TimeDelta EventTimeForNow() { |
118 return base::TimeDelta::FromInternalValue( | 116 return base::TimeDelta::FromInternalValue( |
119 base::TimeTicks::Now().ToInternalValue()); | 117 base::TimeTicks::Now().ToInternalValue()); |
120 } | 118 } |
121 | 119 |
(...skipping 10 matching lines...) Expand all Loading... |
132 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); | 130 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); |
133 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); | 131 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); |
134 it != displays.end(); ++it) { | 132 it != displays.end(); ++it) { |
135 if (it->IsInternal()) | 133 if (it->IsInternal()) |
136 return it->touch_support(); | 134 return it->touch_support(); |
137 } | 135 } |
138 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE; | 136 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE; |
139 } | 137 } |
140 | 138 |
141 } // namespace ui | 139 } // namespace ui |
OLD | NEW |