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

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

Issue 398203004: Build fix on Linux 64 bits with GCC 4.8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 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/keycodes/keyboard_code_conversion_x.h" 5 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #define XK_3270 // for XK_3270_BackTab 9 #define XK_3270 // for XK_3270_BackTab
10 #include <X11/XF86keysym.h> 10 #include <X11/XF86keysym.h>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // e.g. in UK keyboard, the key between Quote and Enter keys has the VKEY code 48 // e.g. in UK keyboard, the key between Quote and Enter keys has the VKEY code
49 // VKEY_OEM_5 instead of VKEY_3. 49 // VKEY_OEM_5 instead of VKEY_3.
50 // 50 //
51 // The key symbols which are not [a-zA-Z0-9] and functional/extend keys (e.g. 51 // The key symbols which are not [a-zA-Z0-9] and functional/extend keys (e.g.
52 // TAB, ENTER, BS, Arrow keys, modifier keys, F1-F12, media/app keys, etc.) 52 // TAB, ENTER, BS, Arrow keys, modifier keys, F1-F12, media/app keys, etc.)
53 // should go through these maps for correct VKEY codes. 53 // should go through these maps for correct VKEY codes.
54 // 54 //
55 // Please refer to crbug.com/386066. 55 // Please refer to crbug.com/386066.
56 // 56 //
57 const struct MAP0 { 57 const struct MAP0 {
58 uint16 ch0; 58 KeySym ch0;
59 uint8 vk; 59 uint8 vk;
60 bool operator()(const MAP0& m1, const MAP0& m2) const { 60 bool operator()(const MAP0& m1, const MAP0& m2) const {
61 return m1.ch0 < m2.ch0; 61 return m1.ch0 < m2.ch0;
62 } 62 }
63 } map0[] = { 63 } map0[] = {
64 {0x0025, 0x35}, // XK_percent: VKEY_5 64 {0x0025, 0x35}, // XK_percent: VKEY_5
65 {0x0026, 0x31}, // XK_ampersand: VKEY_1 65 {0x0026, 0x31}, // XK_ampersand: VKEY_1
66 {0x003C, 0xDC}, // XK_less: VKEY_OEM_5 66 {0x003C, 0xDC}, // XK_less: VKEY_OEM_5
67 {0x007B, 0xDE}, // XK_braceleft: VKEY_OEM_7 67 {0x007B, 0xDE}, // XK_braceleft: VKEY_OEM_7
68 {0x007C, 0xDC}, // XK_bar: VKEY_OEM_5 68 {0x007C, 0xDC}, // XK_bar: VKEY_OEM_5
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 {0x02F5, 0xDB}, // XK_gabovedot: VKEY_OEM_4 108 {0x02F5, 0xDB}, // XK_gabovedot: VKEY_OEM_4
109 {0x03B6, 0xBF}, // XK_lcedilla: VKEY_OEM_2 109 {0x03B6, 0xBF}, // XK_lcedilla: VKEY_OEM_2
110 {0x03BA, 0x57}, // XK_emacron: VKEY_W 110 {0x03BA, 0x57}, // XK_emacron: VKEY_W
111 {0x03E0, 0xDF}, // XK_amacron: VKEY_OEM_8 111 {0x03E0, 0xDF}, // XK_amacron: VKEY_OEM_8
112 {0x03EF, 0xDD}, // XK_imacron: VKEY_OEM_6 112 {0x03EF, 0xDD}, // XK_imacron: VKEY_OEM_6
113 {0x03F1, 0xDB}, // XK_ncedilla: VKEY_OEM_4 113 {0x03F1, 0xDB}, // XK_ncedilla: VKEY_OEM_4
114 {0x03F3, 0xDC}, // XK_kcedilla: VKEY_OEM_5 114 {0x03F3, 0xDC}, // XK_kcedilla: VKEY_OEM_5
115 }; 115 };
116 116
117 const struct MAP1 { 117 const struct MAP1 {
118 uint16 ch0; 118 KeySym ch0;
119 uint8 sc; 119 unsigned sc;
120 uint8 vk; 120 uint8 vk;
121 bool operator()(const MAP1& m1, const MAP1& m2) const { 121 bool operator()(const MAP1& m1, const MAP1& m2) const {
122 if (m1.ch0 == m2.ch0) 122 if (m1.ch0 == m2.ch0)
123 return m1.sc < m2.sc; 123 return m1.sc < m2.sc;
124 return m1.ch0 < m2.ch0; 124 return m1.ch0 < m2.ch0;
125 } 125 }
126 } map1[] = { 126 } map1[] = {
127 {0x0021, 0x0A, 0x31}, // XK_exclam+AE01: VKEY_1 127 {0x0021, 0x0A, 0x31}, // XK_exclam+AE01: VKEY_1
128 {0x0021, 0x11, 0x38}, // XK_exclam+AE08: VKEY_8 128 {0x0021, 0x11, 0x38}, // XK_exclam+AE08: VKEY_8
129 {0x0021, 0x3D, 0xDF}, // XK_exclam+AB10: VKEY_OEM_8 129 {0x0021, 0x3D, 0xDF}, // XK_exclam+AB10: VKEY_OEM_8
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 {0x03E7, 0x0E, 0x35}, // XK_iogonek+AE05: VKEY_5 293 {0x03E7, 0x0E, 0x35}, // XK_iogonek+AE05: VKEY_5
294 {0x03EC, 0x0D, 0x34}, // XK_eabovedot+AE04: VKEY_4 294 {0x03EC, 0x0D, 0x34}, // XK_eabovedot+AE04: VKEY_4
295 {0x03EC, 0x30, 0xDE}, // XK_eabovedot+AC11: VKEY_OEM_7 295 {0x03EC, 0x30, 0xDE}, // XK_eabovedot+AC11: VKEY_OEM_7
296 {0x03F9, 0x10, 0x37}, // XK_uogonek+AE07: VKEY_7 296 {0x03F9, 0x10, 0x37}, // XK_uogonek+AE07: VKEY_7
297 {0x03FE, 0x11, 0x38}, // XK_umacron+AE08: VKEY_8 297 {0x03FE, 0x11, 0x38}, // XK_umacron+AE08: VKEY_8
298 {0x03FE, 0x18, 0x51}, // XK_umacron+AD01: VKEY_Q 298 {0x03FE, 0x18, 0x51}, // XK_umacron+AD01: VKEY_Q
299 {0x03FE, 0x35, 0x58}, // XK_umacron+AB02: VKEY_X 299 {0x03FE, 0x35, 0x58}, // XK_umacron+AB02: VKEY_X
300 }; 300 };
301 301
302 const struct MAP2 { 302 const struct MAP2 {
303 uint16 ch0; 303 KeySym ch0;
304 uint8 sc; 304 unsigned sc;
305 uint16 ch1; 305 KeySym ch1;
306 uint8 vk; 306 uint8 vk;
307 bool operator()(const MAP2& m1, const MAP2& m2) const { 307 bool operator()(const MAP2& m1, const MAP2& m2) const {
308 if (m1.ch0 == m2.ch0 && m1.sc == m2.sc) 308 if (m1.ch0 == m2.ch0 && m1.sc == m2.sc)
309 return m1.ch1 < m2.ch1; 309 return m1.ch1 < m2.ch1;
310 if (m1.ch0 == m2.ch0) 310 if (m1.ch0 == m2.ch0)
311 return m1.sc < m2.sc; 311 return m1.sc < m2.sc;
312 return m1.ch0 < m2.ch0; 312 return m1.ch0 < m2.ch0;
313 } 313 }
314 } map2[] = { 314 } map2[] = {
315 {0x0023, 0x33, 0x0027, 315 {0x0023, 0x33, 0x0027,
(...skipping 21 matching lines...) Expand all
337 {0x00E0, 0x30, 0x00B0, 0xDE}, // XK_agrave+AC11+XK_degree: VKEY_OEM_7 337 {0x00E0, 0x30, 0x00B0, 0xDE}, // XK_agrave+AC11+XK_degree: VKEY_OEM_7
338 {0x00E0, 0x30, 0x00E4, 0xDC}, // XK_agrave+AC11+XK_adiaeresis: VKEY_OEM_5 338 {0x00E0, 0x30, 0x00E4, 0xDC}, // XK_agrave+AC11+XK_adiaeresis: VKEY_OEM_5
339 {0x00E4, 0x30, 0x00E0, 0xDC}, // XK_adiaeresis+AC11+XK_agrave: VKEY_OEM_5 339 {0x00E4, 0x30, 0x00E0, 0xDC}, // XK_adiaeresis+AC11+XK_agrave: VKEY_OEM_5
340 {0x00E9, 0x2F, 0x00C9, 0xBA}, // XK_eacute+AC10+XK_Eacute: VKEY_OEM_1 340 {0x00E9, 0x2F, 0x00C9, 0xBA}, // XK_eacute+AC10+XK_Eacute: VKEY_OEM_1
341 {0x00E9, 0x2F, 0x00F6, 0xDE}, // XK_eacute+AC10+XK_odiaeresis: VKEY_OEM_7 341 {0x00E9, 0x2F, 0x00F6, 0xDE}, // XK_eacute+AC10+XK_odiaeresis: VKEY_OEM_7
342 {0x00F6, 0x2F, 0x00E9, 0xDE}, // XK_odiaeresis+AC10+XK_eacute: VKEY_OEM_7 342 {0x00F6, 0x2F, 0x00E9, 0xDE}, // XK_odiaeresis+AC10+XK_eacute: VKEY_OEM_7
343 {0x00FC, 0x22, 0x00E8, 0xBA}, // XK_udiaeresis+AD11+XK_egrave: VKEY_OEM_1 343 {0x00FC, 0x22, 0x00E8, 0xBA}, // XK_udiaeresis+AD11+XK_egrave: VKEY_OEM_1
344 }; 344 };
345 345
346 const struct MAP3 { 346 const struct MAP3 {
347 uint16 ch0; 347 KeySym ch0;
348 uint8 sc; 348 unsigned sc;
349 uint16 ch1; 349 KeySym ch1;
350 uint16 ch2; 350 KeySym ch2;
351 uint8 vk; 351 uint8 vk;
352 bool operator()(const MAP3& m1, const MAP3& m2) const { 352 bool operator()(const MAP3& m1, const MAP3& m2) const {
353 if (m1.ch0 == m2.ch0 && m1.sc == m2.sc && m1.ch1 == m2.ch1) 353 if (m1.ch0 == m2.ch0 && m1.sc == m2.sc && m1.ch1 == m2.ch1)
354 return m1.ch2 < m2.ch2; 354 return m1.ch2 < m2.ch2;
355 if (m1.ch0 == m2.ch0 && m1.sc == m2.sc) 355 if (m1.ch0 == m2.ch0 && m1.sc == m2.sc)
356 return m1.ch1 < m2.ch1; 356 return m1.ch1 < m2.ch1;
357 if (m1.ch0 == m2.ch0) 357 if (m1.ch0 == m2.ch0)
358 return m1.sc < m2.sc; 358 return m1.sc < m2.sc;
359 return m1.ch0 < m2.ch0; 359 return m1.ch0 < m2.ch0;
360 } 360 }
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND 1347 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND
1348 // (the '<>' key between Shift and Z on 105-key keyboards) which does. 1348 // (the '<>' key between Shift and Z on 105-key keyboards) which does.
1349 // 1349 //
1350 // crbug.com/386066 and crbug.com/390263 are examples of problems 1350 // crbug.com/386066 and crbug.com/390263 are examples of problems
1351 // associated with this. 1351 // associated with this.
1352 // 1352 //
1353 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false)); 1353 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false));
1354 } 1354 }
1355 1355
1356 } // namespace ui 1356 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698