mirror of
https://github.com/danbulant/cushy
synced 2026-07-05 03:00:43 +00:00
Calling set_ime_cursor_location
Currently passing the entire input area because it's easy. Not closing the issue because the correct thing to do would be to constrain the location to a smaller area on the current line (or the current line). Refs #122
This commit is contained in:
parent
4dc5cb5cc4
commit
a3e76f6472
4 changed files with 20 additions and 2 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -738,9 +738,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "figures"
|
name = "figures"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "813f0f9e0ba0d378a8e2cd51df24dd724ba8fbc07baa3dd192813eeba407ea86"
|
checksum = "2c59ceec98cdba2db23e28e753cf7ff1e7e726d8655f3dce45f0e40820ae075e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"euclid",
|
"euclid",
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ image = { version = "0.24.7", features = ["png"] }
|
||||||
# kludgine = { path = "../kludgine" }
|
# kludgine = { path = "../kludgine" }
|
||||||
# [patch."https://github.com/khonsulabs/appit"]
|
# [patch."https://github.com/khonsulabs/appit"]
|
||||||
# appit = { path = "../appit" }
|
# appit = { path = "../appit" }
|
||||||
|
# [patch."https://github.com/khonsulabs/figures"]
|
||||||
|
# figures = { path = "../figures" }
|
||||||
|
|
||||||
[profile.dev.package."*"]
|
[profile.dev.package."*"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
|
|
|
||||||
|
|
@ -1057,6 +1057,7 @@ where
|
||||||
|
|
||||||
if context.focused(false) {
|
if context.focused(false) {
|
||||||
context.set_ime_allowed(true);
|
context.set_ime_allowed(true);
|
||||||
|
context.set_ime_location(context.gfx.region());
|
||||||
context.set_ime_purpose(if info.masked {
|
context.set_ime_purpose(if info.masked {
|
||||||
ImePurpose::Password
|
ImePurpose::Password
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,15 @@ pub trait PlatformWindowImplementation {
|
||||||
winit.set_ime_allowed(allowed);
|
winit.set_ime_allowed(allowed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// Sets the location of the cursor.
|
||||||
|
fn set_ime_location(&self, location: Rect<Px>) {
|
||||||
|
if let Some(winit) = self.winit() {
|
||||||
|
winit.set_ime_cursor_area(
|
||||||
|
PhysicalPosition::from(location.origin),
|
||||||
|
PhysicalSize::from(location.size),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets the current [`Ime`] purpose.
|
/// Sets the current [`Ime`] purpose.
|
||||||
///
|
///
|
||||||
|
|
@ -220,6 +229,8 @@ pub trait PlatformWindow {
|
||||||
/// Sets the current cursor icon to `cursor`.
|
/// Sets the current cursor icon to `cursor`.
|
||||||
fn set_cursor_icon(&mut self, cursor: CursorIcon);
|
fn set_cursor_icon(&mut self, cursor: CursorIcon);
|
||||||
|
|
||||||
|
/// Sets the location of the cursor.
|
||||||
|
fn set_ime_location(&self, location: Rect<Px>);
|
||||||
/// Sets whether [`Ime`] events should be enabled.
|
/// Sets whether [`Ime`] events should be enabled.
|
||||||
fn set_ime_allowed(&self, allowed: bool);
|
fn set_ime_allowed(&self, allowed: bool);
|
||||||
/// Sets the current [`Ime`] purpose.
|
/// Sets the current [`Ime`] purpose.
|
||||||
|
|
@ -422,6 +433,10 @@ where
|
||||||
fn request_inner_size(&mut self, inner_size: Size<UPx>) {
|
fn request_inner_size(&mut self, inner_size: Size<UPx>) {
|
||||||
self.window.request_inner_size(inner_size);
|
self.window.request_inner_size(inner_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_ime_location(&self, location: Rect<Px>) {
|
||||||
|
self.window.set_ime_location(location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The attributes of a Cushy window.
|
/// The attributes of a Cushy window.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue