mirror of
https://github.com/MorizzG/gentoo-mg.git
synced 2025-12-06 04:22:43 +00:00
init commit
This commit is contained in:
commit
35b8c079f5
12 changed files with 2359 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
--- wezterm-20230320-124340-559cb7b0-orig/.cargo/config 2023-03-21 06:43:40.000000000 +1100
|
||||
+++ wezterm-20230320-124340-559cb7b0/.cargo/config 2023-03-22 13:48:54.970057677 +1100
|
||||
@@ -7,3 +7,10 @@
|
||||
# enabled for the target, so let's turn that on here.
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
rustflags = "-C target-feature=+crt-static"
|
||||
+
|
||||
+[source."https://github.com/wez/libssh-rs.git"]
|
||||
+git = "https://github.com/wez/libssh-rs.git"
|
||||
+replace-with = "vendored-sources"
|
||||
+
|
||||
+[source.vendored-sources]
|
||||
+directory = "deps/crates"
|
||||
19
x11-terms/wezterm/files/wezterm-20240203-110809-cairo.patch
Normal file
19
x11-terms/wezterm/files/wezterm-20240203-110809-cairo.patch
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--- wezterm-20240203-110809-5046fc22-orig/Cargo.toml 2024-02-04 05:08:09.000000000 +1100
|
||||
+++ wezterm-20240203-110809-5046fc22/Cargo.toml 2024-05-12 19:13:53.372080150 +1000
|
||||
@@ -4,7 +4,6 @@
|
||||
"bidi/generate",
|
||||
"strip-ansi-escapes",
|
||||
"sync-color-schemes",
|
||||
- "deps/cairo",
|
||||
"wezterm",
|
||||
"wezterm-blob-leases",
|
||||
"wezterm-dynamic",
|
||||
@@ -26,8 +25,3 @@
|
||||
# https://jakedeichert.com/blog/reducing-rust-incremental-compilation-times-on-macos-by-70-percent/
|
||||
# Disabled because it breaks builds on Windows
|
||||
#split-debuginfo = "unpacked"
|
||||
-
|
||||
-[patch.crates-io]
|
||||
-# We use our own vendored cairo, which has minimal deps and should just
|
||||
-# build via cargo.
|
||||
-cairo-sys-rs = {path="deps/cairo", version="0.18.0"}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- wezterm-20240203-110809-5046fc22-orig/window/Cargo.toml 2024-02-04 05:08:09.000000000 +1100
|
||||
+++ wezterm-20240203-110809-5046fc22/window/Cargo.toml 2024-03-03 16:51:41.640706218 +1100
|
||||
@@ -79,7 +79,7 @@
|
||||
wayland-protocols = {version="0.29", optional=true}
|
||||
wayland-client = {version="0.29", optional=true}
|
||||
wayland-egl = {version="0.29", optional=true}
|
||||
-xcb-imdkit = { version="0.3", git="https://github.com/wez/xcb-imdkit-rs.git", rev="215ce4b08ac9c4822e541efd4f4ffb1062806051"}
|
||||
+xcb-imdkit = {version="0.1.2"}
|
||||
zbus = "3.14"
|
||||
zvariant = "3.15"
|
||||
futures-util = "0.3"
|
||||
408
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p1.patch
Normal file
408
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p1.patch
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
commit 605f9ed36f2c9a514120d1b1b963b48ea3062280
|
||||
Author: Wez Furlong <wez@wezfurlong.org>
|
||||
Date: Sat May 7 14:12:02 2022 -0700
|
||||
|
||||
Update for xcb 1.1
|
||||
|
||||
The API changed quite substantially (and for the better!).
|
||||
This commit is adjusting for that.
|
||||
|
||||
There's a wart that I hope will be tackled upstream in
|
||||
https://github.com/rust-x-bindings/rust-xcb/issues/188
|
||||
|
||||
diff --git a/examples/example.rs b/examples/example.rs
|
||||
index 5262247..3feea8c 100644
|
||||
--- a/examples/example.rs
|
||||
+++ b/examples/example.rs
|
||||
@@ -1,36 +1,31 @@
|
||||
use std::sync::Arc;
|
||||
+use xcb::x::{Cw, EventMask, Window};
|
||||
+use xcb::Event;
|
||||
use xcb_imdkit::{ImeClient, InputStyle};
|
||||
|
||||
-fn create_window(connection: Arc<xcb::Connection>, screen: &xcb::Screen) -> u32 {
|
||||
- let w = connection.generate_id();
|
||||
- let mask = xcb::EVENT_MASK_KEY_PRESS
|
||||
- | xcb::EVENT_MASK_KEY_RELEASE
|
||||
- | xcb::EVENT_MASK_FOCUS_CHANGE
|
||||
- | xcb::EVENT_MASK_VISIBILITY_CHANGE
|
||||
- | xcb::EVENT_MASK_STRUCTURE_NOTIFY;
|
||||
- let values = [
|
||||
- (xcb::CW_BACK_PIXEL, screen.white_pixel()),
|
||||
- (xcb::CW_EVENT_MASK, mask),
|
||||
- ];
|
||||
- xcb::create_window(
|
||||
- &connection,
|
||||
- xcb::COPY_FROM_PARENT as u8,
|
||||
- w,
|
||||
- screen.root(),
|
||||
- 0,
|
||||
- 0,
|
||||
- 400,
|
||||
- 400,
|
||||
- 10,
|
||||
- xcb::WINDOW_CLASS_INPUT_OUTPUT as u16,
|
||||
- screen.root_visual(),
|
||||
- &values,
|
||||
- );
|
||||
- xcb::map_window(&connection, w);
|
||||
- unsafe {
|
||||
- xcb::ffi::xcb_flush(connection.get_raw_conn());
|
||||
- }
|
||||
- w
|
||||
+fn create_window(connection: Arc<xcb::Connection>, screen: &xcb::x::Screen) -> Window {
|
||||
+ let wid = connection.generate_id();
|
||||
+ let mask = EventMask::KEY_PRESS
|
||||
+ | EventMask::KEY_RELEASE
|
||||
+ | EventMask::FOCUS_CHANGE
|
||||
+ | EventMask::VISIBILITY_CHANGE
|
||||
+ | EventMask::STRUCTURE_NOTIFY;
|
||||
+ connection.send_request(&xcb::x::CreateWindow {
|
||||
+ depth: xcb::x::COPY_FROM_PARENT as u8,
|
||||
+ wid,
|
||||
+ parent: screen.root(),
|
||||
+ x: 0,
|
||||
+ y: 0,
|
||||
+ width: 400,
|
||||
+ height: 400,
|
||||
+ border_width: 10,
|
||||
+ class: xcb::x::WindowClass::InputOutput,
|
||||
+ visual: screen.root_visual(),
|
||||
+ value_list: &[Cw::BackPixel(screen.white_pixel()), Cw::EventMask(mask)],
|
||||
+ });
|
||||
+ connection.send_request(&xcb::x::MapWindow { window: wid });
|
||||
+ connection.flush().unwrap();
|
||||
+ wid
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@@ -49,23 +44,9 @@ fn main() {
|
||||
InputStyle::PREEDIT_CALLBACKS,
|
||||
None,
|
||||
);
|
||||
- ime.set_commit_string_cb(|win, input| println!("Win {}, got: {}", win, input));
|
||||
+ ime.set_commit_string_cb(|win, input| println!("Win {:?}, got: {}", win, input));
|
||||
ime.set_forward_event_cb(|win, e| {
|
||||
- dbg!(
|
||||
- win,
|
||||
- e.response_type(),
|
||||
- e.detail(),
|
||||
- e.time(),
|
||||
- e.root(),
|
||||
- e.event(),
|
||||
- e.child(),
|
||||
- e.root_x(),
|
||||
- e.root_y(),
|
||||
- e.event_x(),
|
||||
- e.event_y(),
|
||||
- e.state(),
|
||||
- e.same_screen(),
|
||||
- );
|
||||
+ eprintln!("win={:?} {:?}", win, e);
|
||||
});
|
||||
ime.set_preedit_draw_cb(|win, info| {
|
||||
dbg!(win, info);
|
||||
@@ -79,22 +60,16 @@ fn main() {
|
||||
let mut focus_win = wins[0];
|
||||
let mut n = 0;
|
||||
loop {
|
||||
- let event = connection.wait_for_event();
|
||||
- if event.is_none() {
|
||||
- break;
|
||||
- }
|
||||
- let event = event.unwrap();
|
||||
- dbg!(event.response_type());
|
||||
-
|
||||
- let event_type = event.response_type() & !0x80;
|
||||
- if xcb::FOCUS_IN == event_type {
|
||||
- let event: &xcb::FocusInEvent = unsafe { xcb::cast_event(&event) };
|
||||
- focus_win = event.event();
|
||||
- ime.update_pos(focus_win, 0, 0);
|
||||
- }
|
||||
-
|
||||
- if xcb::CONFIGURE_NOTIFY == event_type {
|
||||
- ime.update_pos(focus_win, 0, 0);
|
||||
+ let event = dbg!(connection.wait_for_event().unwrap());
|
||||
+ match &event {
|
||||
+ Event::X(xcb::x::Event::FocusIn(event)) => {
|
||||
+ focus_win = event.event();
|
||||
+ ime.update_pos(focus_win, 0, 0);
|
||||
+ }
|
||||
+ Event::X(xcb::x::Event::ConfigureNotify(_)) => {
|
||||
+ ime.update_pos(focus_win, 0, 0);
|
||||
+ }
|
||||
+ _ => {}
|
||||
}
|
||||
|
||||
println!(">>>>{}>>>>", n);
|
||||
diff --git a/src/clib.rs b/src/clib.rs
|
||||
index 6996380..55dbde0 100644
|
||||
--- a/src/clib.rs
|
||||
+++ b/src/clib.rs
|
||||
@@ -26,4 +26,3 @@ impl Default for xcb_xim_im_callback {
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index f9b56c8..b966a38 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -15,6 +15,8 @@ extern crate lazy_static;
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use std::pin::Pin;
|
||||
use std::sync::{Arc, Mutex};
|
||||
+use xcb::x::Window;
|
||||
+use xcb::{Event, Raw, Xid, XidNew};
|
||||
|
||||
use bitflags::bitflags;
|
||||
|
||||
@@ -49,6 +51,60 @@ extern "C" fn create_ic_callback(im: *mut xcb_xim_t, new_ic: xcb_xic_t, user_dat
|
||||
}
|
||||
}
|
||||
|
||||
+fn raw_event(event: &Event) -> Option<*mut xcb::ffi::xcb_generic_event_t> {
|
||||
+ match event {
|
||||
+ Event::X(xcb::x::Event::KeyPress(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::KeyRelease(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ButtonPress(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ButtonRelease(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::MotionNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::EnterNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::LeaveNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::FocusIn(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::FocusOut(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::KeymapNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::Expose(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::GraphicsExposure(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::NoExposure(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::VisibilityNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::CreateNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::DestroyNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::UnmapNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::MapNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::MapRequest(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ReparentNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ConfigureNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ConfigureRequest(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::GravityNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ResizeRequest(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::CirculateNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::CirculateRequest(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::PropertyNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::SelectionClear(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::SelectionRequest(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::SelectionNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ColormapNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::ClientMessage(e)) => Some(e.as_raw()),
|
||||
+ Event::X(xcb::x::Event::MappingNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Unknown(e) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::NewKeyboardNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::MapNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::StateNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::ControlsNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::IndicatorStateNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::IndicatorMapNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::NamesNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::CompatMapNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::BellNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::ActionMessage(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::AccessXNotify(e)) => Some(e.as_raw()),
|
||||
+ Event::Xkb(xcb::xkb::Event::ExtensionDeviceNotify(e)) => Some(e.as_raw()),
|
||||
+ // https://github.com/rust-x-bindings/rust-xcb/issues/188
|
||||
+ #[allow(unreachable_patterns)]
|
||||
+ _ => None,
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
extern "C" fn open_callback(im: *mut xcb_xim_t, user_data: *mut c_void) {
|
||||
let ime = unsafe { ime_from_user_data(user_data) };
|
||||
let input_style = ime.input_style.bits();
|
||||
@@ -121,7 +177,7 @@ extern "C" fn commit_string_callback(
|
||||
) {
|
||||
let input = unsafe { xim_encoding_to_utf8(im, input, length as usize) };
|
||||
let ime = unsafe { ime_from_user_data(user_data) };
|
||||
- let win = ime.pos_req.win;
|
||||
+ let win = unsafe { Window::new(ime.pos_req.win) };
|
||||
ime.callbacks.commit_string.as_mut().map(|f| f(win, &input));
|
||||
}
|
||||
|
||||
@@ -135,16 +191,30 @@ extern "C" fn update_pos_callback(_im: *mut xcb_xim_t, ic: xcb_xic_t, user_data:
|
||||
}
|
||||
}
|
||||
|
||||
+const XCB_KEY_PRESS: u8 = 2;
|
||||
+const XCB_KEY_RELEASE: u8 = 3;
|
||||
+
|
||||
extern "C" fn forward_event_callback(
|
||||
_im: *mut xcb_xim_t,
|
||||
_ic: xcb_xic_t,
|
||||
event: *mut xcb_key_press_event_t,
|
||||
user_data: *mut c_void,
|
||||
) {
|
||||
- let ptr = event as *const xcb::ffi::xcb_key_press_event_t;
|
||||
- let event = xcb::KeyPressEvent { ptr: ptr as _ };
|
||||
+ let pressed = unsafe { ((*event).response_type & 0x7f) == XCB_KEY_PRESS };
|
||||
+ let ptr = event as *const xcb::ffi::xcb_generic_event_t;
|
||||
+ let event = unsafe {
|
||||
+ if pressed {
|
||||
+ xcb::Event::X(xcb::x::Event::KeyPress(xcb::x::KeyPressEvent::from_raw(
|
||||
+ ptr as _,
|
||||
+ )))
|
||||
+ } else {
|
||||
+ xcb::Event::X(xcb::x::Event::KeyRelease(
|
||||
+ xcb::x::KeyReleaseEvent::from_raw(ptr as _),
|
||||
+ ))
|
||||
+ }
|
||||
+ };
|
||||
let ime = unsafe { ime_from_user_data(user_data) };
|
||||
- let win = ime.pos_req.win;
|
||||
+ let win = unsafe { Window::new(ime.pos_req.win) };
|
||||
ime.callbacks.forward_event.as_mut().map(|f| f(win, &event));
|
||||
|
||||
// xcb::KeyPressEvent has a Drop impl that will free `event`, but since we don't own it, we
|
||||
@@ -154,7 +224,7 @@ extern "C" fn forward_event_callback(
|
||||
|
||||
extern "C" fn preedit_start_callback(_im: *mut xcb_xim_t, _ic: xcb_xic_t, user_data: *mut c_void) {
|
||||
let ime = unsafe { ime_from_user_data(user_data) };
|
||||
- let win = ime.pos_req.win;
|
||||
+ let win = unsafe { Window::new(ime.pos_req.win) };
|
||||
ime.callbacks.preedit_start.as_mut().map(|f| f(win));
|
||||
}
|
||||
|
||||
@@ -167,7 +237,7 @@ extern "C" fn preedit_draw_callback(
|
||||
let frame = unsafe { &*frame };
|
||||
let preedit_info = PreeditInfo { inner: frame, im };
|
||||
let ime = unsafe { ime_from_user_data(user_data) };
|
||||
- let win = ime.pos_req.win;
|
||||
+ let win = unsafe { Window::new(ime.pos_req.win) };
|
||||
ime.callbacks
|
||||
.preedit_draw
|
||||
.as_mut()
|
||||
@@ -176,7 +246,7 @@ extern "C" fn preedit_draw_callback(
|
||||
|
||||
extern "C" fn preedit_done_callback(_im: *mut xcb_xim_t, _ic: xcb_xic_t, user_data: *mut c_void) {
|
||||
let ime = unsafe { ime_from_user_data(user_data) };
|
||||
- let win = ime.pos_req.win;
|
||||
+ let win = unsafe { Window::new(ime.pos_req.win) };
|
||||
ime.callbacks.preedit_done.as_mut().map(|f| f(win));
|
||||
}
|
||||
|
||||
@@ -195,10 +265,10 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
-type StringCB = dyn for<'a> FnMut(u32, &'a str);
|
||||
-type KeyPressCB = dyn for<'a> FnMut(u32, &'a xcb::KeyPressEvent);
|
||||
-type PreeditDrawCB = dyn for<'a> FnMut(u32, PreeditInfo<'a>);
|
||||
-type NotifyCB = dyn FnMut(u32);
|
||||
+type StringCB = dyn for<'a> FnMut(Window, &'a str);
|
||||
+type KeyPressCB = dyn for<'a> FnMut(Window, &'a xcb::Event);
|
||||
+type PreeditDrawCB = dyn for<'a> FnMut(Window, PreeditInfo<'a>);
|
||||
+type NotifyCB = dyn FnMut(Window);
|
||||
|
||||
#[derive(Default)]
|
||||
struct Callbacks {
|
||||
@@ -403,24 +473,29 @@ impl ImeClient {
|
||||
/// [`set_forward_event_cb`]: ImeClient::set_forward_event_cb
|
||||
/// [`set_commit_string_cb`]: ImeClient::set_commit_string_cb
|
||||
/// [`set_preedit_draw_cb`]: ImeClient::set_preedit_draw_cb
|
||||
- pub fn process_event(&mut self, event: &xcb::GenericEvent) -> bool {
|
||||
- if !unsafe { xcb_xim_filter_event(self.im, event.ptr as _) } {
|
||||
- let mask = event.response_type() & !0x80;
|
||||
- if (mask == xcb::ffi::XCB_KEY_PRESS) || (mask == xcb::ffi::XCB_KEY_RELEASE) {
|
||||
- match self.ic {
|
||||
- Some(ic) => {
|
||||
- unsafe {
|
||||
- xcb_xim_forward_event(self.im, ic, event.ptr as _);
|
||||
+ pub fn process_event(&mut self, event: &xcb::Event) -> bool {
|
||||
+ match raw_event(event) {
|
||||
+ None => false,
|
||||
+ Some(raw) => {
|
||||
+ if !unsafe { xcb_xim_filter_event(self.im, raw as _) } {
|
||||
+ let mask = unsafe { (*raw).response_type & !0x80 };
|
||||
+ if (mask == XCB_KEY_PRESS) || (mask == XCB_KEY_RELEASE) {
|
||||
+ match self.ic {
|
||||
+ Some(ic) => {
|
||||
+ unsafe {
|
||||
+ xcb_xim_forward_event(self.im, ic, raw as _);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ _ => {
|
||||
+ self.try_open_ic();
|
||||
+ }
|
||||
}
|
||||
- return true;
|
||||
- }
|
||||
- _ => {
|
||||
- self.try_open_ic();
|
||||
}
|
||||
}
|
||||
+ false
|
||||
}
|
||||
}
|
||||
- false
|
||||
}
|
||||
|
||||
/// Set the position at which to place the IME window.
|
||||
@@ -431,8 +506,12 @@ impl ImeClient {
|
||||
/// Return `true` if an update for the IME window position has been sent to the IME, `false` if
|
||||
/// the update has been queued. If there is still an update request queued and this method is
|
||||
/// called, the previously queued request is discarded in favor of the new one.
|
||||
- pub fn update_pos(&mut self, win: u32, x: i16, y: i16) -> bool {
|
||||
- self.pos_req = ImePos { win, x, y };
|
||||
+ pub fn update_pos(&mut self, win: Window, x: i16, y: i16) -> bool {
|
||||
+ self.pos_req = ImePos {
|
||||
+ win: win.resource_id(),
|
||||
+ x,
|
||||
+ y,
|
||||
+ };
|
||||
match self.ic {
|
||||
Some(ic) => {
|
||||
if self.is_processing_pos_update {
|
||||
@@ -504,7 +583,7 @@ impl ImeClient {
|
||||
/// [`update_pos`]: ImeClient::update_pos
|
||||
pub fn set_commit_string_cb<F>(&mut self, f: F)
|
||||
where
|
||||
- F: for<'a> FnMut(u32, &'a str) + 'static,
|
||||
+ F: for<'a> FnMut(Window, &'a str) + 'static,
|
||||
{
|
||||
self.callbacks.commit_string = Some(Box::new(f));
|
||||
}
|
||||
@@ -520,7 +599,7 @@ impl ImeClient {
|
||||
/// [`update_pos`]: ImeClient::update_pos
|
||||
pub fn set_forward_event_cb<F>(&mut self, f: F)
|
||||
where
|
||||
- F: for<'a> FnMut(u32, &'a xcb::KeyPressEvent) + 'static,
|
||||
+ F: for<'a> FnMut(Window, &'a xcb::Event) + 'static,
|
||||
{
|
||||
self.callbacks.forward_event = Some(Box::new(f));
|
||||
}
|
||||
@@ -533,7 +612,7 @@ impl ImeClient {
|
||||
/// [`update_pos`]: ImeClient::update_pos
|
||||
pub fn set_preedit_start_cb<F>(&mut self, f: F)
|
||||
where
|
||||
- F: FnMut(u32) + 'static,
|
||||
+ F: FnMut(Window) + 'static,
|
||||
{
|
||||
self.callbacks.preedit_start = Some(Box::new(f));
|
||||
}
|
||||
@@ -547,7 +626,7 @@ impl ImeClient {
|
||||
/// [`update_pos`]: ImeClient::update_pos
|
||||
pub fn set_preedit_draw_cb<F>(&mut self, f: F)
|
||||
where
|
||||
- F: for<'a> FnMut(u32, PreeditInfo<'a>) + 'static,
|
||||
+ F: for<'a> FnMut(Window, PreeditInfo<'a>) + 'static,
|
||||
{
|
||||
self.callbacks.preedit_draw = Some(Box::new(f));
|
||||
}
|
||||
@@ -560,7 +639,7 @@ impl ImeClient {
|
||||
/// [`update_pos`]: ImeClient::update_pos
|
||||
pub fn set_preedit_done_cb<F>(&mut self, f: F)
|
||||
where
|
||||
- F: FnMut(u32) + 'static,
|
||||
+ F: FnMut(Window) + 'static,
|
||||
{
|
||||
self.callbacks.preedit_done = Some(Box::new(f));
|
||||
}
|
||||
124
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p2.patch
Normal file
124
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p2.patch
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
commit ede7c71b85fe2537efef6cf999a45690316211cf
|
||||
Author: Wez Furlong <wez@wezfurlong.org>
|
||||
Date: Sun May 8 13:51:09 2022 -0700
|
||||
|
||||
I submitted a PR to remove the as_raw wart
|
||||
|
||||
refs: https://github.com/rust-x-bindings/rust-xcb/pull/190
|
||||
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index b966a38..64c99cf 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -16,7 +16,7 @@ use std::os::raw::{c_char, c_void};
|
||||
use std::pin::Pin;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use xcb::x::Window;
|
||||
-use xcb::{Event, Raw, Xid, XidNew};
|
||||
+use xcb::{Raw, Xid, XidNew};
|
||||
|
||||
use bitflags::bitflags;
|
||||
|
||||
@@ -51,60 +51,6 @@ extern "C" fn create_ic_callback(im: *mut xcb_xim_t, new_ic: xcb_xic_t, user_dat
|
||||
}
|
||||
}
|
||||
|
||||
-fn raw_event(event: &Event) -> Option<*mut xcb::ffi::xcb_generic_event_t> {
|
||||
- match event {
|
||||
- Event::X(xcb::x::Event::KeyPress(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::KeyRelease(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ButtonPress(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ButtonRelease(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::MotionNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::EnterNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::LeaveNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::FocusIn(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::FocusOut(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::KeymapNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::Expose(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::GraphicsExposure(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::NoExposure(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::VisibilityNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::CreateNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::DestroyNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::UnmapNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::MapNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::MapRequest(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ReparentNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ConfigureNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ConfigureRequest(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::GravityNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ResizeRequest(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::CirculateNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::CirculateRequest(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::PropertyNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::SelectionClear(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::SelectionRequest(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::SelectionNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ColormapNotify(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::ClientMessage(e)) => Some(e.as_raw()),
|
||||
- Event::X(xcb::x::Event::MappingNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Unknown(e) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::NewKeyboardNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::MapNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::StateNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::ControlsNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::IndicatorStateNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::IndicatorMapNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::NamesNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::CompatMapNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::BellNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::ActionMessage(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::AccessXNotify(e)) => Some(e.as_raw()),
|
||||
- Event::Xkb(xcb::xkb::Event::ExtensionDeviceNotify(e)) => Some(e.as_raw()),
|
||||
- // https://github.com/rust-x-bindings/rust-xcb/issues/188
|
||||
- #[allow(unreachable_patterns)]
|
||||
- _ => None,
|
||||
- }
|
||||
-}
|
||||
-
|
||||
extern "C" fn open_callback(im: *mut xcb_xim_t, user_data: *mut c_void) {
|
||||
let ime = unsafe { ime_from_user_data(user_data) };
|
||||
let input_style = ime.input_style.bits();
|
||||
@@ -474,28 +420,24 @@ impl ImeClient {
|
||||
/// [`set_commit_string_cb`]: ImeClient::set_commit_string_cb
|
||||
/// [`set_preedit_draw_cb`]: ImeClient::set_preedit_draw_cb
|
||||
pub fn process_event(&mut self, event: &xcb::Event) -> bool {
|
||||
- match raw_event(event) {
|
||||
- None => false,
|
||||
- Some(raw) => {
|
||||
- if !unsafe { xcb_xim_filter_event(self.im, raw as _) } {
|
||||
- let mask = unsafe { (*raw).response_type & !0x80 };
|
||||
- if (mask == XCB_KEY_PRESS) || (mask == XCB_KEY_RELEASE) {
|
||||
- match self.ic {
|
||||
- Some(ic) => {
|
||||
- unsafe {
|
||||
- xcb_xim_forward_event(self.im, ic, raw as _);
|
||||
- }
|
||||
- return true;
|
||||
- }
|
||||
- _ => {
|
||||
- self.try_open_ic();
|
||||
- }
|
||||
+ let raw = event.as_raw();
|
||||
+ if !unsafe { xcb_xim_filter_event(self.im, raw as _) } {
|
||||
+ let mask = unsafe { (*raw).response_type & !0x80 };
|
||||
+ if (mask == XCB_KEY_PRESS) || (mask == XCB_KEY_RELEASE) {
|
||||
+ match self.ic {
|
||||
+ Some(ic) => {
|
||||
+ unsafe {
|
||||
+ xcb_xim_forward_event(self.im, ic, raw as _);
|
||||
}
|
||||
+ return true;
|
||||
+ }
|
||||
+ _ => {
|
||||
+ self.try_open_ic();
|
||||
}
|
||||
}
|
||||
- false
|
||||
}
|
||||
}
|
||||
+ false
|
||||
}
|
||||
|
||||
/// Set the position at which to place the IME window.
|
||||
12
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p3-xcb-1.3.patch
Normal file
12
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p3-xcb-1.3.patch
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
--- xcb-imdkit-0.1.2-orig/Cargo.toml 1970-01-01 10:00:01.000000000 +1000
|
||||
+++ xcb-imdkit-0.1.2/Cargo.toml 2024-03-03 17:13:21.554501365 +1100
|
||||
@@ -36,7 +36,8 @@
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.xcb]
|
||||
-version = "0.9.0"
|
||||
+version = "1.3"
|
||||
+features = ["xkb"]
|
||||
[build-dependencies.cc]
|
||||
version = "1.0"
|
||||
|
||||
276
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p4.patch
Normal file
276
x11-terms/wezterm/files/xcb-imdkit-0.1.2-p4.patch
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
commit 9ba1522493167c2430f20b06597240bd00bebd81
|
||||
Author: kumattau <kumattau@gmail.com>
|
||||
Date: Sun May 29 14:15:52 2022 +0900
|
||||
|
||||
Expose feedback_array
|
||||
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index 64c99cf..4f128d4 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -278,6 +278,16 @@ impl<'a> PreeditInfo<'a> {
|
||||
)
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /// Feedback array of preedit string.
|
||||
+ pub fn feedback_array(&self) -> &[u32] {
|
||||
+ unsafe {
|
||||
+ std::slice::from_raw_parts(
|
||||
+ self.inner.feedback_array.items,
|
||||
+ self.inner.feedback_array.size as usize,
|
||||
+ )
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
impl<'a> std::fmt::Debug for PreeditInfo<'a> {
|
||||
|
||||
commit 0f8a95d5de495d6cbbfff79d4e6ca83f4004779e
|
||||
Merge: 3465b98 ede7c71
|
||||
Author: HMH <H-M-H@users.noreply.github.com>
|
||||
Date: Wed Jun 8 03:46:16 2022 +0200
|
||||
|
||||
Merge pull request #2 from wez/master
|
||||
|
||||
Update for xcb 1.1
|
||||
|
||||
commit 82c228f177e1dbce3b15fb113b91761fd79cf711
|
||||
Merge: 0f8a95d 9ba1522
|
||||
Author: HMH <henry@freedesk.net>
|
||||
Date: Wed Jun 8 03:54:56 2022 +0200
|
||||
|
||||
Merge branch 'kumattau-master'
|
||||
|
||||
Expose feedback_array.
|
||||
|
||||
commit 09629568a992a43931478fedcdaedb5feeac58dc
|
||||
Author: HMH <henry@freedesk.net>
|
||||
Date: Wed Jun 8 04:00:33 2022 +0200
|
||||
|
||||
Add feedback_array to debug output of PreeditInfo.
|
||||
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index 4f128d4..272d1e9 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -297,6 +297,7 @@ impl<'a> std::fmt::Debug for PreeditInfo<'a> {
|
||||
.field("caret", &self.caret())
|
||||
.field("chg_first", &self.chg_first())
|
||||
.field("chg_length", &self.chg_length())
|
||||
+ .field("feedback_array", &self.feedback_array())
|
||||
.field("text", &self.text());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
commit c6859ab2b8a233ca5dda5e8e4f1634d34ce9c85c
|
||||
Author: Wez Furlong <wez@wezfurlong.org>
|
||||
Date: Mon Dec 19 12:20:11 2022 -0700
|
||||
|
||||
Potential fix for disconnected IME
|
||||
|
||||
refs: https://github.com/H-M-H/xcb-imdkit-rs/issues/5
|
||||
refs: https://github.com/wez/wezterm/issues/2819
|
||||
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index 272d1e9..a2b42e1 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -111,6 +111,14 @@ unsafe fn ime_from_user_data(user_data: *mut c_void) -> &'static mut ImeClient {
|
||||
&mut *(user_data as *mut ImeClient)
|
||||
}
|
||||
|
||||
+extern "C" fn disconnected_callback(
|
||||
+ _im: *mut xcb_xim_t,
|
||||
+ user_data: *mut c_void,
|
||||
+) {
|
||||
+ let ime = unsafe { ime_from_user_data(user_data) };
|
||||
+ ime.ic.take();
|
||||
+}
|
||||
+
|
||||
extern "C" fn commit_string_callback(
|
||||
im: *mut xcb_xim_t,
|
||||
_ic: xcb_xic_t,
|
||||
@@ -388,6 +396,7 @@ impl ImeClient {
|
||||
pos_update_queued: false,
|
||||
});
|
||||
let callbacks = xcb_xim_im_callback {
|
||||
+ disconnected: Some(disconnected_callback),
|
||||
commit_string: Some(commit_string_callback),
|
||||
forward_event: Some(forward_event_callback),
|
||||
preedit_start: Some(preedit_start_callback),
|
||||
|
||||
commit 1ae2900415a65187dcf85324fb755b3be6ab1f91
|
||||
Author: kumattau <kumattau@gmail.com>
|
||||
Date: Tue Oct 4 02:06:56 2022 +0900
|
||||
|
||||
Expose xcb_im_feedback_t
|
||||
|
||||
diff --git a/bindgen.sh b/bindgen.sh
|
||||
index 9d0c00d..632e678 100755
|
||||
--- a/bindgen.sh
|
||||
+++ b/bindgen.sh
|
||||
@@ -5,6 +5,7 @@ WHITELIST='(xcb|XCB)_(xim|XIM|im|xic)_.*|xcb_compound_text.*|xcb_utf8_to_compoun
|
||||
bindgen \
|
||||
--allowlist-function "$WHITELIST" \
|
||||
--allowlist-type "_xcb_im_style_t" \
|
||||
+ --allowlist-type "xcb_im_feedback_t" \
|
||||
--allowlist-var "$WHITELIST" \
|
||||
--size_t-is-usize \
|
||||
--no-layout-tests \
|
||||
diff --git a/src/bindings.rs b/src/bindings.rs
|
||||
index 7870365..31793c9 100644
|
||||
--- a/src/bindings.rs
|
||||
+++ b/src/bindings.rs
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* automatically generated by rust-bindgen 0.59.1 */
|
||||
+/* automatically generated by rust-bindgen 0.60.1 */
|
||||
|
||||
pub const XCB_XIM_CM_DATA_SIZE: u32 = 20;
|
||||
pub const XCB_XIM_PROTOCOLMAJORVERSION: u32 = 0;
|
||||
@@ -61,24 +61,24 @@ pub const XCB_XIM_EXTENSION: u32 = 128;
|
||||
pub const XCB_XIM_EXT_SET_EVENT_MASK: u32 = 48;
|
||||
pub const XCB_XIM_EXT_FORWARD_KEYEVENT: u32 = 50;
|
||||
pub const XCB_XIM_EXT_MOVE: u32 = 51;
|
||||
-pub const XCB_XIM_XNQueryInputStyle: &'static [u8; 16usize] = b"queryInputStyle\0";
|
||||
-pub const XCB_XIM_XNClientWindow: &'static [u8; 13usize] = b"clientWindow\0";
|
||||
-pub const XCB_XIM_XNInputStyle: &'static [u8; 11usize] = b"inputStyle\0";
|
||||
-pub const XCB_XIM_XNFocusWindow: &'static [u8; 12usize] = b"focusWindow\0";
|
||||
-pub const XCB_XIM_XNFilterEvents: &'static [u8; 13usize] = b"filterEvents\0";
|
||||
-pub const XCB_XIM_XNPreeditAttributes: &'static [u8; 18usize] = b"preeditAttributes\0";
|
||||
-pub const XCB_XIM_XNStatusAttributes: &'static [u8; 17usize] = b"statusAttributes\0";
|
||||
-pub const XCB_XIM_XNArea: &'static [u8; 5usize] = b"area\0";
|
||||
-pub const XCB_XIM_XNAreaNeeded: &'static [u8; 11usize] = b"areaNeeded\0";
|
||||
-pub const XCB_XIM_XNSpotLocation: &'static [u8; 13usize] = b"spotLocation\0";
|
||||
-pub const XCB_XIM_XNColormap: &'static [u8; 9usize] = b"colorMap\0";
|
||||
-pub const XCB_XIM_XNStdColormap: &'static [u8; 12usize] = b"stdColorMap\0";
|
||||
-pub const XCB_XIM_XNForeground: &'static [u8; 11usize] = b"foreground\0";
|
||||
-pub const XCB_XIM_XNBackground: &'static [u8; 11usize] = b"background\0";
|
||||
-pub const XCB_XIM_XNBackgroundPixmap: &'static [u8; 17usize] = b"backgroundPixmap\0";
|
||||
-pub const XCB_XIM_XNFontSet: &'static [u8; 8usize] = b"fontSet\0";
|
||||
-pub const XCB_XIM_XNLineSpace: &'static [u8; 10usize] = b"lineSpace\0";
|
||||
-pub const XCB_XIM_XNSeparatorofNestedList: &'static [u8; 22usize] = b"separatorofNestedList\0";
|
||||
+pub const XCB_XIM_XNQueryInputStyle: &[u8; 16usize] = b"queryInputStyle\0";
|
||||
+pub const XCB_XIM_XNClientWindow: &[u8; 13usize] = b"clientWindow\0";
|
||||
+pub const XCB_XIM_XNInputStyle: &[u8; 11usize] = b"inputStyle\0";
|
||||
+pub const XCB_XIM_XNFocusWindow: &[u8; 12usize] = b"focusWindow\0";
|
||||
+pub const XCB_XIM_XNFilterEvents: &[u8; 13usize] = b"filterEvents\0";
|
||||
+pub const XCB_XIM_XNPreeditAttributes: &[u8; 18usize] = b"preeditAttributes\0";
|
||||
+pub const XCB_XIM_XNStatusAttributes: &[u8; 17usize] = b"statusAttributes\0";
|
||||
+pub const XCB_XIM_XNArea: &[u8; 5usize] = b"area\0";
|
||||
+pub const XCB_XIM_XNAreaNeeded: &[u8; 11usize] = b"areaNeeded\0";
|
||||
+pub const XCB_XIM_XNSpotLocation: &[u8; 13usize] = b"spotLocation\0";
|
||||
+pub const XCB_XIM_XNColormap: &[u8; 9usize] = b"colorMap\0";
|
||||
+pub const XCB_XIM_XNStdColormap: &[u8; 12usize] = b"stdColorMap\0";
|
||||
+pub const XCB_XIM_XNForeground: &[u8; 11usize] = b"foreground\0";
|
||||
+pub const XCB_XIM_XNBackground: &[u8; 11usize] = b"background\0";
|
||||
+pub const XCB_XIM_XNBackgroundPixmap: &[u8; 17usize] = b"backgroundPixmap\0";
|
||||
+pub const XCB_XIM_XNFontSet: &[u8; 8usize] = b"fontSet\0";
|
||||
+pub const XCB_XIM_XNLineSpace: &[u8; 10usize] = b"lineSpace\0";
|
||||
+pub const XCB_XIM_XNSeparatorofNestedList: &[u8; 22usize] = b"separatorofNestedList\0";
|
||||
pub type __uint8_t = ::std::os::raw::c_uchar;
|
||||
pub type __int16_t = ::std::os::raw::c_short;
|
||||
pub type __uint16_t = ::std::os::raw::c_ushort;
|
||||
@@ -2313,6 +2313,16 @@ pub const _xcb_im_style_t_XCB_IM_StatusCallbacks: _xcb_im_style_t = 512;
|
||||
pub const _xcb_im_style_t_XCB_IM_StatusNothing: _xcb_im_style_t = 1024;
|
||||
pub const _xcb_im_style_t_XCB_IM_StatusNone: _xcb_im_style_t = 2048;
|
||||
pub type _xcb_im_style_t = ::std::os::raw::c_uint;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_REVERSE: xcb_im_feedback_t = 1;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_UNDERLINE: xcb_im_feedback_t = 2;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_HIGHLIGHT: xcb_im_feedback_t = 4;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_PRIMARY: xcb_im_feedback_t = 32;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_SECONDARY: xcb_im_feedback_t = 64;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_TERTIARY: xcb_im_feedback_t = 128;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_FORWARD: xcb_im_feedback_t = 256;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_BACKWORD: xcb_im_feedback_t = 512;
|
||||
+pub const xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_CENTER: xcb_im_feedback_t = 1024;
|
||||
+pub type xcb_im_feedback_t = ::std::os::raw::c_uint;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _xcb_im_trigger_keys_t {
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index a2b42e1..d150bda 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -219,6 +219,21 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
+bitflags! {
|
||||
+ pub struct InputFeedback: u32 {
|
||||
+ const DEFAULT = 0;
|
||||
+ const REVERSE = xcb_im_feedback_t_XCB_XIM_REVERSE;
|
||||
+ const UNDERLINE = xcb_im_feedback_t_XCB_XIM_UNDERLINE;
|
||||
+ const HIGHLIGHT = xcb_im_feedback_t_XCB_XIM_HIGHLIGHT;
|
||||
+ const PRIMARY = xcb_im_feedback_t_XCB_XIM_PRIMARY;
|
||||
+ const SECONDARY = xcb_im_feedback_t_XCB_XIM_SECONDARY;
|
||||
+ const TERTIARY = xcb_im_feedback_t_XCB_XIM_TERTIARY;
|
||||
+ const VISIBLE_TO_FORWARD = xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_FORWARD;
|
||||
+ const VISIBLE_TO_BACKWORD = xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_BACKWORD;
|
||||
+ const VISIBLE_TO_CENTER = xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_CENTER;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
type StringCB = dyn for<'a> FnMut(Window, &'a str);
|
||||
type KeyPressCB = dyn for<'a> FnMut(Window, &'a xcb::Event);
|
||||
type PreeditDrawCB = dyn for<'a> FnMut(Window, PreeditInfo<'a>);
|
||||
|
||||
commit 7170c21711e54e7b66712bdf6edea7d8c894652d
|
||||
Author: kumattau <kumattau@gmail.com>
|
||||
Date: Sat Oct 8 00:11:53 2022 +0900
|
||||
|
||||
Add docs to InputFeedback
|
||||
|
||||
diff --git a/src/lib.rs b/src/lib.rs
|
||||
index d150bda..f899753 100644
|
||||
--- a/src/lib.rs
|
||||
+++ b/src/lib.rs
|
||||
@@ -220,16 +220,37 @@ bitflags! {
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
+ /// [`InputFeedback`] is feedback information to the preedit text.
|
||||
+ /// Each element in [`PreeditInfo::feedback_array`] is a bitmask represented by a value of [`InputFeedback`].
|
||||
pub struct InputFeedback: u32 {
|
||||
+ /// By default the preedit text should be drawn in normal manner.
|
||||
const DEFAULT = 0;
|
||||
+
|
||||
+ /// The preedit text should be drawn by swapping the foreground and background colors used to draw normal, unhighlighted characters.
|
||||
const REVERSE = xcb_im_feedback_t_XCB_XIM_REVERSE;
|
||||
+
|
||||
+ /// The preedit text should be underlined.
|
||||
const UNDERLINE = xcb_im_feedback_t_XCB_XIM_UNDERLINE;
|
||||
+
|
||||
+ /// The preedit text should be drawn in some unique manner that must be different from REVERSE and UNDERLINE.
|
||||
const HIGHLIGHT = xcb_im_feedback_t_XCB_XIM_HIGHLIGHT;
|
||||
+
|
||||
+ /// The preedit text should be drawn in some unique manner that must be different from REVERSE and UNDERLINE.
|
||||
const PRIMARY = xcb_im_feedback_t_XCB_XIM_PRIMARY;
|
||||
+
|
||||
+ /// The preedit text should be drawn in some unique manner that must be different from REVERSE and UNDERLINE.
|
||||
const SECONDARY = xcb_im_feedback_t_XCB_XIM_SECONDARY;
|
||||
+
|
||||
+ /// The preedit text should be drawn in some unique manner that must be different from REVERSE and UNDERLINE.
|
||||
const TERTIARY = xcb_im_feedback_t_XCB_XIM_TERTIARY;
|
||||
+
|
||||
+ /// The preedit text is preferably displayed in the primary draw direction from the caret position in the preedit area forward.
|
||||
const VISIBLE_TO_FORWARD = xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_FORWARD;
|
||||
+
|
||||
+ /// The preedit text is preferably displayed from the caret position in the preedit area backward, relative to the primary draw direction.
|
||||
const VISIBLE_TO_BACKWORD = xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_BACKWORD;
|
||||
+
|
||||
+ /// The preedit text is preferably displayed with the caret position in the preedit area centered.
|
||||
const VISIBLE_TO_CENTER = xcb_im_feedback_t_XCB_XIM_VISIBLE_TO_CENTER;
|
||||
}
|
||||
}
|
||||
@@ -302,7 +323,8 @@ impl<'a> PreeditInfo<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
- /// Feedback array of preedit string.
|
||||
+ /// Feedback information to each character of preedit text.
|
||||
+ /// Refer to [`InputFeedback`] for more details.
|
||||
pub fn feedback_array(&self) -> &[u32] {
|
||||
unsafe {
|
||||
std::slice::from_raw_parts(
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue