mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	SDL_GetTouchFingers() follows the SDL_GetStringRule
This commit is contained in:
		| @@ -501,7 +501,7 @@ SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return) | ||||
| SDL_DYNAPI_PROC(const char*,SDL_GetTouchDeviceName,(SDL_TouchID a),(a),return) | ||||
| SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),return) | ||||
| SDL_DYNAPI_PROC(const SDL_TouchID*,SDL_GetTouchDevices,(int *a),(a),return) | ||||
| SDL_DYNAPI_PROC(SDL_Finger**,SDL_GetTouchFingers,(SDL_TouchID a, int *b),(a,b),return) | ||||
| SDL_DYNAPI_PROC(const SDL_Finger* const*,SDL_GetTouchFingers,(SDL_TouchID a, int *b),(a,b),return) | ||||
| SDL_DYNAPI_PROC(const char*,SDL_GetUserFolder,(SDL_Folder a),(a),return) | ||||
| SDL_DYNAPI_PROC(int,SDL_GetVersion,(void),(),return) | ||||
| SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return) | ||||
|   | ||||
| @@ -134,7 +134,7 @@ static SDL_Finger *SDL_GetFinger(const SDL_Touch *touch, SDL_FingerID id) | ||||
|     return touch->fingers[index]; | ||||
| } | ||||
|  | ||||
| SDL_Finger **SDL_GetTouchFingers(SDL_TouchID touchID, int *count) | ||||
| const SDL_Finger * const * SDL_GetTouchFingers(SDL_TouchID touchID, int *count) | ||||
| { | ||||
|     SDL_Finger **fingers; | ||||
|     SDL_Finger *finger_data; | ||||
| @@ -153,7 +153,7 @@ SDL_Finger **SDL_GetTouchFingers(SDL_TouchID touchID, int *count) | ||||
|     if (!fingers) { | ||||
|         return NULL; | ||||
|     } | ||||
|     finger_data = (SDL_Finger *)((Uint8 *)fingers + (touch->num_fingers + 1) * sizeof(*fingers)); | ||||
|     finger_data = (SDL_Finger *)(fingers + (touch->num_fingers + 1)); | ||||
|  | ||||
|     for (int i = 0; i < touch->num_fingers; ++i) { | ||||
|         fingers[i] = &finger_data[i]; | ||||
| @@ -164,7 +164,7 @@ SDL_Finger **SDL_GetTouchFingers(SDL_TouchID touchID, int *count) | ||||
|     if (count) { | ||||
|         *count = touch->num_fingers; | ||||
|     } | ||||
|     return fingers; | ||||
|     return SDL_FreeLater(fingers); | ||||
| } | ||||
|  | ||||
| int SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name) | ||||
|   | ||||
| @@ -1735,11 +1735,11 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_ | ||||
|     } | ||||
|     if (existingTouchCount == 0) { | ||||
|         int numFingers; | ||||
|         SDL_Finger **fingers = SDL_GetTouchFingers(touchID, &numFingers); | ||||
|         const SDL_Finger * const *fingers = SDL_GetTouchFingers(touchID, &numFingers); | ||||
|         if (fingers) { | ||||
|             DLog("Reset Lost Fingers: %d", numFingers); | ||||
|             for (--numFingers; numFingers >= 0; --numFingers) { | ||||
|                 SDL_Finger *finger = fingers[numFingers]; | ||||
|                 const SDL_Finger *finger = fingers[numFingers]; | ||||
|                 /* trackpad touches have no window. If we really wanted one we could | ||||
|                  * use the window that has mouse or keyboard focus. | ||||
|                  * Sending a null window currently also prevents synthetic mouse | ||||
| @@ -1748,7 +1748,6 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_ | ||||
|                 SDL_Window *window = NULL; | ||||
|                 SDL_SendTouch(Cocoa_GetEventTimestamp([theEvent timestamp]), touchID, finger->id, window, SDL_FALSE, 0, 0, 0); | ||||
|             } | ||||
|             SDL_free(fingers); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sam Lantinga
					Sam Lantinga