You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/x11-terms/wezterm/files/xcb-imdkit-0.1.2-p4.patch

277 lines
11 KiB

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(