mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 13:44:50 +00:00 
			
		
		
		
	Fix mouse wheel events on macOS 10.12 (thanks Eric Wasylishen!)
Fixes bug #3432
This commit is contained in:
		
							parent
							
								
									89c538a4e3
								
							
						
					
					
						commit
						bac5394127
					
				| 
						 | 
					@ -421,8 +421,8 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SDL_Mouse *mouse = SDL_GetMouse();
 | 
					    SDL_Mouse *mouse = SDL_GetMouse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    float x = -[event deltaX];
 | 
					    CGFloat x = -[event deltaX];
 | 
				
			||||||
    float y = [event deltaY];
 | 
					    CGFloat y = [event deltaY];
 | 
				
			||||||
    SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL;
 | 
					    SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) {
 | 
					    if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) {
 | 
				
			||||||
| 
						 | 
					@ -432,14 +432,14 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (x > 0) {
 | 
					    if (x > 0) {
 | 
				
			||||||
        x += 0.9f;
 | 
					        x = SDL_ceil(x);
 | 
				
			||||||
    } else if (x < 0) {
 | 
					    } else if (x < 0) {
 | 
				
			||||||
        x -= 0.9f;
 | 
					        x = SDL_floor(x);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (y > 0) {
 | 
					    if (y > 0) {
 | 
				
			||||||
        y += 0.9f;
 | 
					        y = SDL_ceil(y);
 | 
				
			||||||
    } else if (y < 0) {
 | 
					    } else if (y < 0) {
 | 
				
			||||||
        y -= 0.9f;
 | 
					        y = SDL_floor(y);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction);
 | 
					    SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue