@@ -67,17 +67,6 @@ impl EventState {
67
67
self . mouse_grab . is_none ( ) && * w_id == self . hover
68
68
}
69
69
70
- /// Get whether widget `id` or any of its descendants are under the mouse cursor
71
- #[ inline]
72
- pub fn is_hovered_recursive ( & self , id : & Id ) -> bool {
73
- self . mouse_grab . is_none ( )
74
- && self
75
- . hover
76
- . as_ref ( )
77
- . map ( |h| id. is_ancestor_of ( h) )
78
- . unwrap_or ( false )
79
- }
80
-
81
70
/// Check whether the given widget is visually depressed
82
71
pub fn is_depressed ( & self , w_id : & Id ) -> bool {
83
72
for ( _, id) in & self . key_depress {
@@ -200,34 +189,35 @@ impl EventState {
200
189
/// Widget updates may be used for animation and timed responses. See also
201
190
/// [`Draw::animate`](crate::draw::Draw::animate) for animation.
202
191
///
203
- /// Widget `id` will receive [`Event::Timer`] with this `payload ` at
192
+ /// Widget `id` will receive [`Event::Timer`] with this `handle ` at
204
193
/// approximately `time = now + delay` (or possibly a little later due to
205
194
/// frame-rate limiters and processing time).
206
195
///
207
196
/// Requesting an update with `delay == 0` is valid, except from an
208
197
/// [`Event::Timer`] handler (where it may cause an infinite loop).
209
198
///
210
- /// Multiple timer requests with the same `id` and `payload ` are merged
211
- /// (choosing the earliest time ).
212
- pub fn request_timer ( & mut self , id : Id , payload : u64 , delay : Duration ) {
199
+ /// Multiple timer requests with the same `id` and `handle ` are merged
200
+ /// (see [`TimerHandle`] documentation ).
201
+ pub fn request_timer ( & mut self , id : Id , handle : TimerHandle , delay : Duration ) {
213
202
let time = Instant :: now ( ) + delay;
214
203
if let Some ( row) = self
215
204
. time_updates
216
205
. iter_mut ( )
217
- . find ( |row| row. 1 == id && row. 2 == payload )
206
+ . find ( |row| row. 1 == id && row. 2 == handle )
218
207
{
219
- if row. 0 <= time {
208
+ let earliest = handle. earliest ( ) ;
209
+ if earliest && row. 0 <= time || !earliest && row. 0 >= time {
220
210
return ;
221
211
}
222
212
223
213
row. 0 = time;
214
+ } else {
224
215
log:: trace!(
225
216
target: "kas_core::event" ,
226
217
"request_timer: update {id} at now+{}ms" ,
227
218
delay. as_millis( )
228
219
) ;
229
- } else {
230
- self . time_updates . push ( ( time, id, payload) ) ;
220
+ self . time_updates . push ( ( time, id, handle) ) ;
231
221
}
232
222
233
223
self . time_updates . sort_by ( |a, b| b. 0 . cmp ( & a. 0 ) ) ; // reverse sort
@@ -888,7 +878,6 @@ impl<'a> EventCx<'a> {
888
878
///
889
879
/// In case of failure, paste actions will simply fail. The implementation
890
880
/// may wish to log an appropriate warning message.
891
- #[ inline]
892
881
pub fn get_clipboard ( & mut self ) -> Option < String > {
893
882
#[ cfg( all( wayland_platform, feature = "clipboard" ) ) ]
894
883
if let Some ( cb) = self . window . wayland_clipboard ( ) {
@@ -905,7 +894,6 @@ impl<'a> EventCx<'a> {
905
894
}
906
895
907
896
/// Attempt to set clipboard contents
908
- #[ inline]
909
897
pub fn set_clipboard ( & mut self , content : String ) {
910
898
#[ cfg( all( wayland_platform, feature = "clipboard" ) ) ]
911
899
if let Some ( cb) = self . window . wayland_clipboard ( ) {
@@ -932,7 +920,6 @@ impl<'a> EventCx<'a> {
932
920
///
933
921
/// Linux has a "primary buffer" with implicit copy on text selection and
934
922
/// paste on middle-click. This method does nothing on other platforms.
935
- #[ inline]
936
923
pub fn get_primary ( & mut self ) -> Option < String > {
937
924
#[ cfg( all( wayland_platform, feature = "clipboard" ) ) ]
938
925
if let Some ( cb) = self . window . wayland_clipboard ( ) {
@@ -952,7 +939,6 @@ impl<'a> EventCx<'a> {
952
939
///
953
940
/// Linux has a "primary buffer" with implicit copy on text selection and
954
941
/// paste on middle-click. This method does nothing on other platforms.
955
- #[ inline]
956
942
pub fn set_primary ( & mut self , content : String ) {
957
943
#[ cfg( all( wayland_platform, feature = "clipboard" ) ) ]
958
944
if let Some ( cb) = self . window . wayland_clipboard ( ) {
0 commit comments