Skip to content

Mouse gets stuck on right side of the window in virtual mouse input mode #2778

@ted-gilbert

Description

@ted-gilbert

Environment:

  • Operating system Windows 10
  • Python version 3.9.2
  • SDL version 2.0.16
  • PyGame version 2.0.2

Current behavior:

Mouse cursor becomes visible and gets stuck (will not move further right) on the right side of the window when in virtual mouse input mode (using pygame.mouse.set_visible(False); pygame.event.set_grab(True). Cursor can still move up and down on right side.
Moving to the left, top and bottom sides of the window works as expected.

Bug does not occur in PyGame 2.0.1.

Screenshots

Before moving cursor to right side. Cursor is not visible and events are working normally.
Untitled

Cursor becomes visible on right side of window and will not move any further. (Green outline added by Windows Steps Recorder and not relevant)
image

Steps to reproduce:

Run the test code below with PyGame 2.0.2. Move the mouse cursor to the right side of the window.

Test code

import pygame

pygame.init()

if __name__ == '__main__':
    surface = pygame.display.set_mode((100, 100))

    pygame.mouse.set_visible(False)
    pygame.event.set_grab(True)

    while True:
        pygame.event.get()

Replace pygame.event.get() with the following to observe that no rightwards mouse motion is observed by event.rel when the cursor is stuck on the right side:

        for event in pygame.event.get():
            if event.type == pygame.MOUSEMOTION:
                print(event.rel[0])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: Windowsbugreproducibleconfirmed that the issue can be replicated and there are instructions to reproduce the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions