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
//! # imekit
//!
//! A cross-platform Rust library for IME (Input Method Engine) integration using native protocols.
//!
//! This crate provides native protocol implementations for:
//! - **Linux/Wayland**: `zwp_input_method_v2` and `zwp_text_input_v3` protocols
//! - **Linux/X11**: XIM (X Input Method) protocol
//! - **Linux/IBus**: IBus D-Bus interface (fallback when Wayland protocol is unavailable)
//! - **Windows**: Text Services Framework (TSF)
//! - **macOS**: Input Method Kit (IMK)
//!
//! ## Protocol Support
//!
//! ### Linux - Wayland
//! Uses `wayland-protocols-misc` for the input-method-unstable-v2 protocol which provides:
//! - Input method registration and lifecycle
//! - Text commit and preedit handling
//! - Surrounding text context
//! - Popup surface creation for candidate windows
//!
//! ### Linux - X11
//! Uses XIM (X Input Method) protocol for:
//! - Full XIM server implementation
//! - Text commit via XIM protocol or XTest extension
//! - Preedit handling
//!
//! ### Linux - IBus
//! Uses IBus D-Bus interface (enabled with `ibus` feature) as a fallback:
//! - Works when Wayland input-method protocol is not available
//! - Provides text commit functionality via IBus
//!
//! ### Windows
//! Uses the Text Services Framework (TSF) for:
//! - Input processor registration
//! - Text composition via SendInput
//! - Candidate window management
//!
//! ### macOS
//! Uses the Input Method Kit (IMK) framework for:
//! - Native NSTextInputClient integration
//! - Text input handling via CGEvent
//!
//! ## Features
//!
//! - `log` - Enable logging via the `log` crate
//! - `tracing` - Enable logging via the `tracing` crate
//! - `ibus` - Enable IBus support for Linux (requires `zbus`)
//!
//! ## Example
//!
//! ```rust,no_run
//! use imekit::{InputMethod, InputMethodEvent};
//!
//! // Create an input method instance
//! let mut im = InputMethod::new()?;
//!
//! // Handle events
//! while let Some(event) = im.next_event() {
//! match event {
//! InputMethodEvent::Activate { serial } => {
//! // IME activated - ready to commit text
//! im.commit_string("Hello!")?;
//! im.commit(serial)?;
//! }
//! InputMethodEvent::Deactivate => {
//! // IME deactivated
//! }
//! InputMethodEvent::SurroundingText { text, cursor, anchor } => {
//! // Got surrounding text context
//! }
//! _ => {}
//! }
//! }
//! # Ok::<(), imekit::Error>(())
//! ```
pub use ;
pub use *;
/// The display server being used on Linux
// Re-export Wayland-specific types (always available on Linux for building)
// Re-export X11-specific types
// Re-export IBus-specific types (when feature is enabled)
// Main InputMethod that auto-detects display server
pub use InputMethod;
pub use InputMethod;
pub use InputMethod;