Răsfoiți Sursa

Removed the codepath that gets compiled if IPHONE_TOUCH_EFFICIENT_DANGEROUS is not defined.

The "dangerous" codepath relies on the fact that UITouch objects are persistent for the entire touch sequence, which is always guaranteed by Apple.
Alex Szpakowski 11 ani în urmă
părinte
comite
d89620a809
2 a modificat fișierele cu 0 adăugiri și 48 ștergeri
  1. 0 6
      src/video/uikit/SDL_uikitview.h
  2. 0 42
      src/video/uikit/SDL_uikitview.m

+ 0 - 6
src/video/uikit/SDL_uikitview.h

@@ -24,12 +24,6 @@
 
 
 #include "SDL_touch.h"
 #include "SDL_touch.h"
 
 
-#define IPHONE_TOUCH_EFFICIENT_DANGEROUS
-
-#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
-#define MAX_SIMULTANEOUS_TOUCHES 5
-#endif
-
 #if SDL_IPHONE_KEYBOARD
 #if SDL_IPHONE_KEYBOARD
 @interface SDL_uikitview : UIView <UITextFieldDelegate>
 @interface SDL_uikitview : UIView <UITextFieldDelegate>
 #else
 #else

+ 0 - 42
src/video/uikit/SDL_uikitview.m

@@ -41,9 +41,6 @@ void _uikit_keyboard_init();
 
 
     SDL_TouchID touchId;
     SDL_TouchID touchId;
     UITouch *leftFingerDown;
     UITouch *leftFingerDown;
-#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
-    UITouch *finger[MAX_SIMULTANEOUS_TOUCHES];
-#endif
 
 
 #if SDL_IPHONE_KEYBOARD
 #if SDL_IPHONE_KEYBOARD
     UITextField *textField;
     UITextField *textField;
@@ -99,24 +96,8 @@ void _uikit_keyboard_init();
         }
         }
 
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
-#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
-        /* FIXME: TODO: Using touch as the fingerId is potentially dangerous
-         * It is also much more efficient than storing the UITouch pointer
-         * and comparing it to the incoming event.
-         */
         SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
         SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
                       SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
                       SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
-#else
-        int i;
-        for(i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
-            if (finger[i] == NULL) {
-                finger[i] = touch;
-                SDL_SendTouch(touchId, i,
-                              SDL_TRUE, locationInView.x, locationInView.y, 1.0f);
-                break;
-            }
-        }
-#endif
     }
     }
 }
 }
 
 
@@ -130,20 +111,8 @@ void _uikit_keyboard_init();
         }
         }
 
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
-#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
         SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
         SDL_SendTouch(touchId, (SDL_FingerID)((size_t)touch),
                       SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
                       SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
-#else
-        int i;
-        for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
-            if (finger[i] == touch) {
-                SDL_SendTouch(touchId, i,
-                              SDL_FALSE, locationInView.x, locationInView.y, 1.0f);
-                finger[i] = NULL;
-                break;
-            }
-        }
-#endif
     }
     }
 }
 }
 
 
@@ -168,19 +137,8 @@ void _uikit_keyboard_init();
         }
         }
 
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];
-#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
         SDL_SendTouchMotion(touchId, (SDL_FingerID)((size_t)touch),
         SDL_SendTouchMotion(touchId, (SDL_FingerID)((size_t)touch),
                             locationInView.x, locationInView.y, 1.0f);
                             locationInView.x, locationInView.y, 1.0f);
-#else
-        int i;
-        for (i = 0; i < MAX_SIMULTANEOUS_TOUCHES; i++) {
-            if (finger[i] == touch) {
-                SDL_SendTouchMotion(touchId, i,
-                                    locationInView.x, locationInView.y, 1.0f);
-                break;
-            }
-        }
-#endif
     }
     }
 }
 }