@@ -122,39 +122,12 @@ RabbitMain(args) {
122
122
}
123
123
124
124
; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=101183
125
- SetDefaultKeyboard (locale_id := 0 ) {
126
- if ! locale_id {
127
- local key_map := Map(
128
- " EN_US" , 0x0409 ,
129
- " EN_GB" , 0x0809 ,
130
- " EN_HK" , 0x3c09 ,
131
- )
132
- local lang_path := RabbitUserDataPath() . " \.lang"
133
- if FileExist (lang_path) {
134
- local lang := FileRead (lang_path, " UTF-8" )
135
- local valid := lang && key_map.Has(StrUpper(StrReplace (lang, " -" , " _" )))
136
- if ! lang || ! valid {
137
- input_box := InputBox (" 当玉兔毫启动时,会将系统键盘切换到对应语言" , " 请输入语言代码" , , " en_US" )
138
- if input_box.Result == " OK" {
139
- lang := input_box.Value
140
- }
141
- if lang && key_map.Has(StrUpper(StrReplace (lang, " -" , " _" ))) {
142
- FileDelete (lang_path)
143
- FileAppend (lang, lang_path, " UTF-8" )
144
- }
145
- }
146
- try
147
- locale_id := key_map[StrUpper(StrReplace (lang, " -" , " _" ))]
148
- }
149
- if ! locale_id
150
- locale_id := 0x0409
151
- }
152
- local HWND_BROADCAST := 0xffff
153
- local LOW_WORD := 0xffff
154
- local WM_INPUTLANGCHANGEREQUEST := 0x0050
155
- local locale_id_hex := Format (" {:08x}" , locale_id & LOW_WORD)
125
+ SetDefaultKeyboard (locale_id := 0x0409 ) {
126
+ if FileExist (RabbitUserDataPath() . " \.lang" )
127
+ return
128
+ local locale_id_hex := Format (" {:08x}" , locale_id & 0xffff )
156
129
lang := DllCall (" LoadKeyboardLayout" , " Str" , locale_id_hex, " Int" , 0 )
157
- PostMessage (WM_INPUTLANGCHANGEREQUEST, 0 , lang, HWND_BROADCAST)
130
+ PostMessage (WM_INPUTLANGCHANGEREQUEST := 0x0050 , 0 , lang, HWND_BROADCAST := 0xffff )
158
131
}
159
132
160
133
ExitRabbit (layout, reason, code ) {
0 commit comments