@@ -21,31 +21,23 @@ unsafe fn send_native(event_type: &EventType, display: *mut xlib::Display) -> Op
2121 Button :: Left => xtest:: XTestFakeButtonEvent ( display, 1 , TRUE , 0 ) ,
2222 Button :: Middle => xtest:: XTestFakeButtonEvent ( display, 2 , TRUE , 0 ) ,
2323 Button :: Right => xtest:: XTestFakeButtonEvent ( display, 3 , TRUE , 0 ) ,
24- Button :: Unknown ( code) => {
25- xtest:: XTestFakeButtonEvent ( display, ( * code) . try_into ( ) . ok ( ) ?, TRUE , 0 )
26- }
24+ Button :: Unknown ( code) => xtest:: XTestFakeButtonEvent ( display, ( * code) . into ( ) , TRUE , 0 ) ,
2725 } ,
2826 EventType :: ButtonRelease ( button) => match button {
2927 Button :: Left => xtest:: XTestFakeButtonEvent ( display, 1 , FALSE , 0 ) ,
3028 Button :: Middle => xtest:: XTestFakeButtonEvent ( display, 2 , FALSE , 0 ) ,
3129 Button :: Right => xtest:: XTestFakeButtonEvent ( display, 3 , FALSE , 0 ) ,
32- Button :: Unknown ( code) => {
33- xtest:: XTestFakeButtonEvent ( display, ( * code) . try_into ( ) . ok ( ) ?, FALSE , 0 )
34- }
30+ Button :: Unknown ( code) => xtest:: XTestFakeButtonEvent ( display, ( * code) . into ( ) , FALSE , 0 ) ,
3531 } ,
3632 EventType :: MouseMove { x, y } => {
3733 //TODO: replace with clamp if it is stabalized
3834 let x = if x. is_finite ( ) {
39- x. min ( c_int:: max_value ( ) . into ( ) )
40- . max ( c_int:: min_value ( ) . into ( ) )
41- . round ( ) as c_int
35+ x. min ( c_int:: MAX . into ( ) ) . max ( c_int:: MIN . into ( ) ) . round ( ) as c_int
4236 } else {
4337 0
4438 } ;
4539 let y = if y. is_finite ( ) {
46- y. min ( c_int:: max_value ( ) . into ( ) )
47- . max ( c_int:: min_value ( ) . into ( ) )
48- . round ( ) as c_int
40+ y. min ( c_int:: MAX . into ( ) ) . max ( c_int:: MIN . into ( ) ) . round ( ) as c_int
4941 } else {
5042 0
5143 } ;
0 commit comments