Posible theme refresh bug



Hi,
I am experiencing a refreshing problem.

When you put a label inside an event_box, and make sucesive call
to the gtk_label_set_text() function, the text in the label
overwrite with the new label string.

This happend only with some pixmap themes.
I have spoken with the author of the theme and he believes that
maybe there is a problem with the gtk+-engine package.

I have include a simple code that reproduces the issue.

Some themes where I can reproduce the issue:
AbsoluteE
BeCool
Beta
BlueSteel
BlueTheme
Bluthe
Crome
E-Mac
Expensive
GTK_LARS
Gradient
IceBerg
Jander
Jed3
LCARS
LCD
LightSpeed
Marble
Marble3D
Metallic
MockMack
Pixmap
Porcelain
ShinyMetal
SkiBerg
Smoke-full
Torpedo
TrueBe
WoodenScraps
Yell-O
eMock
etheme
metallic_plum
odo
tildouf


I have: 
- RedHat 6.1
- RedHat 6.1 updates
- gnome-october (rpm distribution)
- gtk+ 1.2.5

Regards,
Oliver
-- 
Oliver Schulze L.
oliver@pla.net.py
Asuncion-Paraguay
http://www.pla.net.py/home/oliver/
/* example-start helloworld helloworld.c 
 * 
 * Modified helloworld.c from the gtk_tutorial
 * http://www.gtk.org
 * 
 * In this example, the label that is in the event_box does not refresh.
 * This happend if you are using the 'Marble3D' theme.
 * 
 * The vbox is in the main window.
 * The upper label(normal_label) is in the vbox
 * The event box(ebox) is in the vbox.
 * The lower label(event_label) is in the event box.
 * The button is in the vbox
 * 
 * oliver@pla.net.py
 */

#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>

//-------------------------------------------------------------------------
GtkWidget *normal_label,
          *event_label;

gint timeout_callback()
{
	static char str[10];

	sprintf(str, "%ld", random());

	gtk_label_set_text(GTK_LABEL(normal_label), str);
	gtk_label_set_text(GTK_LABEL(event_label), str);
	
	return TRUE;
}
//-------------------------------------------------------------------------

/* This is a callback function. The data arguments are ignored
 * in this example. More on callbacks below. */
void hello( GtkWidget *widget,
            gpointer   data )
{
    g_print ("Hello World\n");
}

gint delete_event( GtkWidget *widget,
                   GdkEvent  *event,
		   gpointer   data )
{
    /* If you return FALSE in the "delete_event" signal handler,
     * GTK will emit the "destroy" signal. Returning TRUE means
     * you don't want the window to be destroyed.
     * This is useful for popping up 'are you sure you want to quit?'
     * type dialogs. */

    g_print ("delete event occurred\n");

    /* Change TRUE to FALSE and the main window will be destroyed with
     * a "delete_event". */

    return(TRUE);
}

/* Another callback */
void destroy( GtkWidget *widget,
              gpointer   data )
{
    gtk_main_quit();
}

int main( int   argc,
          char *argv[] )
{
    /* GtkWidget is the storage type for widgets */
    GtkWidget *window;
    GtkWidget *button,
              *vbox,
              *ebox;
    gint id_timeout;
    
    /* This is called in all GTK applications. Arguments are parsed
     * from the command line and are returned to the application. */
    gtk_init(&argc, &argv);
    
    /* create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    
    /* When the window is given the "delete_event" signal (this is given
     * by the window manager, usually by the 'close' option, or on the
     * titlebar), we ask it to call the delete_event () function
     * as defined above. The data passed to the callback
     * function is NULL and is ignored in the callback function. */
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
			GTK_SIGNAL_FUNC (delete_event), NULL);
    
    /* Here we connect the "destroy" event to a signal handler.  
     * This event occurs when we call gtk_widget_destroy() on the window,
     * or if we return 'FALSE' in the "delete_event" callback. */
    gtk_signal_connect (GTK_OBJECT (window), "destroy",
			GTK_SIGNAL_FUNC (destroy), NULL);
    
    /* Sets the border width of the window. */
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
    
    /* Creates a new button with the label "Hello World". */
    button = gtk_button_new_with_label ("Hello World");
    
    /* When the button receives the "clicked" signal, it will call the
     * function hello() passing it NULL as its argument.  The hello()
     * function is defined above. */
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
			GTK_SIGNAL_FUNC (hello), NULL);
    
    /* This will cause the window to be destroyed by calling
     * gtk_widget_destroy(window) when "clicked".  Again, the destroy
     * signal could come from here, or the window manager. */
    gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
			       GTK_SIGNAL_FUNC (gtk_widget_destroy),
			       GTK_OBJECT (window));
    
    /* This packs the button into the window (a gtk container). */
    //gtk_container_add (GTK_CONTAINER (window), button);

//-------------------------------------------------------------------------
/*
 *	label_test block
 */
		//vertical box
		vbox  = gtk_vbox_new(FALSE, 0);
		gtk_container_add (GTK_CONTAINER (window), vbox);

		gtk_box_pack_end (GTK_BOX(vbox), button, FALSE, FALSE, 10);

		//label in an event box
		ebox = gtk_event_box_new();
		normal_label = gtk_label_new("12345678901234567890");

		gtk_container_add(GTK_CONTAINER(ebox), normal_label);
		gtk_box_pack_end (GTK_BOX(vbox), ebox, FALSE, FALSE, 10);

		//normal label
		event_label = gtk_label_new("12345678901234567890");

		gtk_box_pack_end (GTK_BOX(vbox), event_label, FALSE, FALSE, 10);

		//the timeout
		id_timeout = gtk_timeout_add(100,
		                            (GtkFunction)timeout_callback, NULL);
//-------------------------------------------------------------------------
		    
    /* The final step is to display this newly created widget. */
    //gtk_widget_show (button);
    
    /* and the window */
    gtk_widget_show_all (window);
    
    /* All GTK applications must have a gtk_main(). Control ends here
     * and waits for an event to occur (like a key press or
     * mouse event). */
    gtk_main ();
    
    return(0);
}
/* example-end */


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