Gtk-demo.c

Hi Sam, Hi All,

AFAIK, gtk-demo.c has these problems:

(1) The “screen” variable may be used before being initialized. This was a
nasty problem, because it doesn’t show if for any reason the window manager
causes a configure event immediately when window opens. Using Enlightenment,
marking the flag “All new window that appear get the keyboard focus” causes
such an event, thus hiding the problem.
(2) Some callback functions don’t return an explicit value, and this is
another source for random behaviour. For instance, if the return code of the
gtk idle function was read as FALSE (0) then the idle function would no more
be called.
(3) The sprintf for the hack uses a %d formatting, but the compiler
perceives the next argument as long (no real problem, I think)
(4) Unknown problem: it does not work on one of my two workstations, either
before or after the fixes.

I fixed problems (1), (2) and (3) like this:

(1) Added an explicit call to SDL_SetVideoMode just after SDL_Init
(2) Added explicit return statements wherever appropriate
(3) Changed to %ld

You can download the modified source here (I didn’t want to post a binary
file here):

http://www.geocities.com/Area51/Cavern/1884/gtk-demo.zip

Now, can someone help me with (4) ?
With both machines I formatted everything, then installed RedHat 6.1
selecting “Everything”, then I installed SDL 1.1.1. The main difference is
that one machine works with 65536 colors, the other with 256. The hardware
is quite different too (Pentium II 350 vs Pentium 200 MMX). gtk-demo crashes
on the smallest workstation, with the following error:

Gdk-ERROR **: BadWindow (invalid Window parameter)
serial 33 error_code 3 request_code 2 minor_code 0

I know the problem seems to be in gdk or gtk, but I really think it has more
to do with SDL.
Using SDL 1.0.8 the result is the same, using SDL 1.0.4 everything works ok.
Did anyone try gtk-demo with 8bpp ?

Thanks for your help
Best Regards
Amedeo Storni

“Amedeo Storni” <@Amedeo_Storni> wrote in message
news:8airbv$rif$1 at ftp.lokigames.com

Hi Sam, Hi All,

AFAIK, gtk-demo.c has these problems:

[big snip]

This is just to confirm that the problems only happen in 8bpp. In 16bpp all
works ok.

Regards
Amedeo Storni