forked from bermudalocket/FlicksForAll
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotes
492 lines (427 loc) · 11.8 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
UIKBRenderer _drawSingleSymbol draws all "Valid chars for fast drawing"
and returns YES if succeeded, NO if not
main keyplane: all letters (plus secondary except for those listed below)
numbers and punctuation: all but £, ", , and '
alternate symbols: none
symbols in the paddle are not drawn using _drawSingleSymbol
_drawKeyString handles all of them, including paddles
... but is still hit by the textOpacity bug???
// https://iphonedevwiki.net/index.php/UIKBTree
%hook UIKeyboardLayoutStar
- (void)setLayoutTag:(NSString *)tag {
NSLog(@"UIKeyboardLayoutStar setLayout:%@", tag);
%orig;
}
%end
%hook UIKBTree
-(void)setLayoutTag:(NSString *)tag passingKeyTest:(id)test {
NSLog(@"UIKBTree %@ sets tag %@", [self description], tag);
%orig;
}
- (void)setGestureKey:(UIKBTree *)key {
NSLog(@"UIKBTree %@ sets gestureKey %@", [self description], [key description]);
%orig;
}
%end
// dual mode for iPad bottom right keys:
// displayType = 7 (dual string)
// interactionType = 2 (popup?)
// secondaryDisplayStrings, secondaryRepresentedStrings
supports-continuous-path is a keyplane property
boolForProperty: 32 = true, other = false??
updateFlickKeycapOnKeys is where the gestures are combined
keyboard {
keyplane* {
keylayout* {
keyset {
list* {
key*
}
}
geometryset
attributeset
}
}
}
Tree Types:
1 Keyboard
2 Keyplane
3 Keylayout
4 KeySet
5 GeometrySet
6 AttributeSet
7 List
8 Key
9 Shape
10 Attributes
11 Identifiers
12 AdaptiveKey
13 MergePolicy
14 Validator
Interaction Types:
0 None
1 String
2 StringPopup
3 CandidateList
4 Delete
5 Dictation
6 Dismiss
7 Drag
8 Handwriting
9 International
10 KeyplaneSwitch
11 More
12 Redo
13 Return
14 Shift
15 Space
16 StringFlick
17 Undo
18 EmojiInputView
19 EmojiCategoryControl
20 MultitapComplete
21 MultitapReverse
22 RecentInput
23 Clear
24 RevealHiddenCandidates
25 SelectNextCandidate
26 SelectPreviousCandidate
27 AcceptAutocorrection
28 Bold
29 Italic
30 Underline
31 Cut
32 Copy
33 Paste
34 LeftArrow
35 RightArrow
36 AssertLayoutTag
37 Tab
38 CapsLock
39 DictationDisplay
40 MessagesWriteboard
Visual Style
1 iPhoneStandard
2 iPhoneDictation
3 iPhoneAlert
4 iPhoneEmoji
5 iPhonePasscode
101 Wildcat50On
102 WildcatStandard
103 WildcatDictation
104 WildcatAlert
105 WildcatPasscode
106 WildcatSplit
107 WildcatSplitFullWidth
108 WildcatEmoji
109 WildcatEmojiSplit
201 MonolithStandard
301 CarStandard
Display Types
0 String
1 CandidateList
2 Command
3 Delete
4 Dictation
5 Dismiss
6 Drag
7 DualString
8 DynamicString
9 Emoji
10 TenKeyKeyplaneSwitchOff
11 TenKeyKeyplaneSwitchOn
12 Handwriting
13 International
14 KeyplaneSwitch
15 LeftDarkAndNoRightDivider
16 LightBottom
17 LightBottomAndRight
18 More
19 NoRightDivider
20 NumberPad
21 Return
22 ReverseVerticalDark
23 Shift
24 SmallKana
25 Space
26 Tab
27 TopLevelDomain
28 TopLevelDomainVariant
29 TwoVerticalDark
30 TwoVerticalLight
31 VoicedKey
32 MultitapCompleteKey
33 MultitapReverseKey
34 WALongVowelSignKey
35 TenKeyRomanKey
36 EmojiInputView
37 EmojiCategoryControl
38 LetterLine
39 Bold
40 Italic
41 Underline
42 Cut
43 Copy
44 Paste
45 LeftArrow
46 RightArrow
47 PredictionActive
48 UCBSelectionBackground
49 BIU
50 Divider
51 CapsLock
52 DictationDisplay
53 MessagesWriteboard
Variants Types
1 Accents
3 Currency
4 Email
5 ImmediateAccents
6 InputModes
7 URL
8 KeyplaneAccents
9 BIU
10 SkinToneEmoji
11 PrepopulatedSkinToneEmoji
12 ExtendedSkinToneEmoji
13 PrepopulatedExtendedSkinToneEmoji
Attribute Value
1 10Key
2 Center
3 Dark
4 Disabled
5 Enabled
6 ExtendedSymbols
7 Flick
8 Glyph
9 Handwriting
10 Highlighted
11 Japanese50on
12 KeyboardTypeASCIICapable
13 KeyboardTypeDecimalPad
14 KeyboardTypeDefault
15 KeyboardTypeEmailAddress
16 KeyboardTypeNamePhonePad
17 KeyboardTypeNumberPad
18 KeyboardTypeNumbersAndPunctuation
19 KeyboardTypePhonePad
20 KeyboardTypeURL
21 Left
22 Letters
23 Light
24 Name
25 No
26 Numbers
27 PhonePad
28 Pressed
29 Right
30 Straight
31 Symbols
32 Yes
33 Chinese10Key
34 Korean10Key
35 JapaneseAIU
36 StrictlyLeft
37 StrictlyRight
38 Emoji
39 Dictation
40 PopupMenu
41 High
42 Linear
43 FixedLeft
44 FixedRight
45 Cased
46 Literal
47 None
Image flags:
1: key backgrounds
2: key dropshadows
3: popup background, but different, somehow (update: this is prob. the mask)
4: key labels, all kinds
16: secondary label *in popup*
32: 2nd secondary label (for developer gesture mode)
%hook UIKeyboardCache
- (NSDictionary *)displayImagesForView:(UIView *)view fromLayout:(UIKeyboardLayout *)layout imageFlags:(NSArray *)imageFlags {
NSDictionary *dict = %orig;
NSLog(@"displayImagesForView:");
[dict enumerateKeysAndObjectsUsingBlock:^(NSObject *key, UIImage *value, BOOL *stop) {
// NSLog(@"IMG: %@ -> %@", key, value);
NSData *png = UIImagePNGRepresentation(value);
NSString *path = [NSString stringWithFormat:@"/private/var/mobile/Containers/Data/Application/7FCDEF14-1CFE-4AD0-A108-B7F49D3616C1/tmp/kb2/%@_%d_%d.png", key, (int)value.size.width, (int)value.size.height];
NSLog(@"Writing to %@", path);
if ([png writeToFile:path atomically:NO])
NSLog(@"ok");
else
NSLog(@"failed");
}];
return dict;
}
%end
Key States:
1 = Disabled
2 = Normal
4 = Pressed
8 = ~it is a mystery~
16 = Menu active (accent variants OR international menu OR stringflick)
32 = Shift Lock
36 = Shift Locked + Touched
'flick' appears to be 10key boards with l/r/u/d buttons like Japanese
uses interaction=16 StringFlick
KBflickDirection represents which subkey user is touching
fixing key popups is gonna involve UIKBKeyViewAnimator
UIKeyboardLayoutStar.updatePanAlternativesForTouchInfo is where the
preview animation for the secondary strings is manipulated
so, keyViewAnimator is probably what I need to fix
sets UIKBTree.selectedVariantIndex to -1, 0 or 1
calling UIKBKeyplaneView.purgeActiveKeyViews gets rid of cached key popups
calling UIKeyboardLayoutStar.reloadCurrentKeyplane does a full
UIKBKeyplaneView.viewForKey gets the popup view for a key, if that key is pressed
UIKeyboardLayoutStar contains UIKBKeyplaneView
UIKBKeyplaneView contain three UIKBSplitImageView instances for main keys, and
one UIKBKeyView each for the control keys
a UIKBKeyView is added to UIInputSetContainerView for the popups
changing key name may be a cheap way to invalidate caches
---
fixing the positions on keycaps requires playing with UIKBKeyViewAnimator
we need two separate versions: one for paddles and one for non-paddles
initial positions upon tap are applied by:
transitionKeyView:fromState:toState:completion:
handles toState=4 (becoming pressed)
text layer gets keycapPrimaryTransform
for 1-symbol keys:
symbol layer gets keycapAlternateTransform
for 2-symbol keys:
left symbol layer gets keycapLeftTransform
right symbol layer gets keycapRightTransform
symbol layer gets opacity 0.25 for light kb, 0.3 for dark kb
keycapPrimaryTransform:
from x=0.115 y=0.28 w=0.77 h=0.44 to x=0.115 y=0.45 w=0.77 h=0.44
(moves label down)
keycapAlternateTransform:
from x=0.115 y=0.28 w=0.77 h=0.44 to x=0.25 y=0.13 w=0.5 h=0.286
or, h=0.2574 if the symbol is a digit
(moves label up and makes it smaller)
keycapLeftTransform:
from x=0.115 y=0.28 w=0.77 h=0.44 to x=-0.065 y=0.13 w=0.65 h=0.286
(moves label up and left and makes it smaller)
...hey, wait, isn't this fucking up the aspect ratio?
(yes, it's noticeable on iPad, amazing)
keycapRightTransform:
from x=0.115 y=0.28 w=0.77 h=0.44 to x=0.415 y=0.13 w=0.65 h=0.286
(same as above really)
keycapPrimaryExitTransform:
from x=0.115 y=0.28 w=0.77 h=0.44 to x=0.5 y=0.89 w=0 h=0
(moves label to bottom, out of the way)
keycapNullTransform:
from x=0.115 y=0.28 w=0.77 h=0.44 to x=0.115 y=0.28 w=0.77 h=0.44
(doesn't move anything)
only way to get good rendering on the paddles, by default
then, animations:
transitionStartedForKeyView:alternateCount:toLeft:
creates missing animations...
for alternateCount=1 (1-symbol keys):
creates "pan transform" animation on text layer:
meshTransform from keycapPrimaryTransform to keycapPrimaryExitTransform
creates "pan opacity" animation on text layer:
opacity animation from 1.0 to 0
creates "pan transform" animation on symbol layer:
meshTransform from keycapAlternateTransform to keycapNullTransform
creates "pan opacity" animation on symbol layer:
opacity animation from 0.25/0.3 to 1.0
for alternateCount=2 (2-symbol keys):
if toLeft:
creates "pan transform left" animation on text layer:
meshTransform from keycapPrimaryTransform to keycapLeftSelectPrimaryTransform
creates "pan transform" animation on symbol layer 1:
meshTransform from keycapLeftTransform to keycapLeftSelectLeftTransform
creates "pan transform" animation on symbol layer 2:
meshTransform from keycapRightTransform to keycapLeftSelectRightTransform
creates "pan opacity" animation on symbol layer 1:
opacity animation from 0.25/0.3 to 1.0
creates "pan opacity" animation on symbol layer 2:
opacity animation from 0.25/0.3 to 0
if not toLeft:
creates "pan transform right" animation on text layer:
meshTransform from keycapPrimaryTransform to keycapRightSelectPrimaryTransform
creates "pan transform" animation on symbol layer 1:
meshTransform from keycapLeftTransform to keycapRightSelectLeftTransform
creates "pan transform" animation on symbol layer 2:
meshTransform from keycapRightTransform to keycapRightSelectRightTransform
creates "pan opacity" animation on symbol layer 1:
opacity animation from 0.25/0.3 to 0
creates "pan opacity" animation on symbol layer 2:
opacity animation from 0.25/0.3 to 1.0
creates "pan opacity" animation on text layer:
opacity animation from 1.0 to 0
transitionEndedForKeyView:alternateCount:
...honestly can't be fucked with figuring this one out, it's 3am, it's more of the same
it generates animations, so ofc we need to fuck with it too
updateTransitionForKeyView:normalizedDragSize:
calls transitionStartedForKeyView:... and setTimeOffset on the layers as appropriate
endTransitionForKeyView:
calls transitionEndedForKeyView... etc
ok, now what
paddle is provisionally 108*114 portrait, 123*114 landscape (on i8 simulator)
...but of course, the position of the text changes *inside* it at the edges
making it work nicely will require some Trickery
non-paddle is provisionally 35.5*46 portrait, 51*36 landscape (on i8 simulator)
iPad keys are pretty much square, no paddles, so it's much easier there
---
Default renderconfig:
Light: true
Blur: 30, 0.9
Keycap opacity: 0.96
Light keycap opacity: 1.0
Dark:
Light: false
Blur: 20, 0.5
Keycap opacity: 1.0
Light keycap opacity: 1.0
Low Quality Dark:
Same, but forceQuality is 10
KBStarTypeString(a, b):
a == 2: <TV>
_: blank
4: NumberPad
5: PhonePad
6: blank
7: Email
8: DecimalPad
9: blank
10: AlphaWithURL
11: NumberPad
127: PasscodePad
a == 1: <iPad>
_: blank
3: URL
4: Pad
5: Pad
6: NamePhonePad
7: Email
8: Pad
9: Twitter
10: AlphaWithURL
11: Pad
127: PasscodePad
else: <iPhone or Car>
_: blank
3: URL
4: NumberPad
5: PhonePad
6: NamePhonePad
7: Email
8: DecimalPad
9: Twitter
10: AlphaWithURL
11: NumberPad
127: PasscodePad
Enumerating enabled keyboards:
[UIKeyboardInputModeController sharedInputModeController] keeps track of them
activeInputModes returns NSArray of UIKeyboardInputMode and UIKeyboardExtensionInputMode
enabledInputModes returns NSArray of identifiers:
"en_GB@sw=QWERTY;hw=Automatic",
"es_ES@sw=QWERTY;hw=Automatic",
"emoji@sw=Emoji",
"tr_TR@sw=Turkish-Q;hw=Automatic",
"com.textstarter.PC-Keyboard.Extension"
displayName and extendedDisplayName give the names to show