Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Side by Side Diff: ui/events/event_utils.cc

Issue 479873002: Removing X11 native_event uses for key events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove web_input_event_aurax11.cc from Android license whitelist. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/event_utils.h ('k') | ui/events/ozone/events_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « ui/events/event_utils.h ('k') | ui/events/ozone/events_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698