OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_PREDICTION_KEY_SET_H_ |
| 6 #define SERVICES_PREDICTION_KEY_SET_H_ |
| 7 |
| 8 #include "mojo/services/prediction/public/interfaces/prediction.mojom.h" |
| 9 |
| 10 // qwerty keyboard key sets |
| 11 |
| 12 namespace prediction { |
| 13 |
| 14 // NOTE: This struct has been modified from the Android Open |
| 15 // Source Project. Specifically from the following file: |
| 16 // https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/ |
| 17 // android-5.1.1_r8/java/src/com/android/inputmethod/keyboard/Key.java |
| 18 struct Key { |
| 19 int kcode; |
| 20 // Width of the key, not including the gap |
| 21 int kwidth; |
| 22 // Height of the key, not including the gap |
| 23 int kheight; |
| 24 // X coordinate of the key in the keyboard layout |
| 25 int kx; |
| 26 // Y coordinate of the key in the keyboard layout |
| 27 int ky; |
| 28 // Hit bounding box of the key |
| 29 int khit_box_left; |
| 30 int khit_box_top; |
| 31 int khit_box_right; |
| 32 int khit_box_bottom; |
| 33 |
| 34 Key() {} |
| 35 |
| 36 Key(const int code, |
| 37 const int x, |
| 38 const int y, |
| 39 const int width, |
| 40 const int height, |
| 41 const int horizontal_gap, |
| 42 const int vertical_gap) { |
| 43 kheight = height - vertical_gap; |
| 44 kwidth = width - horizontal_gap; |
| 45 kcode = code; |
| 46 kx = x + horizontal_gap / 2; |
| 47 ky = y; |
| 48 khit_box_left = x; |
| 49 khit_box_top = y; |
| 50 khit_box_right = x + width + 1; |
| 51 khit_box_bottom = y + height; |
| 52 } |
| 53 }; |
| 54 |
| 55 namespace keyset { |
| 56 |
| 57 const Key A(97, 43, 58, 29, 58, 4, 9); |
| 58 const Key B(98, 188, 116, 29, 58, 4, 9); |
| 59 const Key C(99, 130, 116, 29, 58, 4, 9); |
| 60 const Key D(100, 101, 58, 29, 58, 4, 9); |
| 61 const Key E(101, 87, 0, 29, 58, 4, 9); |
| 62 const Key F(102, 130, 58, 29, 58, 4, 9); |
| 63 const Key G(103, 159, 58, 29, 58, 4, 9); |
| 64 const Key H(104, 188, 58, 29, 58, 4, 9); |
| 65 const Key I(105, 232, 0, 29, 58, 4, 9); |
| 66 const Key J(106, 217, 58, 29, 58, 4, 9); |
| 67 const Key K(107, 246, 58, 29, 58, 4, 9); |
| 68 const Key L(108, 275, 58, 29, 58, 4, 9); |
| 69 const Key M(109, 246, 116, 29, 58, 4, 9); |
| 70 const Key N(110, 217, 116, 29, 58, 4, 9); |
| 71 const Key O(111, 261, 0, 29, 58, 4, 9); |
| 72 const Key P(112, 290, 0, 29, 58, 4, 9); |
| 73 const Key Q(113, 29, 0, 29, 58, 4, 9); |
| 74 const Key R(114, 116, 0, 29, 58, 4, 9); |
| 75 const Key S(115, 72, 58, 29, 58, 4, 9); |
| 76 const Key T(116, 145, 0, 29, 58, 4, 9); |
| 77 const Key U(117, 203, 0, 29, 58, 4, 9); |
| 78 const Key V(118, 159, 116, 29, 58, 4, 9); |
| 79 const Key W(119, 58, 0, 29, 58, 4, 9); |
| 80 const Key X(120, 101, 116, 29, 58, 4, 9); |
| 81 const Key Y(121, 174, 0, 29, 58, 4, 9); |
| 82 const Key Z(122, 72, 116, 29, 58, 4, 9); |
| 83 |
| 84 const Key key_set[] = {Q, W, E, R, T, Y, U, I, O, P, A, S, D, |
| 85 F, G, H, J, K, L, Z, X, C, V, B, N, M}; |
| 86 |
| 87 const int key_count = 26; |
| 88 |
| 89 } // namespace keyset |
| 90 } // namespace prediction |
| 91 |
| 92 #endif // SERVICES_PREDICTION_KEY_SET_H_ |
OLD | NEW |