extern "C" fn preedit_caret_callback(
    _xim: ffi::XIM,
    client_data: ffi::XPointer,
    call_data: ffi::XPointer,
) {
    let client_data = unsafe { &mut *(client_data as *mut ImeContextClientData) };
    let call_data = unsafe { &mut *(call_data as *mut XIMPreeditCaretCallbackStruct) };

    if call_data.direction == ffi::XIMCaretDirection::XIMAbsolutePosition {
        client_data.cursor_pos = call_data.position as usize;
        let cursor_byte_pos = calc_byte_position(&client_data.text, client_data.cursor_pos);

        client_data
            .event_sender
            .send((
                client_data.window,
                ImeEvent::Update(client_data.text.iter().collect(), cursor_byte_pos),
            ))
            .expect("failed to send preedit update event");
    }
}
/// Handling of cursor movements in preedit text.
Handling of cursor movements in preedit text.
Handling of cursor movements in preedit text .
extern "C" fn preedit_caret_callback(
    _xim: ffi::XIM,
    client_data: ffi::XPointer,
    call_data: ffi::XPointer,
) {
    let client_data = unsafe { &mut *(client_data as *mut ImeContextClientData) };
    let call_data = unsafe { &mut *(call_data as *mut XIMPreeditCaretCallbackStruct) };
    if call_data.direction == ffi::XIMCaretDirection::XIMAbsolutePosition {
        client_data.cursor_pos = call_data.position as usize;
        let cursor_byte_pos = calc_byte_position(&client_data.text, client_data.cursor_pos);
        client_data
            .event_sender
            .send((
                client_data.window,
                ImeEvent::Update(client_data.text.iter().collect(), cursor_byte_pos),
            ))
            .expect("failed to send preedit update event");
    }
}
extern " " fn preedit_caret_callback ( _xim : ffi :: XIM , client_data : ffi :: XPointer , call_data : ffi :: XPointer , ) { let client_data = unsafe { & mut * ( client_data as * mut ImeContextClientData ) } ; let call_data = unsafe { & mut * ( call_data as * mut XIMPreeditCaretCallbackStruct ) } ; if call_data . direction == ffi :: XIMCaretDirection :: XIMAbsolutePosition { client_data . cursor_pos = call_data . position as usize ; let cursor_byte_pos = calc_byte_position ( & client_data . text , client_data . cursor_pos ) ; client_data . event_sender . send ( ( client_data . window , ImeEvent :: Update ( client_data . text . iter ( ) . collect ( ) , cursor_byte_pos ) , ) ) . expect ( " " ) ; } }
Handling of cursor movements in preedit text.
Handling of cursor movements in preedit text .
_xim
ffi::XIM
client_data
ffi::XPointer
call_data
ffi::XPointer