@@ -18,7 +18,7 @@ use std::convert::TryInto;
1818use crate :: activity_impl:: ffi:: { GameActivityKeyEvent , GameActivityMotionEvent } ;
1919use crate :: input:: {
2020 Axis , ButtonState , Class , EdgeFlags , KeyAction , KeyEventFlags , Keycode , MetaState ,
21- MotionAction , MotionEventFlags , Source , ToolType ,
21+ MotionAction , MotionEventFlags , Pointer , PointersIter , Source , ToolType ,
2222} ;
2323
2424// Note: try to keep this wrapper API compatible with the AInputEvent API if possible
@@ -116,9 +116,11 @@ impl<'a> MotionEvent<'a> {
116116 #[ inline]
117117 pub fn pointers ( & self ) -> PointersIter < ' _ > {
118118 PointersIter {
119- event : self ,
120- next_index : 0 ,
121- count : self . pointer_count ( ) ,
119+ inner : PointersIterImpl {
120+ event : self ,
121+ next_index : 0 ,
122+ count : self . pointer_count ( ) ,
123+ } ,
122124 }
123125 }
124126
@@ -130,7 +132,9 @@ impl<'a> MotionEvent<'a> {
130132 if index >= self . pointer_count ( ) {
131133 panic ! ( "Pointer index {} is out of bounds" , index) ;
132134 }
133- Pointer { event : self , index }
135+ Pointer {
136+ inner : PointerImpl { event : self , index } ,
137+ }
134138 }
135139
136140 /*
@@ -251,12 +255,12 @@ impl<'a> MotionEvent<'a> {
251255
252256/// A view into the data of a specific pointer in a motion event.
253257#[ derive( Debug ) ]
254- pub struct Pointer < ' a > {
258+ pub ( crate ) struct PointerImpl < ' a > {
255259 event : & ' a MotionEvent < ' a > ,
256260 index : usize ,
257261}
258262
259- impl < ' a > Pointer < ' a > {
263+ impl < ' a > PointerImpl < ' a > {
260264 #[ inline]
261265 pub fn pointer_index ( & self ) -> usize {
262266 self . index
@@ -274,16 +278,6 @@ impl<'a> Pointer<'a> {
274278 pointer. axisValues [ axis as u32 as usize ]
275279 }
276280
277- #[ inline]
278- pub fn orientation ( & self ) -> f32 {
279- self . axis_value ( Axis :: Orientation )
280- }
281-
282- #[ inline]
283- pub fn pressure ( & self ) -> f32 {
284- self . axis_value ( Axis :: Pressure )
285- }
286-
287281 #[ inline]
288282 pub fn raw_x ( & self ) -> f32 {
289283 let pointer = & self . event . ga_event . pointers [ self . index ] ;
@@ -296,41 +290,6 @@ impl<'a> Pointer<'a> {
296290 pointer. rawY
297291 }
298292
299- #[ inline]
300- pub fn x ( & self ) -> f32 {
301- self . axis_value ( Axis :: X )
302- }
303-
304- #[ inline]
305- pub fn y ( & self ) -> f32 {
306- self . axis_value ( Axis :: Y )
307- }
308-
309- #[ inline]
310- pub fn size ( & self ) -> f32 {
311- self . axis_value ( Axis :: Size )
312- }
313-
314- #[ inline]
315- pub fn tool_major ( & self ) -> f32 {
316- self . axis_value ( Axis :: ToolMajor )
317- }
318-
319- #[ inline]
320- pub fn tool_minor ( & self ) -> f32 {
321- self . axis_value ( Axis :: ToolMinor )
322- }
323-
324- #[ inline]
325- pub fn touch_major ( & self ) -> f32 {
326- self . axis_value ( Axis :: TouchMajor )
327- }
328-
329- #[ inline]
330- pub fn touch_minor ( & self ) -> f32 {
331- self . axis_value ( Axis :: TouchMinor )
332- }
333-
334293 #[ inline]
335294 pub fn tool_type ( & self ) -> ToolType {
336295 let pointer = & self . event . ga_event . pointers [ self . index ] ;
@@ -341,19 +300,21 @@ impl<'a> Pointer<'a> {
341300
342301/// An iterator over the pointers in a [`MotionEvent`].
343302#[ derive( Debug ) ]
344- pub struct PointersIter < ' a > {
303+ pub ( crate ) struct PointersIterImpl < ' a > {
345304 event : & ' a MotionEvent < ' a > ,
346305 next_index : usize ,
347306 count : usize ,
348307}
349308
350- impl < ' a > Iterator for PointersIter < ' a > {
309+ impl < ' a > Iterator for PointersIterImpl < ' a > {
351310 type Item = Pointer < ' a > ;
352311 fn next ( & mut self ) -> Option < Pointer < ' a > > {
353312 if self . next_index < self . count {
354313 let ptr = Pointer {
355- event : self . event ,
356- index : self . next_index ,
314+ inner : PointerImpl {
315+ event : self . event ,
316+ index : self . next_index ,
317+ } ,
357318 } ;
358319 self . next_index += 1 ;
359320 Some ( ptr)
@@ -368,7 +329,7 @@ impl<'a> Iterator for PointersIter<'a> {
368329 }
369330}
370331
371- impl < ' a > ExactSizeIterator for PointersIter < ' a > {
332+ impl < ' a > ExactSizeIterator for PointersIterImpl < ' a > {
372333 fn len ( & self ) -> usize {
373334 self . count - self . next_index
374335 }
0 commit comments