blob: 8b72b2217de0dd9aa18243e76b8b665203605cd1 [file] [log] [blame]
Ria Runjie Jiang1e6163c2015-08-06 13:06:25 -07001// 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
12namespace 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
18struct 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
55namespace keyset {
56
57const Key A(97, 43, 58, 29, 58, 4, 9);
58const Key B(98, 188, 116, 29, 58, 4, 9);
59const Key C(99, 130, 116, 29, 58, 4, 9);
60const Key D(100, 101, 58, 29, 58, 4, 9);
61const Key E(101, 87, 0, 29, 58, 4, 9);
62const Key F(102, 130, 58, 29, 58, 4, 9);
63const Key G(103, 159, 58, 29, 58, 4, 9);
64const Key H(104, 188, 58, 29, 58, 4, 9);
65const Key I(105, 232, 0, 29, 58, 4, 9);
66const Key J(106, 217, 58, 29, 58, 4, 9);
67const Key K(107, 246, 58, 29, 58, 4, 9);
68const Key L(108, 275, 58, 29, 58, 4, 9);
69const Key M(109, 246, 116, 29, 58, 4, 9);
70const Key N(110, 217, 116, 29, 58, 4, 9);
71const Key O(111, 261, 0, 29, 58, 4, 9);
72const Key P(112, 290, 0, 29, 58, 4, 9);
73const Key Q(113, 29, 0, 29, 58, 4, 9);
74const Key R(114, 116, 0, 29, 58, 4, 9);
75const Key S(115, 72, 58, 29, 58, 4, 9);
76const Key T(116, 145, 0, 29, 58, 4, 9);
77const Key U(117, 203, 0, 29, 58, 4, 9);
78const Key V(118, 159, 116, 29, 58, 4, 9);
79const Key W(119, 58, 0, 29, 58, 4, 9);
80const Key X(120, 101, 116, 29, 58, 4, 9);
81const Key Y(121, 174, 0, 29, 58, 4, 9);
82const Key Z(122, 72, 116, 29, 58, 4, 9);
83
84const 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
87const int key_count = 26;
88
89} // namespace keyset
90} // namespace prediction
91
92#endif // SERVICES_PREDICTION_KEY_SET_H_