log
This commit is contained in:
parent
255bb0a3f8
commit
513b77db75
2 changed files with 36 additions and 5 deletions
|
@ -256,6 +256,7 @@ impl X11ClientStatePtr {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_ime_position(&self, bounds: Bounds<ScaledPixels>) {
|
pub fn update_ime_position(&self, bounds: Bounds<ScaledPixels>) {
|
||||||
|
println!("ime pos");
|
||||||
let Some(client) = self.get_client() else {
|
let Some(client) = self.get_client() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -273,6 +274,7 @@ impl X11ClientStatePtr {
|
||||||
state.ximc = Some(ximc);
|
state.ximc = Some(ximc);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
println!("set ic values");
|
||||||
let ic_attributes = ximc
|
let ic_attributes = ximc
|
||||||
.build_ic_attributes()
|
.build_ic_attributes()
|
||||||
.push(
|
.push(
|
||||||
|
@ -642,6 +644,9 @@ impl X11Client {
|
||||||
let xim_connected = xim_handler.connected;
|
let xim_connected = xim_handler.connected;
|
||||||
drop(state);
|
drop(state);
|
||||||
|
|
||||||
|
println!("");
|
||||||
|
println!("----start--");
|
||||||
|
|
||||||
let xim_filtered = match ximc.filter_event(&event, &mut xim_handler) {
|
let xim_filtered = match ximc.filter_event(&event, &mut xim_handler) {
|
||||||
Ok(handled) => handled,
|
Ok(handled) => handled,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -660,12 +665,16 @@ impl X11Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
if xim_filtered {
|
if xim_filtered {
|
||||||
|
println!("filtered skipping");
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
println!("not skipping");
|
||||||
}
|
}
|
||||||
|
|
||||||
if xim_connected {
|
if xim_connected {
|
||||||
self.xim_handle_event(event);
|
self.xim_handle_event(event);
|
||||||
} else {
|
} else {
|
||||||
|
println!("event not connected!");
|
||||||
self.handle_event(event);
|
self.handle_event(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -711,6 +720,7 @@ impl X11Client {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
println!("create ic");
|
||||||
ximc.create_ic(xim_handler.im_id, ic_attributes.build())
|
ximc.create_ic(xim_handler.im_id, ic_attributes.build())
|
||||||
.ok();
|
.ok();
|
||||||
let mut state = self.0.borrow_mut();
|
let mut state = self.0.borrow_mut();
|
||||||
|
@ -718,6 +728,7 @@ impl X11Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset_ime(&self) {
|
pub fn reset_ime(&self) {
|
||||||
|
println!("reset called");
|
||||||
let mut state = self.0.borrow_mut();
|
let mut state = self.0.borrow_mut();
|
||||||
state.composing = false;
|
state.composing = false;
|
||||||
if let Some(mut ximc) = state.ximc.take() {
|
if let Some(mut ximc) = state.ximc.take() {
|
||||||
|
@ -1275,12 +1286,15 @@ impl X11Client {
|
||||||
fn handle_xim_callback_event(&self, event: XimCallbackEvent) {
|
fn handle_xim_callback_event(&self, event: XimCallbackEvent) {
|
||||||
match event {
|
match event {
|
||||||
XimCallbackEvent::XimXEvent(event) => {
|
XimCallbackEvent::XimXEvent(event) => {
|
||||||
|
println!("callback from from xim! xevent");
|
||||||
self.handle_event(event);
|
self.handle_event(event);
|
||||||
}
|
}
|
||||||
XimCallbackEvent::XimCommitEvent(window, text) => {
|
XimCallbackEvent::XimCommitEvent(window, text) => {
|
||||||
|
println!("callback from from xim! commit event");
|
||||||
self.xim_handle_commit(window, text);
|
self.xim_handle_commit(window, text);
|
||||||
}
|
}
|
||||||
XimCallbackEvent::XimPreeditEvent(window, text) => {
|
XimCallbackEvent::XimPreeditEvent(window, text) => {
|
||||||
|
println!("callback from from xim! preedit event");
|
||||||
self.xim_handle_preedit(window, text);
|
self.xim_handle_preedit(window, text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1288,21 +1302,28 @@ impl X11Client {
|
||||||
|
|
||||||
fn xim_handle_event(&self, event: Event) -> Option<()> {
|
fn xim_handle_event(&self, event: Event) -> Option<()> {
|
||||||
match event {
|
match event {
|
||||||
Event::KeyPress(event) | Event::KeyRelease(event) => {
|
Event::KeyPress(e)
|
||||||
|
// | Event::KeyRelease(e)
|
||||||
|
=> {
|
||||||
let mut state = self.0.borrow_mut();
|
let mut state = self.0.borrow_mut();
|
||||||
state.pre_key_char_down = Some(Keystroke::from_xkb(
|
state.pre_key_char_down = Some(Keystroke::from_xkb(
|
||||||
&state.xkb,
|
&state.xkb,
|
||||||
state.modifiers,
|
state.modifiers,
|
||||||
event.detail.into(),
|
e.detail.into(),
|
||||||
));
|
));
|
||||||
let (mut ximc, mut xim_handler) = state.take_xim()?;
|
let (mut ximc, mut xim_handler) = state.take_xim()?;
|
||||||
drop(state);
|
drop(state);
|
||||||
xim_handler.window = event.event;
|
xim_handler.window = e.event;
|
||||||
|
if matches!(event, Event::KeyPress(..)) {
|
||||||
|
println!("forward key press to xim");
|
||||||
|
} else {
|
||||||
|
println!("forward key release to xim");
|
||||||
|
}
|
||||||
ximc.forward_event(
|
ximc.forward_event(
|
||||||
xim_handler.im_id,
|
xim_handler.im_id,
|
||||||
xim_handler.ic_id,
|
xim_handler.ic_id,
|
||||||
xim::ForwardEventFlag::empty(),
|
xim::ForwardEventFlag::REQUEST_FILTERING,
|
||||||
&event,
|
&e,
|
||||||
)
|
)
|
||||||
.context("X11: Failed to forward XIM event")
|
.context("X11: Failed to forward XIM event")
|
||||||
.log_err();
|
.log_err();
|
||||||
|
@ -1311,6 +1332,8 @@ impl X11Client {
|
||||||
drop(state);
|
drop(state);
|
||||||
}
|
}
|
||||||
event => {
|
event => {
|
||||||
|
println!("other x11 event.");
|
||||||
|
dbg!(&event);
|
||||||
self.handle_event(event);
|
self.handle_event(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ impl<C: Client<XEvent = xproto::KeyPressEvent>> ClientHandler<C> for XimHandler
|
||||||
_input_method_id: u16,
|
_input_method_id: u16,
|
||||||
input_context_id: u16,
|
input_context_id: u16,
|
||||||
) -> Result<(), ClientError> {
|
) -> Result<(), ClientError> {
|
||||||
|
println!("create ic");
|
||||||
self.connected = true;
|
self.connected = true;
|
||||||
self.ic_id = input_context_id;
|
self.ic_id = input_context_id;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -73,6 +74,8 @@ impl<C: Client<XEvent = xproto::KeyPressEvent>> ClientHandler<C> for XimHandler
|
||||||
_input_context_id: u16,
|
_input_context_id: u16,
|
||||||
text: &str,
|
text: &str,
|
||||||
) -> Result<(), ClientError> {
|
) -> Result<(), ClientError> {
|
||||||
|
println!("commit callback");
|
||||||
|
|
||||||
self.last_callback_event = Some(XimCallbackEvent::XimCommitEvent(
|
self.last_callback_event = Some(XimCallbackEvent::XimCommitEvent(
|
||||||
self.window,
|
self.window,
|
||||||
String::from(text),
|
String::from(text),
|
||||||
|
@ -88,6 +91,8 @@ impl<C: Client<XEvent = xproto::KeyPressEvent>> ClientHandler<C> for XimHandler
|
||||||
_flag: xim::ForwardEventFlag,
|
_flag: xim::ForwardEventFlag,
|
||||||
xev: C::XEvent,
|
xev: C::XEvent,
|
||||||
) -> Result<(), ClientError> {
|
) -> Result<(), ClientError> {
|
||||||
|
println!("forward callback");
|
||||||
|
|
||||||
match xev.response_type {
|
match xev.response_type {
|
||||||
x11rb::protocol::xproto::KEY_PRESS_EVENT => {
|
x11rb::protocol::xproto::KEY_PRESS_EVENT => {
|
||||||
self.last_callback_event = Some(XimCallbackEvent::XimXEvent(Event::KeyPress(xev)));
|
self.last_callback_event = Some(XimCallbackEvent::XimXEvent(Event::KeyPress(xev)));
|
||||||
|
@ -102,6 +107,8 @@ impl<C: Client<XEvent = xproto::KeyPressEvent>> ClientHandler<C> for XimHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_close(&mut self, client: &mut C, _input_method_id: u16) -> Result<(), ClientError> {
|
fn handle_close(&mut self, client: &mut C, _input_method_id: u16) -> Result<(), ClientError> {
|
||||||
|
println!("disconnect");
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +124,7 @@ impl<C: Client<XEvent = xproto::KeyPressEvent>> ClientHandler<C> for XimHandler
|
||||||
preedit_string: &str,
|
preedit_string: &str,
|
||||||
_feedbacks: Vec<xim::Feedback>,
|
_feedbacks: Vec<xim::Feedback>,
|
||||||
) -> Result<(), ClientError> {
|
) -> Result<(), ClientError> {
|
||||||
|
println!("preedit callback");
|
||||||
// XIMReverse: 1, XIMPrimary: 8, XIMTertiary: 32: selected text
|
// XIMReverse: 1, XIMPrimary: 8, XIMTertiary: 32: selected text
|
||||||
// XIMUnderline: 2, XIMSecondary: 16: underlined text
|
// XIMUnderline: 2, XIMSecondary: 16: underlined text
|
||||||
// XIMHighlight: 4: normal text
|
// XIMHighlight: 4: normal text
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue