x11: implement true cursor area with XNArea attribute

This commit is contained in:
Aaron Muir Hamilton 2025-03-11 14:04:50 -04:00 committed by GitHub
parent 16d5f46db1
commit a0464ae83b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 46 additions and 36 deletions

View file

@ -36,8 +36,8 @@ pub type ImeEventSender = Sender<(ffi::Window, ImeEvent)>;
/// Request to control XIM handler from the window.
pub enum ImeRequest {
/// Set IME spot position for given `window_id`.
Position(ffi::Window, i16, i16),
/// Set IME preedit area for given `window_id`.
Area(ffi::Window, i16, i16, u16, u16),
/// Allow IME input for the given `window_id`.
Allow(ffi::Window, bool),
@ -192,12 +192,12 @@ impl Ime {
}
}
pub fn send_xim_spot(&mut self, window: ffi::Window, x: i16, y: i16) {
pub fn send_xim_area(&mut self, window: ffi::Window, x: i16, y: i16, w: u16, h: u16) {
if self.is_destroyed() {
return;
}
if let Some(&mut Some(ref mut context)) = self.inner.contexts.get_mut(&window) {
context.set_spot(&self.xconn, x as _, y as _);
context.set_area(&self.xconn, x as _, y as _, w as _, h as _);
}
}