@@ -14,8 +14,7 @@ use super::runner::{EventWrapper, Execution};
1414use super :: window:: WindowId ;
1515use super :: { backend, runner, EventLoopProxy } ;
1616use crate :: event:: {
17- CursorType , DeviceId as RootDeviceId , ElementState , Event , KeyEvent , Touch , TouchPhase ,
18- WindowEvent ,
17+ DeviceId as RootDeviceId , ElementState , Event , KeyEvent , Touch , TouchPhase , WindowEvent ,
1918} ;
2019use crate :: event_loop:: { ControlFlow , DeviceEvents } ;
2120use crate :: keyboard:: ModifiersState ;
@@ -297,18 +296,16 @@ impl ActiveEventLoop {
297296 }
298297 } ) ;
299298
300- runner. send_events ( modifiers. into_iter ( ) . chain ( events. flat_map ( |position| {
301- let device_id = RootDeviceId ( DeviceId ( pointer_id) ) ;
299+ runner. send_events ( modifiers. into_iter ( ) . chain ( events. flat_map (
300+ |( position, r#type) | {
301+ let device_id = RootDeviceId ( DeviceId ( pointer_id) ) ;
302302
303- iter:: once ( Event :: WindowEvent {
304- window_id : RootWindowId ( id) ,
305- event : WindowEvent :: CursorMoved {
306- device_id,
307- position,
308- r#type : CursorType :: Mouse ,
309- } ,
310- } )
311- } ) ) ) ;
303+ iter:: once ( Event :: WindowEvent {
304+ window_id : RootWindowId ( id) ,
305+ event : WindowEvent :: CursorMoved { device_id, position, r#type } ,
306+ } )
307+ } ,
308+ ) ) ) ;
312309 }
313310 } ,
314311 {
@@ -348,6 +345,7 @@ impl ActiveEventLoop {
348345 move |active_modifiers,
349346 pointer_id,
350347 position : crate :: dpi:: PhysicalPosition < f64 > ,
348+ r#type,
351349 buttons,
352350 button| {
353351 let modifiers =
@@ -373,11 +371,7 @@ impl ActiveEventLoop {
373371 runner. send_events ( modifiers. into_iter ( ) . chain ( [
374372 Event :: WindowEvent {
375373 window_id : RootWindowId ( id) ,
376- event : WindowEvent :: CursorMoved {
377- device_id,
378- position,
379- r#type : CursorType :: Mouse ,
380- } ,
374+ event : WindowEvent :: CursorMoved { device_id, position, r#type } ,
381375 } ,
382376 Event :: WindowEvent {
383377 window_id : RootWindowId ( id) ,
@@ -407,7 +401,7 @@ impl ActiveEventLoop {
407401 let runner = self . runner . clone ( ) ;
408402 let modifiers = self . modifiers . clone ( ) ;
409403
410- move |active_modifiers, pointer_id, position, button| {
404+ move |active_modifiers, pointer_id, position, r#type , button| {
411405 let modifiers = ( modifiers. get ( ) != active_modifiers) . then ( || {
412406 modifiers. set ( active_modifiers) ;
413407 Event :: WindowEvent {
@@ -424,18 +418,14 @@ impl ActiveEventLoop {
424418 runner. send_events ( modifiers. into_iter ( ) . chain ( [
425419 Event :: WindowEvent {
426420 window_id : RootWindowId ( id) ,
427- event : WindowEvent :: CursorMoved {
428- device_id,
429- position,
430- r#type : CursorType :: Mouse ,
431- } ,
421+ event : WindowEvent :: CursorMoved { device_id, position, r#type } ,
432422 } ,
433423 Event :: WindowEvent {
434424 window_id : RootWindowId ( id) ,
435425 event : WindowEvent :: CursorInput {
436426 device_id,
437427 state : ElementState :: Pressed ,
438- button : button . into ( ) ,
428+ button,
439429 } ,
440430 } ,
441431 ] ) ) ;
@@ -491,7 +481,7 @@ impl ActiveEventLoop {
491481 let has_focus = has_focus. clone ( ) ;
492482 let modifiers = self . modifiers . clone ( ) ;
493483
494- move |active_modifiers, pointer_id, position, button| {
484+ move |active_modifiers, pointer_id, position, r#type , button| {
495485 let modifiers =
496486 ( has_focus. get ( ) && modifiers. get ( ) != active_modifiers) . then ( || {
497487 modifiers. set ( active_modifiers) ;
@@ -509,18 +499,14 @@ impl ActiveEventLoop {
509499 runner. send_events ( modifiers. into_iter ( ) . chain ( [
510500 Event :: WindowEvent {
511501 window_id : RootWindowId ( id) ,
512- event : WindowEvent :: CursorMoved {
513- device_id,
514- position,
515- r#type : CursorType :: Mouse ,
516- } ,
502+ event : WindowEvent :: CursorMoved { device_id, position, r#type } ,
517503 } ,
518504 Event :: WindowEvent {
519505 window_id : RootWindowId ( id) ,
520506 event : WindowEvent :: CursorInput {
521507 device_id,
522508 state : ElementState :: Released ,
523- button : button . into ( ) ,
509+ button,
524510 } ,
525511 } ,
526512 ] ) ) ;
0 commit comments