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

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

Issue 536313002: Revert of Removing X11 native_event uses for key events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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)
66 // From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp: 67 // From third_party/WebKit/Source/web/gtk/WebInputEventFactory.cpp:
67 base::char16 GetControlCharacterForKeycode(int windows_key_code, bool shift) { 68 uint16 GetControlCharacterForKeycode(int windows_key_code, bool shift) {
68 if (windows_key_code >= ui::VKEY_A && 69 if (windows_key_code >= ui::VKEY_A &&
69 windows_key_code <= ui::VKEY_Z) { 70 windows_key_code <= ui::VKEY_Z) {
70 // ctrl-A ~ ctrl-Z map to \x01 ~ \x1A 71 // ctrl-A ~ ctrl-Z map to \x01 ~ \x1A
71 return windows_key_code - ui::VKEY_A + 1; 72 return windows_key_code - ui::VKEY_A + 1;
72 } 73 }
73 if (shift) { 74 if (shift) {
74 // following graphics chars require shift key to input. 75 // following graphics chars require shift key to input.
75 switch (windows_key_code) { 76 switch (windows_key_code) {
76 // ctrl-@ maps to \x00 (Null byte) 77 // ctrl-@ maps to \x00 (Null byte)
77 case ui::VKEY_2: 78 case ui::VKEY_2:
(...skipping 22 matching lines...) Expand all
100 // ctrl-Enter maps to \x0A (Line feed) 101 // ctrl-Enter maps to \x0A (Line feed)
101 case ui::VKEY_RETURN: 102 case ui::VKEY_RETURN:
102 return 0x0A; 103 return 0x0A;
103 // Returns 0 for all other keys to avoid inputting unexpected chars. 104 // Returns 0 for all other keys to avoid inputting unexpected chars.
104 default: 105 default:
105 break; 106 break;
106 } 107 }
107 } 108 }
108 return 0; 109 return 0;
109 } 110 }
111 #endif
110 112
111 int RegisterCustomEventType() { 113 int RegisterCustomEventType() {
112 return ++g_custom_event_types; 114 return ++g_custom_event_types;
113 } 115 }
114 116
115 base::TimeDelta EventTimeForNow() { 117 base::TimeDelta EventTimeForNow() {
116 return base::TimeDelta::FromInternalValue( 118 return base::TimeDelta::FromInternalValue(
117 base::TimeTicks::Now().ToInternalValue()); 119 base::TimeTicks::Now().ToInternalValue());
118 } 120 }
119 121
(...skipping 10 matching lines...) Expand all
130 const std::vector<gfx::Display>& displays = screen->GetAllDisplays(); 132 const std::vector<gfx::Display>& displays = screen->GetAllDisplays();
131 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); 133 for (std::vector<gfx::Display>::const_iterator it = displays.begin();
132 it != displays.end(); ++it) { 134 it != displays.end(); ++it) {
133 if (it->IsInternal()) 135 if (it->IsInternal())
134 return it->touch_support(); 136 return it->touch_support();
135 } 137 }
136 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE; 138 return gfx::Display::TOUCH_SUPPORT_UNAVAILABLE;
137 } 139 }
138 140
139 } // namespace ui 141 } // 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