Re: [AD] Allegro window icon under X

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, 2004-07-04 at 14:23 +0200, Evert Glebbeek wrote:
> Revised patch attached.
> 
> This will try to use a weak symbol on gcc, and failing that, try to use 
> Allegro's constructor function defines as an alternative (I think these 
> too are gcc specific, but I'm not sure. May be more robuste anyway).
> 

Heh, constructor function defines. Sometimes I wish there was some
documentation for Allegro's internal API :)

> I moved the -lXpm library flag in the configure machinery to aclocal.m4, 
> where it is added to the flags along with the other X11 libraries (as it 
> should be).
> 

If we have a test for -lXpm, maybe also have a test for Xpm.h?

> I also replaced the inlined alex icon with an #included version (I just 
> copied alex.xpm from the misc/ directory).
> Also included is a misc/x11/xfixicon.sh script. It accepts an image file 
> and uses the convert program to change it to a .xpm file. It then 
> generates allegro_icon.c, which can be linked to the user program to 
> generate the icon. The .xpm file is inlined in it, so no other files are 
> needed.
> 

Personally, I'd prefer if the name would be <icon>.c, where <icon> is
the bitmap name, or if there would be a -o switch for the output file
name. Maybe I'll try to do something like wfixicon.c some time, so you
can also use datafile bitmaps, and don't need the imagemagick tools
installed. And the xpm files also are very evil:

static char *allegico_xpm[] = {
"48 48 6 1",

Apparently a "const" is missing.. so I get lots of warnings - maybe a
sed could be used on the generated file to add the const. I'd also add
the const to alex.xpm - even though Allegro doesn't use -Wwrite-strings
when compiling.

> I'm reasonably statisfied with the functionality of this patch (I may want 
> to add a xwin_set_window_icon() function to the API, so that there is an 
> alternative way to set the icon if this method does not work, but it's 
> more or less optional), so I'd like someone to look at it and comment on 
> what needs to be added (apart from documentation) before it can be 
> applied.

I think it can be added, ideally with my above changes - I tested it
with my own icon, and works great :) Just make sure the +x flag is set
for the .sh file when committing, I remember CVS doesn't like changing
flags afterwards.

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/