mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
feat: support IME cursor area (#35623)
* feat: support IME cursor area Signed-off-by: DK Liao <dklassic@gmail.com> * use winit::dpi for LogicalPosition instead Signed-off-by: DK Liao <dklassic@gmail.com> * perform ./mach fmt Signed-off-by: DK Liao <dklassic@gmail.com> --------- Signed-off-by: DK Liao <dklassic@gmail.com>
This commit is contained in:
parent
f3a8bf8ca2
commit
3f6b21d8e1
1 changed files with 12 additions and 2 deletions
|
@ -29,7 +29,7 @@ use servo::{
|
||||||
};
|
};
|
||||||
use surfman::{Context, Device};
|
use surfman::{Context, Device};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
use winit::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
|
||||||
use winit::event::{
|
use winit::event::{
|
||||||
ElementState, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, WindowEvent,
|
ElementState, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, WindowEvent,
|
||||||
};
|
};
|
||||||
|
@ -707,9 +707,19 @@ impl WindowPortsMethods for Window {
|
||||||
_input_type: servo::InputMethodType,
|
_input_type: servo::InputMethodType,
|
||||||
_text: Option<(String, i32)>,
|
_text: Option<(String, i32)>,
|
||||||
_multiline: bool,
|
_multiline: bool,
|
||||||
_position: servo::webrender_api::units::DeviceIntRect,
|
position: servo::webrender_api::units::DeviceIntRect,
|
||||||
) {
|
) {
|
||||||
self.winit_window.set_ime_allowed(true);
|
self.winit_window.set_ime_allowed(true);
|
||||||
|
self.winit_window.set_ime_cursor_area(
|
||||||
|
LogicalPosition::new(
|
||||||
|
position.min.x,
|
||||||
|
position.min.y + (self.toolbar_height.get().0 as i32),
|
||||||
|
),
|
||||||
|
LogicalSize::new(
|
||||||
|
position.max.x - position.min.x,
|
||||||
|
position.max.y - position.min.y,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hide_ime(&self) {
|
fn hide_ime(&self) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue