Skip to content

Commit 203dfd8

Browse files
authored
Update and replace unmaintained crates with changelog (#739)
* Update and replace unmaintained crates with changelog Update crate versions: - x11rb 0.11 → 0.13 - xim 0.2 → 0.4 - image 0.24 → 0.25 - imageproc 0.23 → 0.26 - mio 0.7 → 1.0 - egui/eframe 0.20 → 0.33 Replace unmaintained crates: - rusttype → ab_glyph (font rendering) - mio-timerfd → timerfd-mio (mio 1.0 compatible) - unic → unicode-properties (emoji detection) API migrations: - kime-xim: Use ab_glyph FontArc/PxScale instead of rusttype - kime-wayland: Adapt to timerfd-mio API changes - TimerFd::new() instead of TimerFd::new(ClockId::Monotonic) - set_timeout_oneshot() instead of set_timeout()/disarm() - set_timeout_interval(interval, interval) signature change - kime-candidate-window: Migrate to egui 0.33 API - ctx.input(|i| ...) closure pattern - ViewportCommand::Close instead of frame.close() - ViewportBuilder for window options - Arc<FontData> wrapper requirement - kime-engine-dict: Use unicode_properties::UnicodeEmoji trait * rustfmt * Update deny.toml - Add NCSA license to allow list - Add license clarification for epaint_default_fonts * adjust egui, xim for MSRV compatibility - egui/eframe: 0.33 → 0.31 (egui 0.33 requires Rust 1.88, CI uses 1.86) - imageproc: 0.26 → 0.25 (0.26 requires Rust 1.87) - xim: 0.4 → 0.5 (0.4 has Feedback::Underline bug) * Add Unicode-3.0 license to allow list ICU crates (icu_collections, icu_normalizer, etc.) use Unicode-3.0 license which is OSI-approved and compatible with GPL-3.0. * migrate deny.toml - cargo-deny v0.16+ format * deny.toml change config * deny.toml modify * deny.toml modify 2 * deny.toml modify 3 * crates version config * crates version config 2 * fix timerfd-mio API usage for timer handling - Use disarm() directly instead of set_timeout_oneshot(Duration::ZERO) - Handle timer.read() returning 0 in non-blocking mode (spurious wakeup) - Add error logging when input_method_v2 fails before falling back to v1 * fix 2 disarm is call unwrap() so rollback to set_timeout_oneshot * Update changelog (version)
1 parent 230a8cd commit 203dfd8

File tree

14 files changed

+2057
-1653
lines changed

14 files changed

+2057
-1653
lines changed

Cargo.lock

Lines changed: 1962 additions & 1587 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deny.toml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ allow = [
8181
"Zlib",
8282
"ISC",
8383
"BSL-1.0",
84-
"GPL-3.0",
84+
"MPL-2.0",
8585
"Unicode-DFS-2016",
86+
"Unicode-3.0",
8687
"OFL-1.1",
87-
"LicenseRef-UFL-1.0",
8888
"Unlicense",
89+
"NCSA",
8990
]
9091
# List of explicitly disallowed licenses
9192
# See https://spdx.org/licenses/ for list of possible licenses
@@ -123,6 +124,15 @@ exceptions = [
123124
# Some crates don't have (easily) machine readable licensing information,
124125
# adding a clarification entry for it allows you to manually specify the
125126
# licensing information
127+
128+
# epaint_default_fonts uses "Ubuntu-font-1.0" which isn't a standard SPDX identifier
129+
# The actual licenses are MIT OR Apache-2.0 for code, OFL-1.1 for fonts
130+
[[licenses.clarify]]
131+
name = "epaint_default_fonts"
132+
version = "*"
133+
expression = "(MIT OR Apache-2.0) AND OFL-1.1"
134+
license-files = []
135+
126136
#[[licenses.clarify]]
127137
# The name of the crate the clarification applies to
128138
#name = "ring"
@@ -187,7 +197,6 @@ skip = [
187197
# dependencies starting at the specified crate, up to a certain depth, which is
188198
# by default infinite
189199
skip-tree = [
190-
{ name = "criterion", version = "=0.3.5" }
191200
]
192201

193202
# This section is considered when running `cargo deny check sources`.
@@ -212,4 +221,4 @@ github = []
212221
# 1 or more gitlab.com organizations to allow git sources for
213222
gitlab = []
214223
# 1 or more bitbucket.org organizations to allow git sources for
215-
bitbucket = []
224+
bitbucket = []

docs/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
* feat(engine): Let default `Alt_R` hotkey accept `Alt` modifier [#719](https://github.com/Riey/kime/719)
1414
* Add Opensuse Build Service repository and modify README
1515
* fix(xim): handle None from from_hardware_code without panic [#721](https://github.com/Riey/kime/721)
16+
* Update dependencies:
17+
- bitflags 2.10, nix 0.30, strum 0.27
18+
- x11rb 0.13, xim 0.5, image 0.25, imageproc 0.25
19+
- mio 1.0 with timerfd-mio
20+
- egui/eframe 0.33
21+
- Replace rusttype with ab_glyph
22+
- Replace ansi_term with owo-colors
23+
- Replace daemonize with nix daemon
24+
- Replace unic with unicode-properties
1625

1726
## 3.1.1
1827

src/engine/dict/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ serde = {version = "1.0.118", features = ["derive"]}
1010
serde_json = "1.0"
1111
itertools = "0.13.0"
1212
quick-xml = { version = "0.27.1", features = ["encoding"] }
13-
unic = "0.9.0"
13+
unicode-properties = { version = "0.1", features = ["emoji"] }

src/engine/dict/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::{
1111
mem,
1212
path::PathBuf,
1313
};
14-
use unic::emoji::char::is_emoji;
14+
use unicode_properties::UnicodeEmoji;
1515

1616
#[derive(Default, Debug, Clone, Copy)]
1717
struct HanjaEntry {
@@ -204,7 +204,7 @@ fn main() {
204204
)
205205
.unwrap();
206206
for entry in load_unicode_annotations().unwrap() {
207-
if !entry.cp.chars().any(|c| is_emoji(c)) {
207+
if !entry.cp.chars().any(|c| c.is_emoji_char()) {
208208
continue;
209209
}
210210

src/frontends/wayland/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ xkbcommon = { version = "0.7.0", features = ["wayland"] }
2020
libc = "0.2"
2121
log = "0.4"
2222
pico-args = "0.5"
23-
mio = { version = "0.7", features = ["os-ext"] }
24-
mio-timerfd = "0.2"
23+
mio = { version = "1.0", features = ["os-ext"] }
24+
timerfd-mio = "0.1"

src/frontends/wayland/src/input_method_v1.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use wayland_protocols::unstable::input_method::v1::client::{
1818
};
1919

2020
use mio::{unix::SourceFd, Events as MioEvents, Interest, Poll, Token};
21-
use mio_timerfd::{ClockId, TimerFd};
21+
use timerfd_mio::TimerFd;
2222
use wayland_client::protocol::wl_keyboard::KeymapFormat;
2323
use xkbcommon::xkb::{
2424
Context, Keycode, Keymap, CONTEXT_NO_FLAGS, KEYMAP_COMPILE_NO_FLAGS, KEYMAP_FORMAT_TEXT_V1,
@@ -205,7 +205,7 @@ impl KimeContext {
205205
if !press_state.is_pressing(key) =>
206206
{
207207
let duration = Duration::from_millis(info.delay as u64);
208-
if let Err(e) = self.timer.set_timeout(&duration) {
208+
if let Err(e) = self.timer.set_timeout_oneshot(duration) {
209209
log::warn!("failed to set repeat timer: {}", e);
210210
}
211211
*press_state = PressState::Pressing {
@@ -228,9 +228,7 @@ impl KimeContext {
228228
} else {
229229
if let Some((.., ref mut press_state)) = self.repeat_state {
230230
if press_state.is_pressing(key) {
231-
if let Err(e) = self.timer.disarm() {
232-
log::warn!("failed to disarm timer: {}", e);
233-
}
231+
let _ = self.timer.set_timeout_oneshot(Duration::ZERO);
234232
*press_state = PressState::NotPressing;
235233
}
236234
}
@@ -287,6 +285,10 @@ impl KimeContext {
287285
pub fn handle_timer_ev(&mut self) -> std::io::Result<()> {
288286
// Read timer, this MUST be called or timer will be broken
289287
let overrun_count = self.timer.read()?;
288+
if overrun_count == 0 {
289+
// Non-blocking read returned no expirations, skip processing
290+
return Ok(());
291+
}
290292
if overrun_count != 1 {
291293
log::warn!("Some timer events were not properly handled!");
292294
}
@@ -309,8 +311,8 @@ impl KimeContext {
309311
{
310312
// Start repeat
311313
log::trace!("Start repeating {}", key);
312-
let interval = &Duration::from_secs_f64(1.0 / info.rate as f64);
313-
self.timer.set_timeout_interval(interval)?;
314+
let interval = Duration::from_secs_f64(1.0 / info.rate as f64);
315+
self.timer.set_timeout_interval(interval, interval)?;
314316
*is_repeating = true;
315317
}
316318
}
@@ -368,7 +370,7 @@ impl KimeContext {
368370
self.grab_activate = false;
369371

370372
// Input deactivated, stop repeating
371-
self.timer.disarm().unwrap();
373+
let _ = self.timer.set_timeout_oneshot(Duration::ZERO);
372374
if let Some((_, ref mut press_state)) = self.repeat_state {
373375
*press_state = PressState::NotPressing
374376
}
@@ -412,7 +414,7 @@ pub fn run(
412414
let im = globals.instantiate_exact::<ZwpInputMethodV1>(1)?;
413415
im.assign(im_filter);
414416

415-
let mut timer = TimerFd::new(ClockId::Monotonic).expect("Initialize timer");
417+
let mut timer = TimerFd::new().expect("Initialize timer");
416418

417419
let mut poll = Poll::new().expect("Initialize epoll()");
418420
let registry = poll.registry();

src/frontends/wayland/src/input_method_v2.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use zwp_virtual_keyboard::virtual_keyboard_unstable_v1::{
2222
};
2323

2424
use mio::{unix::SourceFd, Events as MioEvents, Interest, Poll, Token};
25-
use mio_timerfd::{ClockId, TimerFd};
25+
use timerfd_mio::TimerFd;
2626

2727
use crate::{PressState, RepeatInfo};
2828

@@ -192,7 +192,7 @@ impl KimeContext {
192192
self.grab_activate = false;
193193

194194
// Input deactivated, stop repeating
195-
self.timer.disarm().unwrap();
195+
let _ = self.timer.set_timeout_oneshot(Duration::ZERO);
196196
if let Some((_, ref mut press_state)) = self.repeat_state {
197197
*press_state = PressState::NotPressing
198198
}
@@ -241,7 +241,7 @@ impl KimeContext {
241241
if !press_state.is_pressing(key) =>
242242
{
243243
let duration = Duration::from_millis(info.delay as u64);
244-
if let Err(e) = self.timer.set_timeout(&duration) {
244+
if let Err(e) = self.timer.set_timeout_oneshot(duration) {
245245
log::warn!("failed to set repeat timer: {}", e);
246246
}
247247
*press_state = PressState::Pressing {
@@ -267,9 +267,7 @@ impl KimeContext {
267267
// If user released the last pressed key, clear the timer and state
268268
if let Some((.., ref mut press_state)) = self.repeat_state {
269269
if press_state.is_pressing(key) {
270-
if let Err(e) = self.timer.disarm() {
271-
log::warn!("failed to disarm timer: {}", e);
272-
}
270+
let _ = self.timer.set_timeout_oneshot(Duration::ZERO);
273271
*press_state = PressState::NotPressing;
274272
}
275273
}
@@ -323,6 +321,10 @@ impl KimeContext {
323321
pub fn handle_timer_ev(&mut self) -> std::io::Result<()> {
324322
// Read timer, this MUST be called or timer will be broken
325323
let overrun_count = self.timer.read()?;
324+
if overrun_count == 0 {
325+
// Non-blocking read returned no expirations, skip processing
326+
return Ok(());
327+
}
326328
if overrun_count != 1 {
327329
log::warn!("Some timer events were not properly handled!");
328330
}
@@ -340,8 +342,8 @@ impl KimeContext {
340342
if !*is_repeating {
341343
// Start repeat
342344
log::trace!("Start repeating {}", key);
343-
let interval = &Duration::from_secs_f64(1.0 / info.rate as f64);
344-
self.timer.set_timeout_interval(interval)?;
345+
let interval = Duration::from_secs_f64(1.0 / info.rate as f64);
346+
self.timer.set_timeout_interval(interval, interval)?;
345347
*is_repeating = true;
346348
}
347349

@@ -390,7 +392,7 @@ pub fn run(
390392
im.assign(filter);
391393

392394
// Initialize timer
393-
let mut timer = TimerFd::new(ClockId::Monotonic).expect("Initialize timer");
395+
let mut timer = TimerFd::new().expect("Initialize timer");
394396

395397
// Initialize epoll() object
396398
let mut poll = Poll::new().expect("Initialize epoll()");

src/frontends/wayland/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ fn main() {
1212

1313
let result = kime_wayland::input_method_v2::run(&display, &mut event_queue, &globals);
1414

15-
if let Err(_) = result {
15+
if let Err(e) = result {
16+
log::warn!("input_method_v2 failed: {}, trying v1", e);
1617
kime_wayland::input_method_v1::run(&display, &mut event_queue, &globals).unwrap();
1718
}
1819
}

src/frontends/xim/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ license = "GPL-3.0-or-later"
1010
kime-engine-core = { path = "../../engine/core" }
1111
kime-version = { path = "../../tools/version" }
1212

13-
xim = { version = "0.2", default-features = false, features = ["x11rb-server"] }
13+
xim = { version = "0.5", default-features = false, features = ["x11rb-server"] }
1414
# xim = { path = "../../../../xim-rs", default-features = false, features = ["x11rb-server", "x11rb-xcb"] }
1515

1616
ahash = "0.8"
1717
log = "0.4"
18-
x11rb = { version = "0.11.0", features = [
18+
x11rb = { version = "0.13", features = [
1919
"render",
2020
"image",
2121
], default-features = false }
2222
pico-args = "0.5.0"
23-
image = "0.24"
24-
imageproc = "0.23"
25-
rusttype = "0.9.2"
23+
image = { version = "0.25", default-features = false, features = ["png"] }
24+
imageproc = { version = "0.25", default-features = false }
25+
ab_glyph = "0.2"

0 commit comments

Comments
 (0)