mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
chore: cleanup IME code for Servoshell (#35546)
Signed-off-by: DK Liao <dklassic@gmail.com>
This commit is contained in:
parent
5ff588429f
commit
7831bced76
1 changed files with 12 additions and 11 deletions
|
@ -23,7 +23,7 @@ use servo::servo_geometry::DeviceIndependentPixel;
|
||||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
|
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
|
||||||
use servo::webrender_api::ScrollLocation;
|
use servo::webrender_api::ScrollLocation;
|
||||||
use servo::{
|
use servo::{
|
||||||
Cursor, InputEvent, Key, KeyState, KeyboardEvent, MouseButton as ServoMouseButton,
|
Cursor, ImeEvent, InputEvent, Key, KeyState, KeyboardEvent, MouseButton as ServoMouseButton,
|
||||||
MouseButtonAction, MouseButtonEvent, MouseMoveEvent, OffscreenRenderingContext,
|
MouseButtonAction, MouseButtonEvent, MouseMoveEvent, OffscreenRenderingContext,
|
||||||
RenderingContext, Theme, TouchAction, TouchEvent, TouchEventType, TouchId, WebView, WheelDelta,
|
RenderingContext, Theme, TouchAction, TouchEvent, TouchEventType, TouchId, WebView, WheelDelta,
|
||||||
WheelEvent, WheelMode, WindowRenderingContext,
|
WheelEvent, WheelMode, WindowRenderingContext,
|
||||||
|
@ -32,7 +32,7 @@ use surfman::{Context, Device};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
||||||
use winit::event::{
|
use winit::event::{
|
||||||
ElementState, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, WindowEvent,
|
ElementState, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, WindowEvent,
|
||||||
};
|
};
|
||||||
use winit::event_loop::ActiveEventLoop;
|
use winit::event_loop::ActiveEventLoop;
|
||||||
use winit::keyboard::{Key as LogicalKey, ModifiersState, NamedKey};
|
use winit::keyboard::{Key as LogicalKey, ModifiersState, NamedKey};
|
||||||
|
@ -631,33 +631,33 @@ impl WindowPortsMethods for Window {
|
||||||
WindowEvent::Moved(_new_position) => {
|
WindowEvent::Moved(_new_position) => {
|
||||||
webview.notify_embedder_window_moved();
|
webview.notify_embedder_window_moved();
|
||||||
},
|
},
|
||||||
winit::event::WindowEvent::Ime(ime) => match ime {
|
WindowEvent::Ime(ime) => match ime {
|
||||||
winit::event::Ime::Enabled => {
|
Ime::Enabled => {
|
||||||
webview.notify_input_event(InputEvent::Ime(servo::ImeEvent::Composition(
|
webview.notify_input_event(InputEvent::Ime(ImeEvent::Composition(
|
||||||
servo::CompositionEvent {
|
servo::CompositionEvent {
|
||||||
state: servo::CompositionState::Start,
|
state: servo::CompositionState::Start,
|
||||||
data: String::new(),
|
data: String::new(),
|
||||||
},
|
},
|
||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
winit::event::Ime::Preedit(text, _) => {
|
Ime::Preedit(text, _) => {
|
||||||
webview.notify_input_event(InputEvent::Ime(servo::ImeEvent::Composition(
|
webview.notify_input_event(InputEvent::Ime(ImeEvent::Composition(
|
||||||
servo::CompositionEvent {
|
servo::CompositionEvent {
|
||||||
state: servo::CompositionState::Update,
|
state: servo::CompositionState::Update,
|
||||||
data: text,
|
data: text,
|
||||||
},
|
},
|
||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
winit::event::Ime::Commit(text) => {
|
Ime::Commit(text) => {
|
||||||
webview.notify_input_event(InputEvent::Ime(servo::ImeEvent::Composition(
|
webview.notify_input_event(InputEvent::Ime(ImeEvent::Composition(
|
||||||
servo::CompositionEvent {
|
servo::CompositionEvent {
|
||||||
state: servo::CompositionState::End,
|
state: servo::CompositionState::End,
|
||||||
data: text,
|
data: text,
|
||||||
},
|
},
|
||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
winit::event::Ime::Disabled => {
|
Ime::Disabled => {
|
||||||
webview.notify_input_event(InputEvent::Ime(servo::ImeEvent::Dismissed));
|
webview.notify_input_event(InputEvent::Ime(ImeEvent::Dismissed));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
@ -702,6 +702,7 @@ impl WindowPortsMethods for Window {
|
||||||
fn rendering_context(&self) -> Rc<dyn RenderingContext> {
|
fn rendering_context(&self) -> Rc<dyn RenderingContext> {
|
||||||
self.rendering_context.clone()
|
self.rendering_context.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_ime(
|
fn show_ime(
|
||||||
&self,
|
&self,
|
||||||
_input_type: servo::InputMethodType,
|
_input_type: servo::InputMethodType,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue