diff options
author | 2024-10-25 15:40:05 +0200 | |
---|---|---|
committer | 2024-11-05 23:52:58 +0100 | |
commit | 752403d70c851ece620c4007710062b158e8dec3 (patch) | |
tree | 8d98a4100dec46c123edd3d3fa4966110da6003c /widget/src/text_input.rs | |
parent | 7fbc195b11f9a858bcc8f56f76907af82c966c26 (diff) | |
download | iced-752403d70c851ece620c4007710062b158e8dec3.tar.gz iced-752403d70c851ece620c4007710062b158e8dec3.tar.bz2 iced-752403d70c851ece620c4007710062b158e8dec3.zip |
Split `Shell::request_redraw` into two different methods
Diffstat (limited to 'widget/src/text_input.rs')
-rw-r--r-- | widget/src/text_input.rs | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs index c18009a2..8fa7889f 100644 --- a/widget/src/text_input.rs +++ b/widget/src/text_input.rs @@ -751,7 +751,7 @@ where state.last_click = Some(click); if cursor_before != state.cursor { - shell.request_redraw(window::RedrawRequest::NextFrame); + shell.request_redraw(); } return event::Status::Captured; @@ -806,7 +806,7 @@ where } if selection_before != state.cursor.selection(&value) { - shell.request_redraw(window::RedrawRequest::NextFrame); + shell.request_redraw(); } return event::Status::Captured; @@ -914,9 +914,7 @@ where if cursor_before != state.cursor { focus.updated_at = Instant::now(); - shell.request_redraw( - window::RedrawRequest::NextFrame, - ); + shell.request_redraw(); } return event::Status::Captured; @@ -1037,9 +1035,7 @@ where if cursor_before != state.cursor { focus.updated_at = Instant::now(); - shell.request_redraw( - window::RedrawRequest::NextFrame, - ); + shell.request_redraw(); } return event::Status::Captured; @@ -1059,9 +1055,7 @@ where if cursor_before != state.cursor { focus.updated_at = Instant::now(); - shell.request_redraw( - window::RedrawRequest::NextFrame, - ); + shell.request_redraw(); } return event::Status::Captured; @@ -1083,9 +1077,7 @@ where if cursor_before != state.cursor { focus.updated_at = Instant::now(); - shell.request_redraw( - window::RedrawRequest::NextFrame, - ); + shell.request_redraw(); } return event::Status::Captured; @@ -1107,9 +1099,7 @@ where if cursor_before != state.cursor { focus.updated_at = Instant::now(); - shell.request_redraw( - window::RedrawRequest::NextFrame, - ); + shell.request_redraw(); } return event::Status::Captured; @@ -1136,9 +1126,7 @@ where if cursor_before != state.cursor { focus.updated_at = Instant::now(); - shell.request_redraw( - window::RedrawRequest::NextFrame, - ); + shell.request_redraw(); } return event::Status::Captured; @@ -1165,9 +1153,7 @@ where if cursor_before != state.cursor { focus.updated_at = Instant::now(); - shell.request_redraw( - window::RedrawRequest::NextFrame, - ); + shell.request_redraw(); } return event::Status::Captured; @@ -1218,7 +1204,7 @@ where focus.is_window_focused = true; focus.updated_at = Instant::now(); - shell.request_redraw(window::RedrawRequest::NextFrame); + shell.request_redraw(); } } Event::Window(window::Event::RedrawRequested(now)) => { @@ -1237,11 +1223,11 @@ where - (*now - focus.updated_at).as_millis() % CURSOR_BLINK_INTERVAL_MILLIS; - shell.request_redraw(window::RedrawRequest::At( + shell.request_redraw_at( *now + Duration::from_millis( millis_until_redraw as u64, ), - )); + ); } } } @@ -1265,13 +1251,11 @@ where if let Event::Window(window::Event::RedrawRequested(_now)) = event { self.last_status = Some(status); - } else { - match self.last_status { - Some(last_status) if status != last_status => { - shell.request_redraw(window::RedrawRequest::NextFrame); - } - _ => {} - } + } else if self + .last_status + .is_some_and(|last_status| status != last_status) + { + shell.request_redraw(); } event::Status::Ignored |