-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
347 changed files
with
872 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "windows-langinput" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
globals = { path = "../rust/globals" } | ||
|
||
[dependencies.windows] | ||
version = "0.48.0" | ||
features = [ | ||
"Win32_Foundation", | ||
"Win32_System_LibraryLoader", | ||
"Win32_UI_Input_KeyboardAndMouse", | ||
"Win32_System_Com", | ||
"Win32_System_SystemServices", | ||
"Win32_UI_TextServices", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use windows::Win32::UI::TextServices::{ | ||
ITfInputProcessorProfileMgr, TF_INPUTPROCESSORPROFILE, GUID_TFCAT_TIP_KEYBOARD, | ||
CLSID_TF_InputProcessorProfiles | ||
}; | ||
|
||
use windows::core::{Interface, Result, GUID}; | ||
|
||
use windows::Win32::System::Com::{CoCreateInstance, CoInitializeEx, CLSCTX_INPROC_SERVER, COINIT_APARTMENTTHREADED}; | ||
|
||
use windows::Win32::System::SystemServices::{ | ||
LANG_MALAYALAM, SUBLANG_MALAYALAM_INDIA, | ||
LANG_ASSAMESE, SUBLANG_ASSAMESE_INDIA, | ||
LANG_MARATHI, SUBLANG_MARATHI_INDIA, | ||
LANG_BENGALI, SUBLANG_BENGALI_INDIA, | ||
LANG_NEPALI, SUBLANG_NEPALI_INDIA, | ||
LANG_GUJARATI, SUBLANG_GUJARATI_INDIA, | ||
LANG_ODIA, SUBLANG_ODIA_INDIA, | ||
LANG_HINDI, SUBLANG_HINDI_INDIA, | ||
LANG_PUNJABI, SUBLANG_PUNJABI_INDIA, | ||
LANG_KANNADA, SUBLANG_KANNADA_INDIA, | ||
LANG_SANSKRIT, SUBLANG_SANSKRIT_INDIA, | ||
LANG_TAMIL, SUBLANG_TAMIL_INDIA, | ||
LANG_TELUGU, SUBLANG_TELUGU_INDIA, | ||
}; | ||
|
||
pub fn create_instance_inproc<T: Interface + windows::core::ComInterface>( | ||
clsid: &GUID, | ||
) -> Result<T> { | ||
unsafe { CoCreateInstance(clsid, None, CLSCTX_INPROC_SERVER) } | ||
} | ||
|
||
pub fn get_active_langid() -> windows::core::Result<u16> { | ||
let profile_manager: ITfInputProcessorProfileMgr = | ||
create_instance_inproc(&CLSID_TF_InputProcessorProfiles)?; | ||
|
||
let mut profile: TF_INPUTPROCESSORPROFILE = Default::default(); | ||
unsafe { | ||
profile_manager.GetActiveProfile(&GUID_TFCAT_TIP_KEYBOARD, &mut profile)?; | ||
} | ||
|
||
Ok(profile.langid) | ||
} | ||
|
||
fn main() { | ||
unsafe { | ||
CoInitializeEx(None, COINIT_APARTMENTTHREADED).expect("Failed to initialize COM"); | ||
} | ||
|
||
let langid = get_active_langid().unwrap() as u32; | ||
println!("{} - {}", LANG_MALAYALAM, SUBLANG_MALAYALAM_INDIA); | ||
println!("{}", (SUBLANG_MALAYALAM_INDIA << 10 | LANG_MALAYALAM) as u16); | ||
println!("Active langid: {}", langid); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"rustc_fingerprint":13664666599156650873,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.73.0 (cc66ad468 2023-10-03)\nbinary: rustc\ncommit-hash: cc66ad468955717ab92600c770da8c1601a4ff33\ncommit-date: 2023-10-03\nhost: x86_64-pc-windows-gnu\nrelease: 1.73.0\nLLVM version: 17.0.2\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\nlib___.a\n___.dll\nC:\\Users\\doxop\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\noff\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""},"14799887915714938425":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\nlib___.a\n___.dll\nC:\\Users\\doxop\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\noff\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"windows\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""}},"successes":{}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Signature: 8a477f597d28d172789f06886806bc55 | ||
# This file is a cache directory tag created by cargo. | ||
# For information about cache directory tags see https://bford.info/cachedir/ |
Empty file.
Binary file added
BIN
+23 Bytes
windows-langinput/target/debug/.fingerprint/globals-5a4a9210e21fe9bf/dep-lib-globals
Binary file not shown.
1 change: 1 addition & 0 deletions
1
windows-langinput/target/debug/.fingerprint/globals-5a4a9210e21fe9bf/invoked.timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file has an mtime of when this was started. |
1 change: 1 addition & 0 deletions
1
windows-langinput/target/debug/.fingerprint/globals-5a4a9210e21fe9bf/lib-globals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
84018162c8646049 |
1 change: 1 addition & 0 deletions
1
windows-langinput/target/debug/.fingerprint/globals-5a4a9210e21fe9bf/lib-globals.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"rustc":8246398906084555539,"features":"[]","target":13942762244805310453,"profile":13126374248311259211,"path":4401910561198685777,"deps":[[4069948179348390201,"windows",false,10713239733314860667]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\globals-5a4a9210e21fe9bf\\dep-lib-globals"}}],"rustflags":[],"metadata":8270665798335384255,"config":2202906307356721367,"compile_kind":0} |
Binary file added
BIN
+23 Bytes
windows-langinput/target/debug/.fingerprint/globals-956644818b420a56/dep-lib-globals
Binary file not shown.
1 change: 1 addition & 0 deletions
1
windows-langinput/target/debug/.fingerprint/globals-956644818b420a56/invoked.timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file has an mtime of when this was started. |
1 change: 1 addition & 0 deletions
1
windows-langinput/target/debug/.fingerprint/globals-956644818b420a56/lib-globals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
41a52dff7d80ee8b |
1 change: 1 addition & 0 deletions
1
windows-langinput/target/debug/.fingerprint/globals-956644818b420a56/lib-globals.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"rustc":8246398906084555539,"features":"[]","target":13942762244805310453,"profile":13126374248311259211,"path":4401910561198685777,"deps":[[4069948179348390201,"windows",false,8914311598249581259]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\globals-956644818b420a56\\dep-lib-globals"}}],"rustflags":[],"metadata":8270665798335384255,"config":2202906307356721367,"compile_kind":0} |
Binary file added
BIN
+23 Bytes
windows-langinput/target/debug/.fingerprint/globals-b582bf0c9e1c1f0b/dep-lib-globals
Binary file not shown.
Oops, something went wrong.