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

Side by Side Diff: ui/events/keycodes/keyboard_code_conversion.cc

Issue 1550953002: Keyboard events with keypad had wrong keycodes on ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/keycodes/keyboard_code_conversion.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/keycodes/keyboard_code_conversion.h" 5 #include "ui/events/keycodes/keyboard_code_conversion.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/events/event_constants.h" 9 #include "ui/events/event_constants.h"
10 #include "ui/events/keycodes/dom/dom_code.h" 10 #include "ui/events/keycodes/dom/dom_code.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 DomCode dom_code) { 191 DomCode dom_code) {
192 switch (key_code) { 192 switch (key_code) {
193 case VKEY_SHIFT: 193 case VKEY_SHIFT:
194 return IsRightSideDomCode(dom_code) ? VKEY_RSHIFT : VKEY_LSHIFT; 194 return IsRightSideDomCode(dom_code) ? VKEY_RSHIFT : VKEY_LSHIFT;
195 case VKEY_CONTROL: 195 case VKEY_CONTROL:
196 return IsRightSideDomCode(dom_code) ? VKEY_RCONTROL : VKEY_LCONTROL; 196 return IsRightSideDomCode(dom_code) ? VKEY_RCONTROL : VKEY_LCONTROL;
197 case VKEY_MENU: 197 case VKEY_MENU:
198 return IsRightSideDomCode(dom_code) ? VKEY_RMENU : VKEY_LMENU; 198 return IsRightSideDomCode(dom_code) ? VKEY_RMENU : VKEY_LMENU;
199 case VKEY_LWIN: 199 case VKEY_LWIN:
200 return IsRightSideDomCode(dom_code) ? VKEY_RWIN : VKEY_LWIN; 200 return IsRightSideDomCode(dom_code) ? VKEY_RWIN : VKEY_LWIN;
201 default:
202 return NonLocatedToLocatedKeypadKeyboardCode(key_code, dom_code);
203 }
204 }
205
206 KeyboardCode NonLocatedToLocatedKeypadKeyboardCode(KeyboardCode key_code,
207 DomCode dom_code) {
208 switch (key_code) {
201 case VKEY_0: 209 case VKEY_0:
202 return (dom_code == DomCode::NUMPAD0) ? VKEY_NUMPAD0 : VKEY_0; 210 return (dom_code == DomCode::NUMPAD0) ? VKEY_NUMPAD0 : VKEY_0;
203 case VKEY_1: 211 case VKEY_1:
204 return (dom_code == DomCode::NUMPAD1) ? VKEY_NUMPAD1 : VKEY_1; 212 return (dom_code == DomCode::NUMPAD1) ? VKEY_NUMPAD1 : VKEY_1;
205 case VKEY_2: 213 case VKEY_2:
206 return (dom_code == DomCode::NUMPAD2) ? VKEY_NUMPAD2 : VKEY_2; 214 return (dom_code == DomCode::NUMPAD2) ? VKEY_NUMPAD2 : VKEY_2;
207 case VKEY_3: 215 case VKEY_3:
208 return (dom_code == DomCode::NUMPAD3) ? VKEY_NUMPAD3 : VKEY_3; 216 return (dom_code == DomCode::NUMPAD3) ? VKEY_NUMPAD3 : VKEY_3;
209 case VKEY_4: 217 case VKEY_4:
210 return (dom_code == DomCode::NUMPAD4) ? VKEY_NUMPAD4 : VKEY_4; 218 return (dom_code == DomCode::NUMPAD4) ? VKEY_NUMPAD4 : VKEY_4;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 257
250 return VKEY_UNKNOWN; 258 return VKEY_UNKNOWN;
251 } 259 }
252 260
253 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) { 261 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) {
254 return LocatedToNonLocatedKeyboardCode( 262 return LocatedToNonLocatedKeyboardCode(
255 DomCodeToUsLayoutKeyboardCode(dom_code)); 263 DomCodeToUsLayoutKeyboardCode(dom_code));
256 } 264 }
257 265
258 } // namespace ui 266 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/keycodes/keyboard_code_conversion.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698