pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Add `pygame.display.get_desktop_usable_bounds`

Open damusss opened this issue 4 months ago • 5 comments
trafficstars

As I said on discord, pygame.display.get_desktop_sizes exist but doesn't take in consideration the taskbar or any other OS reserved space. The SDL function for it exists, so it makes sense to me to add it to display. It would be very tedious to do this in python cross platform without it. It's a differnt function from the sizes because it returns rects, but the return list uses the same logic so with the same index you get the full size and usable area for the same desktop. Also, it's alredy SDL3 compatible, so there will be no problems when display is ported. There is no conflict with window because this is one of the features that make sense for display, and doesn't concert any windows (display should only hold this functions)

Summary by CodeRabbit

  • New Features

    • Added get_desktop_usable_bounds() to return usable desktop areas (excluding taskbars/docks) as a list of Rects.
    • Returns usable bounds per configured virtual desktop; count may differ from attached monitors and supports multi-monitor mirroring.
  • Documentation

    • Added API docs describing signature and behavior of get_desktop_usable_bounds().
  • Tests

    • Added tests validating returned Rects and that each bound does not exceed corresponding desktop sizes.

damusss avatar Jul 13 '25 07:07 damusss