[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] surface.get_flags() and pygame.FULLSCREEN



Hey!

Are you supposed to be able to test the "current" fullscreen state of the window you've created by using (surface.get_flags() & pygame.FULLSCREEN) == pygame.FULLSCREEN?

Because in my tests on pygame 1.7.1release-4.1ubuntu1, it doesn't.

To reproduce it, do as follows:

* Download the attached script, and change the resolution (1024, 768) to your monitors native resolution (so it won't have to change modes all the time).
* Start the program, and don't press anything
* SSH to your machine from another (so the fullscreen app still has focus), and start some fullscreen app that takes focus, e.g. mplayer (I use this command: DISPLAY=:0 mplayer -fs /tmp/series/RedAlert3RemixHD.mov -ao null)
* Quit the fullscreen app (mplayer or whatever).

Now, it takes a few seconds for pygame to retake fullscreen mode (why is this?), but my prgoram NEVER prints "LOST FULLSCREEN".

Why is that? Is this a bug?

Ps. Press ESCAPE to exit test.py.

--
Kindest regards, Jørgen P. Tjernø.
import pygame

s = pygame.display.set_mode((1024, 768), pygame.FULLSCREEN)

quit = False
while not quit:
    pygame.display.flip()

    fullscreen = (pygame.display.get_surface().get_flags() & pygame.FULLSCREEN) == pygame.FULLSCREEN
    if not fullscreen:
        print "LOST FULLSCREEN"

    for event in pygame.event.get():
        if hasattr(event, 'key') and event.type == pygame.KEYDOWN:
            quit = event.key == pygame.K_ESCAPE

pygame.quit()