Decouple mouse::Interaction from UserInterface::draw
This commit is contained in:
parent
87afd5b79d
commit
301aac794b
6 changed files with 171 additions and 187 deletions
|
|
@ -758,7 +758,7 @@ async fn run_instance<P>(
|
|||
&mut messages,
|
||||
);
|
||||
|
||||
let new_mouse_interaction = ui.draw(
|
||||
ui.draw(
|
||||
&mut window.renderer,
|
||||
window.state.theme(),
|
||||
&renderer::Style {
|
||||
|
|
@ -768,16 +768,6 @@ async fn run_instance<P>(
|
|||
);
|
||||
draw_span.finish();
|
||||
|
||||
if new_mouse_interaction != window.mouse_interaction {
|
||||
window.raw.set_cursor(
|
||||
conversion::mouse_interaction(
|
||||
new_mouse_interaction,
|
||||
),
|
||||
);
|
||||
|
||||
window.mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
|
||||
runtime.broadcast(subscription::Event::Interaction {
|
||||
window: id,
|
||||
event: redraw_event,
|
||||
|
|
@ -787,10 +777,12 @@ async fn run_instance<P>(
|
|||
if let user_interface::State::Updated {
|
||||
redraw_request,
|
||||
input_method,
|
||||
mouse_interaction,
|
||||
} = ui_state
|
||||
{
|
||||
window.request_redraw(redraw_request);
|
||||
window.request_input_method(input_method);
|
||||
window.update_mouse(mouse_interaction);
|
||||
}
|
||||
|
||||
window.draw_preedit();
|
||||
|
|
@ -944,8 +936,11 @@ async fn run_instance<P>(
|
|||
match ui_state {
|
||||
user_interface::State::Updated {
|
||||
redraw_request: _redraw_request,
|
||||
mouse_interaction,
|
||||
..
|
||||
} => {
|
||||
window.update_mouse(mouse_interaction);
|
||||
|
||||
#[cfg(not(
|
||||
feature = "unconditional-rendering"
|
||||
))]
|
||||
|
|
|
|||
|
|
@ -246,6 +246,15 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn update_mouse(&mut self, interaction: mouse::Interaction) {
|
||||
if interaction != self.mouse_interaction {
|
||||
self.raw
|
||||
.set_cursor(conversion::mouse_interaction(interaction));
|
||||
|
||||
self.mouse_interaction = interaction;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw_preedit(&mut self) {
|
||||
if let Some(preedit) = &self.preedit {
|
||||
preedit.draw(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue