1 #[derive(Debug, Clone, Copy)] 2 pub struct MapEntry { 3 pub linux_keycode: u16, 4 pub xkb: u32, 5 pub win: u32, 6 pub mac: u32, 7 } 8 9 // Based on Chromium's chromium/chromium/ui/events/keycodes/dom/keycode_converter_data.inc. 10 pub const KEYCODE_MAP: [MapEntry; 88] = [ 11 MapEntry { 12 linux_keycode: 30, 13 xkb: 0x0026, 14 win: 0x001e, 15 mac: 0x0000, 16 }, 17 MapEntry { 18 linux_keycode: 48, 19 xkb: 0x0038, 20 win: 0x0030, 21 mac: 0x000b, 22 }, 23 MapEntry { 24 linux_keycode: 46, 25 xkb: 0x0036, 26 win: 0x002e, 27 mac: 0x0008, 28 }, 29 MapEntry { 30 linux_keycode: 32, 31 xkb: 0x0028, 32 win: 0x0020, 33 mac: 0x0002, 34 }, 35 MapEntry { 36 linux_keycode: 18, 37 xkb: 0x001a, 38 win: 0x0012, 39 mac: 0x000e, 40 }, 41 MapEntry { 42 linux_keycode: 33, 43 xkb: 0x0029, 44 win: 0x0021, 45 mac: 0x0003, 46 }, 47 MapEntry { 48 linux_keycode: 34, 49 xkb: 0x002a, 50 win: 0x0022, 51 mac: 0x0005, 52 }, 53 MapEntry { 54 linux_keycode: 35, 55 xkb: 0x002b, 56 win: 0x0023, 57 mac: 0x0004, 58 }, 59 MapEntry { 60 linux_keycode: 23, 61 xkb: 0x001f, 62 win: 0x0017, 63 mac: 0x0022, 64 }, 65 MapEntry { 66 linux_keycode: 36, 67 xkb: 0x002c, 68 win: 0x0024, 69 mac: 0x0026, 70 }, 71 MapEntry { 72 linux_keycode: 37, 73 xkb: 0x002d, 74 win: 0x0025, 75 mac: 0x0028, 76 }, 77 MapEntry { 78 linux_keycode: 38, 79 xkb: 0x002e, 80 win: 0x0026, 81 mac: 0x0025, 82 }, 83 MapEntry { 84 linux_keycode: 50, 85 xkb: 0x003a, 86 win: 0x0032, 87 mac: 0x002e, 88 }, 89 MapEntry { 90 linux_keycode: 49, 91 xkb: 0x0039, 92 win: 0x0031, 93 mac: 0x002d, 94 }, 95 MapEntry { 96 linux_keycode: 24, 97 xkb: 0x0020, 98 win: 0x0018, 99 mac: 0x001f, 100 }, 101 MapEntry { 102 linux_keycode: 25, 103 xkb: 0x0021, 104 win: 0x0019, 105 mac: 0x0023, 106 }, 107 MapEntry { 108 linux_keycode: 16, 109 xkb: 0x0018, 110 win: 0x0010, 111 mac: 0x000c, 112 }, 113 MapEntry { 114 linux_keycode: 19, 115 xkb: 0x001b, 116 win: 0x0013, 117 mac: 0x000f, 118 }, 119 MapEntry { 120 linux_keycode: 31, 121 xkb: 0x0027, 122 win: 0x001f, 123 mac: 0x0001, 124 }, 125 MapEntry { 126 linux_keycode: 20, 127 xkb: 0x001c, 128 win: 0x0014, 129 mac: 0x0011, 130 }, 131 MapEntry { 132 linux_keycode: 22, 133 xkb: 0x001e, 134 win: 0x0016, 135 mac: 0x0020, 136 }, 137 MapEntry { 138 linux_keycode: 47, 139 xkb: 0x0037, 140 win: 0x002f, 141 mac: 0x0009, 142 }, 143 MapEntry { 144 linux_keycode: 17, 145 xkb: 0x0019, 146 win: 0x0011, 147 mac: 0x000d, 148 }, 149 MapEntry { 150 linux_keycode: 45, 151 xkb: 0x0035, 152 win: 0x002d, 153 mac: 0x0007, 154 }, 155 MapEntry { 156 linux_keycode: 21, 157 xkb: 0x001d, 158 win: 0x0015, 159 mac: 0x0010, 160 }, 161 MapEntry { 162 linux_keycode: 44, 163 xkb: 0x0034, 164 win: 0x002c, 165 mac: 0x0006, 166 }, 167 MapEntry { 168 linux_keycode: 2, 169 xkb: 0x000a, 170 win: 0x0002, 171 mac: 0x0012, 172 }, 173 MapEntry { 174 linux_keycode: 3, 175 xkb: 0x000b, 176 win: 0x0003, 177 mac: 0x0013, 178 }, 179 MapEntry { 180 linux_keycode: 4, 181 xkb: 0x000c, 182 win: 0x0004, 183 mac: 0x0014, 184 }, 185 MapEntry { 186 linux_keycode: 5, 187 xkb: 0x000d, 188 win: 0x0005, 189 mac: 0x0015, 190 }, 191 MapEntry { 192 linux_keycode: 6, 193 xkb: 0x000e, 194 win: 0x0006, 195 mac: 0x0017, 196 }, 197 MapEntry { 198 linux_keycode: 7, 199 xkb: 0x000f, 200 win: 0x0007, 201 mac: 0x0016, 202 }, 203 MapEntry { 204 linux_keycode: 8, 205 xkb: 0x0010, 206 win: 0x0008, 207 mac: 0x001a, 208 }, 209 MapEntry { 210 linux_keycode: 9, 211 xkb: 0x0011, 212 win: 0x0009, 213 mac: 0x001c, 214 }, 215 MapEntry { 216 linux_keycode: 10, 217 xkb: 0x0012, 218 win: 0x000a, 219 mac: 0x0019, 220 }, 221 MapEntry { 222 linux_keycode: 11, 223 xkb: 0x0013, 224 win: 0x000b, 225 mac: 0x001d, 226 }, 227 MapEntry { 228 linux_keycode: 28, 229 xkb: 0x0024, 230 win: 0x001c, 231 mac: 0x0024, 232 }, 233 MapEntry { 234 linux_keycode: 1, 235 xkb: 0x0009, 236 win: 0x0001, 237 mac: 0x0035, 238 }, 239 MapEntry { 240 linux_keycode: 14, 241 xkb: 0x0016, 242 win: 0x000e, 243 mac: 0x0033, 244 }, 245 MapEntry { 246 linux_keycode: 15, 247 xkb: 0x0017, 248 win: 0x000f, 249 mac: 0x0030, 250 }, 251 MapEntry { 252 linux_keycode: 57, 253 xkb: 0x0041, 254 win: 0x0039, 255 mac: 0x0031, 256 }, 257 MapEntry { 258 linux_keycode: 12, 259 xkb: 0x0014, 260 win: 0x000c, 261 mac: 0x001b, 262 }, 263 MapEntry { 264 linux_keycode: 13, 265 xkb: 0x0015, 266 win: 0x000d, 267 mac: 0x0018, 268 }, 269 MapEntry { 270 linux_keycode: 26, 271 xkb: 0x0022, 272 win: 0x001a, 273 mac: 0x0021, 274 }, 275 MapEntry { 276 linux_keycode: 27, 277 xkb: 0x0023, 278 win: 0x001b, 279 mac: 0x001e, 280 }, 281 MapEntry { 282 linux_keycode: 43, 283 xkb: 0x0033, 284 win: 0x002b, 285 mac: 0x002a, 286 }, 287 MapEntry { 288 linux_keycode: 39, 289 xkb: 0x002f, 290 win: 0x0027, 291 mac: 0x0029, 292 }, 293 MapEntry { 294 linux_keycode: 40, 295 xkb: 0x0030, 296 win: 0x0028, 297 mac: 0x0027, 298 }, 299 MapEntry { 300 linux_keycode: 399, 301 xkb: 0x0031, 302 win: 0x0029, 303 mac: 0x0032, 304 }, 305 MapEntry { 306 linux_keycode: 51, 307 xkb: 0x003b, 308 win: 0x0033, 309 mac: 0x002b, 310 }, 311 MapEntry { 312 linux_keycode: 52, 313 xkb: 0x003c, 314 win: 0x0034, 315 mac: 0x002f, 316 }, 317 MapEntry { 318 linux_keycode: 53, 319 xkb: 0x003d, 320 win: 0x0035, 321 mac: 0x002c, 322 }, 323 MapEntry { 324 linux_keycode: 58, 325 xkb: 0x0042, 326 win: 0x003a, 327 mac: 0x0039, 328 }, 329 MapEntry { 330 linux_keycode: 119, 331 xkb: 0x007f, 332 win: 0x0045, 333 mac: 0xffff, 334 }, 335 MapEntry { 336 linux_keycode: 110, 337 xkb: 0x0076, 338 win: 0xe052, 339 mac: 0x0072, 340 }, 341 MapEntry { 342 linux_keycode: 102, 343 xkb: 0x006e, 344 win: 0xe047, 345 mac: 0x0073, 346 }, 347 MapEntry { 348 linux_keycode: 104, 349 xkb: 0x0070, 350 win: 0xe049, 351 mac: 0x0074, 352 }, 353 MapEntry { 354 linux_keycode: 111, 355 xkb: 0x0077, 356 win: 0xe053, 357 mac: 0x0075, 358 }, 359 MapEntry { 360 linux_keycode: 107, 361 xkb: 0x0073, 362 win: 0xe04f, 363 mac: 0x0077, 364 }, 365 MapEntry { 366 linux_keycode: 109, 367 xkb: 0x0075, 368 win: 0xe051, 369 mac: 0x0079, 370 }, 371 MapEntry { 372 linux_keycode: 106, 373 xkb: 0x0072, 374 win: 0xe04d, 375 mac: 0x007c, 376 }, 377 MapEntry { 378 linux_keycode: 105, 379 xkb: 0x0071, 380 win: 0xe04b, 381 mac: 0x007b, 382 }, 383 MapEntry { 384 linux_keycode: 108, 385 xkb: 0x0074, 386 win: 0xe050, 387 mac: 0x007d, 388 }, 389 MapEntry { 390 linux_keycode: 103, 391 xkb: 0x006f, 392 win: 0xe048, 393 mac: 0x007e, 394 }, 395 MapEntry { 396 linux_keycode: 69, 397 xkb: 0x004d, 398 win: 0xe045, 399 mac: 0x0047, 400 }, 401 MapEntry { 402 linux_keycode: 98, 403 xkb: 0x006a, 404 win: 0xe035, 405 mac: 0x004b, 406 }, 407 MapEntry { 408 linux_keycode: 78, 409 xkb: 0x0056, 410 win: 0x004e, 411 mac: 0x0045, 412 }, 413 MapEntry { 414 linux_keycode: 28, 415 xkb: 0x0068, 416 win: 0xe01c, 417 mac: 0x004c, 418 }, 419 MapEntry { 420 linux_keycode: 79, 421 xkb: 0x0057, 422 win: 0x004f, 423 mac: 0x0053, 424 }, 425 MapEntry { 426 linux_keycode: 80, 427 xkb: 0x0058, 428 win: 0x0050, 429 mac: 0x0054, 430 }, 431 MapEntry { 432 linux_keycode: 81, 433 xkb: 0x0059, 434 win: 0x0051, 435 mac: 0x0055, 436 }, 437 MapEntry { 438 linux_keycode: 75, 439 xkb: 0x0053, 440 win: 0x004b, 441 mac: 0x0056, 442 }, 443 MapEntry { 444 linux_keycode: 76, 445 xkb: 0x0054, 446 win: 0x004c, 447 mac: 0x0057, 448 }, 449 MapEntry { 450 linux_keycode: 77, 451 xkb: 0x0055, 452 win: 0x004d, 453 mac: 0x0058, 454 }, 455 MapEntry { 456 linux_keycode: 71, 457 xkb: 0x004f, 458 win: 0x0047, 459 mac: 0x0059, 460 }, 461 MapEntry { 462 linux_keycode: 72, 463 xkb: 0x0050, 464 win: 0x0048, 465 mac: 0x005b, 466 }, 467 MapEntry { 468 linux_keycode: 73, 469 xkb: 0x0051, 470 win: 0x0049, 471 mac: 0x005c, 472 }, 473 MapEntry { 474 linux_keycode: 82, 475 xkb: 0x005a, 476 win: 0x0052, 477 mac: 0x0052, 478 }, 479 MapEntry { 480 linux_keycode: 116, 481 xkb: 0x007c, 482 win: 0xe05e, 483 mac: 0xffff, 484 }, 485 MapEntry { 486 linux_keycode: 121, 487 xkb: 0x0081, 488 win: 0x007e, 489 mac: 0x005f, 490 }, 491 MapEntry { 492 linux_keycode: 29, 493 xkb: 0x0025, 494 win: 0x001d, 495 mac: 0x003b, 496 }, 497 MapEntry { 498 linux_keycode: 42, 499 xkb: 0x0032, 500 win: 0x002a, 501 mac: 0x0038, 502 }, 503 MapEntry { 504 linux_keycode: 56, 505 xkb: 0x0040, 506 win: 0x0038, 507 mac: 0x003a, 508 }, 509 MapEntry { 510 linux_keycode: 125, 511 xkb: 0x0085, 512 win: 0xe05b, 513 mac: 0x0037, 514 }, 515 MapEntry { 516 linux_keycode: 97, 517 xkb: 0x0069, 518 win: 0xe01d, 519 mac: 0x003e, 520 }, 521 MapEntry { 522 linux_keycode: 54, 523 xkb: 0x003e, 524 win: 0x0036, 525 mac: 0x003c, 526 }, 527 MapEntry { 528 linux_keycode: 100, 529 xkb: 0x006c, 530 win: 0xe038, 531 mac: 0x003d, 532 }, 533 MapEntry { 534 linux_keycode: 126, 535 xkb: 0x0086, 536 win: 0xe05c, 537 mac: 0x0036, 538 }, 539 ]; 540