pygame-ce
pygame-ce copied to clipboard
Delay after mouse click when using pygame.mouse.get_pos() on macOS
Environment:
- Operating system: macOS Ventura 13.4.1
- Python version: 3.11.4
- SDL version: 2.26.4
- PyGame version: 2.3.0
- Relevant hardware: Wireless mouse connected through Bluetooth. Doesn't seem to happen when using the built-in trackpad.
Current behavior:
When moving the mouse and clicking at the same time, the value returned from pygame.mouse.get_pos
seems to pause for about 10 frames before updating normally again.
Expected behavior:
This function should return an accurate result every frame.
Screenshots
Steps to reproduce:
- Copy the code below into a blank script and run.
- Move the mouse around while clicking the left mouse button.
- Observe the circle pausing for a few frames after each click.
Test code
import pygame
pygame.init()
screen = pygame.display.set_mode((500, 500))
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
clock.tick(60)
pos = pygame.mouse.get_pos()
screen.fill("black")
pygame.draw.circle(screen, "red", pos, 25)
print(pos)
pygame.display.flip()
The issue persists with or without clock.tick
.