[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Missing a window resize event on X with xmonad
On Wed, Jan 14, 2009 at 12:35 AM, René Dudfield <renesd@xxxxxxxxx> wrote:
> hi,
>
> sounds like a bug somewhere (in X, SDL, or your window manager).
>
> Have you tried using: pygame.display.get_surface() ?
I tried that, but it just seems to return the exact same surface that
set_mode returned. Here's a cut-down version:
import pygame
pygame.init()
print "pygame.display.Info():", pygame.display.Info()
screensurface = pygame.display.set_mode((800,600),pygame.RESIZABLE)
print "Surface dimensions returned:", screensurface.get_size()
print "Surface dimensions of display.get_surface():",
pygame.display.get_surface().get_size()
print "pygame.display.Info():\n", pygame.display.Info()
print "pygame.display.get_wm_info()\n:", pygame.display.get_wm_info()
print dir(pygame.display.get_wm_info()['display'])
while True:
event = pygame.event.wait()
if event.type == pygame.QUIT:
break
if event.type == pygame.VIDEORESIZE:
print event
if event.type == pygame.VIDEOEXPOSE:
print event
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
break
pygame.quit()
This is what it shows when I run it:
weeble@dischord:~/py/textures$ python2.6 reduced_x_test.py
pygame.display.Info(): <VideoInfo(hw = 0, wm = 1,video_mem = 0
blit_hw = 0, blit_hw_CC = 0, blit_hw_A = 0,
blit_sw = 0, blit_sw_CC = 0, blit_sw_A = 0,
bitsize = 32, bytesize = 4,
masks = (16711680, 65280, 255, 0),
shifts = (16, 8, 0, 0),
losses = (0, 0, 0, 8),
current_w = 1280, current_h = 800
>
Surface dimensions returned: (800, 600)
Surface dimensions of display.get_surface(): (800, 600)
pygame.display.Info():
<VideoInfo(hw = 0, wm = 1,video_mem = 0
blit_hw = 0, blit_hw_CC = 0, blit_hw_A = 0,
blit_sw = 0, blit_sw_CC = 0, blit_sw_A = 0,
bitsize = 32, bytesize = 4,
masks = (16711680, 65280, 255, 0),
shifts = (16, 8, 0, 0),
losses = (0, 0, 0, 8),
current_w = 800, current_h = 600
>
pygame.display.get_wm_info()
: {'fswindow': 58720258, 'wmwindow': 58720259, 'window': 58720269,
'lock_func': <PyCObject object at 0x7f3b84d84328>, 'unlock_func':
<PyCObject object at 0x7f3b84d84530>, 'display': <PyCObject object at
0x7f3b84d84508>}
['__class__', '__delattr__', '__doc__', '__format__',
'__getattribute__', '__hash__', '__init__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__']
However, despite what it says, its window is not 800x600. (Although I
do fully believe that the allocated surface bitmap is 800x600.) If I
now cause the window manager to shuffle the windows around and then
back again, it does get the resize events, printing the following:
<Event(16-VideoResize {'h': 748, 'w': 484, 'size': (484, 748)})>
<Event(16-VideoResize {'h': 373, 'w': 792, 'size': (792, 373)})>
These are completely correct. In my more elaborate original program I
used these to call set_mode again and everything worked fine. My
problem is just when I create the window in the first place and when I
switch from full-screen to a window. (Using set_mode. I've not tried
toggle_fullscreen because I'm aiming to have something
cross-platform.)
I'm running Pygame 1.8.1, Python 2.6 and Ubuntu 8.10 for x86_64.