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

Side by Side Diff: ui/events/ozone/layout/stub/stub_keyboard_layout_engine.cc

Issue 786813004: Generate correct KeyboardCode (VKEY). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@x430194-xkb
Patch Set: rebase after crrev.com/308447 Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ozone/layout/stub/stub_keyboard_layout_engine.h" 5 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 int state = (((flags & EF_ALTGR_DOWN) == EF_ALTGR_DOWN) << 1) | 270 int state = (((flags & EF_ALTGR_DOWN) == EF_ALTGR_DOWN) << 1) |
271 ((flags & EF_SHIFT_DOWN) == EF_SHIFT_DOWN); 271 ((flags & EF_SHIFT_DOWN) == EF_SHIFT_DOWN);
272 base::char16 ch = e->character[state]; 272 base::char16 ch = e->character[state];
273 *out_dom_key = (ch & DK) ? DomKey::DEAD : DomKey::CHARACTER; 273 *out_dom_key = (ch & DK) ? DomKey::DEAD : DomKey::CHARACTER;
274 *out_character = ch; 274 *out_character = ch;
275 if ((flags & EF_CAPS_LOCK_DOWN) == EF_CAPS_LOCK_DOWN) { 275 if ((flags & EF_CAPS_LOCK_DOWN) == EF_CAPS_LOCK_DOWN) {
276 ch = (ch & ~DK) | 0x20; 276 ch = (ch & ~DK) | 0x20;
277 if ((ch >= 'a') && (ch <= 'z')) 277 if ((ch >= 'a') && (ch <= 'z'))
278 *out_character = e->character[state ^ 1]; 278 *out_character = e->character[state ^ 1];
279 } 279 }
280 *out_key_code = DomCodeToKeyboardCode(dom_code); 280 *out_key_code = DomCodeToNonLocatedKeyboardCode(dom_code);
281 return true; 281 return true;
282 } 282 }
283 } 283 }
284 } 284 }
285 285
286 for (size_t i = 0; i < arraysize(non_printable_code_map); ++i) { 286 for (size_t i = 0; i < arraysize(non_printable_code_map); ++i) {
287 const NonPrintableCodeEntry* e = &non_printable_code_map[i]; 287 const NonPrintableCodeEntry* e = &non_printable_code_map[i];
288 if (e->dom_code == dom_code) { 288 if (e->dom_code == dom_code) {
289 *out_dom_key = e->dom_key; 289 *out_dom_key = e->dom_key;
290 *out_character = e->character; 290 *out_character = e->character;
291 *out_key_code = NonPrintableDomKeyToKeyboardCode(e->dom_key); 291 *out_key_code = NonPrintableDomKeyToKeyboardCode(e->dom_key);
292 return true; 292 return true;
293 } 293 }
294 } 294 }
295 295
296 return false; 296 return false;
297 } 297 }
298 298
299 } // namespace ui 299 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/layout/layout_util.cc ('k') | ui/events/ozone/layout/xkb/xkb_key_code_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698