Git Product home page Git Product logo

Comments (2)

damhiya avatar damhiya commented on August 24, 2024

Hyprland도 비슷한 이슈가 생겼습니다. kime-indicator를 보면 한/영 전환이 되는건 표시가 되는데, 한글 모드 일 때 입력이 되지 않습니다.

from kime.

xnuk avatar xnuk commented on August 24, 2024

아래 코드가 Sway 1.8.1에서는 preedit이 뜨며 카운트가 하나씩 올라가는데, Sway 1.9에서는 카운트가 올라가다가 말 때도 있고 아예 preedit이 안 보일 때도 있네요. set_preedit_string 대신 commit_string으로 해도 Sway 1.9의 동작이 이상한 건 비슷합니다. (Wayland 쪽 처음 건드려봐서 제가 잘못 짰을 수도 있어요)

//! ```cargo
//! [dependencies]
//! anyhow = '1.0.80'
//! wayland-client = '0.31.2'
//! wayland-protocols-misc = { version = '0.2.0', features = ['client'] }
//! ```

use std::{
    fmt::Debug,
    thread,
    time::{Duration, Instant},
};

use wayland_client::{
    globals::registry_queue_init, protocol::wl_seat::WlSeat, Connection,
    Dispatch,
};

use wayland_protocols_misc::zwp_input_method_v2::client::zwp_input_method_manager_v2::ZwpInputMethodManagerV2;

struct Suntofu {
    since: Instant,
}

// does not handle all events, just logging only.
impl<Proxy, UserData> Dispatch<Proxy, UserData> for Suntofu
where
    Proxy: wayland_client::Proxy,
    Proxy::Event: Debug,
{
    fn event(
        Suntofu { since }: &mut Self,
        _: &Proxy,
        event: Proxy::Event,
        _: &UserData,
        _: &Connection,
        _: &wayland_client::QueueHandle<Self>,
    ) {
        let timestamp = since.elapsed().as_millis();
        let protocol = Proxy::interface().name;

        println!("{timestamp:5}ms  [{protocol}]  {event:?}");
    }
}

fn main() -> anyhow::Result<()> {
    let conn = Connection::connect_to_env()?;
    let (globals, mut event_queue) = registry_queue_init::<Suntofu>(&conn)?;
    let handle = event_queue.handle();

    let seat: WlSeat = globals.bind(&handle, 1..=1, ())?;
    let im_manager: ZwpInputMethodManagerV2 =
        globals.bind(&handle, 1..=1, ())?;

    let im = im_manager.get_input_method(&seat, &handle, ());

    let mut tofu = Suntofu {
        since: Instant::now(),
    };

    event_queue.roundtrip(&mut tofu)?;

    for i in 1..100 {
        thread::sleep(Duration::from_millis(500));
        event_queue.roundtrip(&mut tofu)?;

        let preedit = format!("사과 {i}개");
        let len = preedit.len();
        im.set_preedit_string(preedit, 0, len as _);
        im.commit(i);
    }

    Ok(())
}
실행 결과

Sway 1.8.1

18.mp4

Sway 1.9

19.mp4

from kime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.