Mais conteúdo relacionado
Semelhante a Input Method Kit (20)
Mais de Weizhong Yang (20)
Input Method Kit
- 2. IMK
• developer
• hack
• NSTextView NSTextField
UI
developer
- 11. …
dylib crash
Finder
crash
Finder crash
crash…
- 12. IMK
Input Client Input Server
用來打字的應用程式 輸入法
IMK client/server
app app plug-in
32/64
- 14. IMK
Input Controller
輸入法邏輯
Input Client
用來打字的應用程式
Input Server
Proxy 監聽輸入事件的 server
IPC
server server
controller
- 15. Input Controller
delegate …
Delegate
Input Controller
輸入法邏輯
Input Client
用來打字的應用程式
Proxy
Input Server
監聽輸入事件的 server
delegate
Input Controller
- 17. Delegate IMKServerInput
Input Controller IMKStateSetting
輸入法邏輯
Input Client
IMKTextInput 用來打字的應用程式
Proxy
Input Server
監聽輸入事件的 server
- 19. setMarkedText:selectionRange:
replacementRange:
• - (void)setMarkedText:(id)string selectionRange:
(NSRange)selectionRange replacementRange:
(NSRange)replacementRange
• method
•
•
- 24. attributesForCharacterIndex:li
neHeightRectangle:
• - (NSDictionary*)attributesForCharacterIndex:
(NSUInteger)index lineHeightRectangle:
(NSRect*)lineRect
• attributes
• lineRect
- 28. template
• Xcode project
template
• OpenVanilla Syrup
• https://github.com/lukhnos/syrup
• template :p
- 31. Main.m
IMKServer *server = [[IMKServer alloc]
initWithName:kConnectionName bundleIdentifier:
[[NSBundle mainBundle] bundleIdentifier]];
server
connection name info.plist
- 32. • compile app bundle ~/
Library/Input Methods/
• syrup tistool
tistool -r
<PATH_OF_YOUR_INPUT_METHOD>
• script compile
- 33. • TIS Text Input Service API
• TISRegisterInputSource((CFURLRef)inBund
leURL)
- 37. /
•
• – handleEvent:client:
• – inputText:key:modifiers:client:
• – inputText:client: –
didCommandBySelector:client:
- 38. – handleEvent:client:
• NSEvent
• -characters //
• -keyCode // key code
• -modifierFlags // command
shift option ctrl
• – inputText:key:modifiers:client:
- 39. modifierFlags
• flags & NSShiftKeyMask // shift
• flags & NSControlKeyMask // control
• flags & NSAlternateKeyMask // option
• flags & NSCommandKeyMask // command
• flags & NSNumericPadKeyMask //
•
- 40. Key Code
• Key Code char
Key Code char
• Key Code
QWERTY Dvorak
• overrideKeyboardWithKeyboardNamed
Input Client Keyboard Layout
- 41. characters
• NSString
•
• -characters
• -charactersIgnoringModifiers
- 43. inputText:client: –
didCommandBySelector:client:
• inputText:client:
• didCommandBySelector:client:
NSResponder Action Messages
• insertNewline: insertTab:…
• NSResponder -doCommandBySelector:
method action
editor :)
- 44. inputText:client: –
didCommandBySelector:client:
• selector keycode
• Command
Selector
• Shift …
- 45. input client
• Input Client
setMarkedText:selectionRange:replacement
Range:
• [client setMarkedText:inputString
selectionRange:NSMakeRange(cursorIndex, 0)
replacementRange:NSMakeRange(NSNotFound,
NSNotFound)];
• selectionRange
replacementRange
- 47. • IMK IMKCandidate
• class
- 50. • NSWindow sublcass
• main window key window
window level
• window level
3D level
CGShieldingWindowLevel() + 1
• input client window level
- 53. IMKTextInput
• IMKTextInput input client
protocol input client
•
• input client window
window frame
input client
- 54. IMKTextInput
• 10.7
( TextEdit
•
• -
(NSDictionary*)attributesForChara
cterIndex:(NSUInteger)index
lineHeightRectangle:
(NSRect*)lineRect
- 56. • Xcode attach
process Xcode Editor
• Xcode crash
• Xcode debug
NSLog Console
Notas do Editor
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n