A very strange bug




I'm trying to track down a bug in GnomeICU.  I'm not totally sure when the
bug arose, because it's very difficult to know what's causing it.  Pretty
much every time I run GnomeICU, eventually, all pixmap-based widgets stop
drawing themselves, and the main CList doesn't draw itself correctly (the
pixmaps simply do not show up, like the status indicator and the eyes at
the bottom of the main window, the pixmaps in the buttons in a chat
session, and the pixmap on the applet).  As I said, I cannot tie this to
any single event, though I sure have tried.  One possibility is that I'm
implementing the following eye functions incorrectly.  I think I've got
all the necessary code below.  Any help would be GREATLY appreciated.


The Code:
----------------------------------------------------------------------------
/* Create a box to put the status indicator and eye animation into */
   statusbox = gtk_hbox_new( FALSE, 0 );
   gtk_box_pack_end( GTK_BOX( box2 ), statusbox, FALSE, FALSE, 0 );

/* This is the button we put the status indicator icon into */
   status_button = gtk_button_new();
   gtk_box_pack_start( GTK_BOX(statusbox), status_button, FALSE, FALSE, 0 );
   gtk_widget_set_usize( status_button, 30, 20 );

/* Clicking it pulls up a status menu */
   gtk_signal_connect( GTK_OBJECT( status_button ), "clicked",
                       GTK_SIGNAL_FUNC( popup_status_menu ), NULL );

/* still_eyes_* are the images created by imlib calls w/a 29x14 xpm */
   eyes_still = gtk_pixmap_new( still_eyes_pixmap, still_eyes_bitmap );
   gtk_box_pack_start( GTK_BOX(statusbox), eyes_still, FALSE, FALSE, 0 );
   gtk_widget_show( eyes_still );

   gtk_widget_show( statusbox );
   gtk_widget_show( status_button );

/* Here's where the gnome animator is created, from animeyes.png */
   eyes_animated = gnome_animator_new_with_size( 29, 14 );

   str = gnome_pixmap_file( "gnomeicu/animeyes.png" );

   if( str == NULL )
      str = gnome_pixmap_file( "animeyes.png" );

   gnome_animator_append_frames_from_file(GNOME_ANIMATOR(eyes_animated),
                                           str, 0, 0, 100, 29 );
   g_free( str );

   gtk_box_pack_start( GTK_BOX(statusbox), eyes_animated, FALSE, FALSE,0);

/* The widget is not gtk_widget_show()'n until later (is this allowed?) */

...

/* This code appears later on */

...

gint animate_ref = 0;

void animate_on( void )
{
   ++animate_ref;

   /* If the eyes are already spinning, no need to start them again */
   if( animate_ref != 1 )
	return;

/* Hide one widget, display the other */
   gtk_widget_hide( eyes_still );   
   gtk_widget_show( eyes_animated );

/* Start the animation */
   gnome_animator_set_loop_type( GNOME_ANIMATOR( eyes_animated ),
                                 GNOME_ANIMATOR_LOOP_RESTART );
   gnome_animator_start( GNOME_ANIMATOR( eyes_animated ) );
}

void animate_off( void )
{
   --animate_ref;

   if( animate_ref < 0 )
      animate_ref = 0;  

   /* If we're not back down to zero yet, don't stop the eyes */
   if( animate_ref )
      return;

/* Hide the animation, show the still image */
   gtk_widget_hide( eyes_animated );
   gtk_widget_show( eyes_still );   

/* Should this be done before hiding the animation? */
   gnome_animator_stop( GNOME_ANIMATOR( eyes_animated ) );
}


----------------------------------------------------------------------------
End code

That's all the gnome_animator code.  If there's something that sticks out
to you gurus, please let me know, cuz this bug is really annoying me.
Thanks again!

Sincerely,

Jeremy Wise

+---------------------------------------------------------------------------+
|       Jeremy Wise                       Make every effort to enter        |
|       jwise@pathwaynet.com              through the narrow door,          |
|       ICQ #4664755                      because many, I tell you,         |
|       http://www.pathwaynet.com/~jwise  will try to enter and will        |
|       http://gnomeicu.gdev.net/         not be able to. (Luke 13:24)      |
+---------------------------------------------------------------------------+
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
-----------------------------------------------------------------------------



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