Re: [gtk-list] Event box bug?




Patch below fixes your problem. 
But I don't know that is the right way.


--- gtkeventbox.c.orig	Tue Dec  1 04:05:46 1998
+++ gtkeventbox.c	Tue Jan 12 10:17:38 1999
@@ -201,8 +201,10 @@
       
       if (bin->child)
 	{
-	  if (gtk_widget_intersect (bin->child, &tmp_area, &child_area))
+	  if (gtk_widget_intersect (bin->child, &tmp_area, &child_area)){
+	    gdk_window_clear_area(widget->window, child_area.x, child_area.y, child_area.width, child_area.height);
 	    gtk_widget_draw (bin->child, &child_area);
+	  }
 	}
     }
 }

On Mon, 11 Jan 1999, Nigel Gamble wrote:

> I first reported this problem in GTK+-1.1.9.  The behavior is
> unchanged in GTK+-1.1.12, and I didn't see any responses to
> that report, so here it is again.  Can someone confirm either
> that this is a bug, or that this is the expected behavior?
> 
> I'm using an event box to contain a checkbutton, but it seems to
> badly affect the behavior of the checkbutton widget.  The test program
> draws 4 checkbuttons.  "Button 1" and "Button 4" are inside event
> boxes, while 2 and 3 are not.  When the cursor is moved onto
> buttons 1 or 4, they are highlighted, but the highlighting is
> not removed when the curor leaves the widget.  Similarly, the
> "focus line" around buttons 1 and 4 is not removed when another
> widget gains the focus.
> 
> Nigel Gamble                                    nigel@nrg.org
> Mountain View, CA, USA.                         http://www.nrg.org/
> 
> 
> #include <gtk/gtk.h>
> 
> gint
> delete_event(GtkWidget *w, GdkEvent *e, gpointer data)
> {
> 	return(FALSE);
> }
> 
> void
> destroy(GtkWidget *w, gpointer data)
> {
> 	gtk_main_quit();
> }
> 
> GtkWidget *
> table_of_checkbuttons()
> {
> 	GtkWidget *checkbutton;
> 	GtkWidget *table;
> 	GtkWidget *w;
> 
> 	table = gtk_table_new(2, 2, TRUE);
> 
> 	w = gtk_event_box_new();
> 	checkbutton = gtk_check_button_new_with_label("Button 1");
> 	gtk_container_add(GTK_CONTAINER(w), checkbutton);
> 	gtk_table_attach_defaults(GTK_TABLE(table), w, 0, 1, 0, 1);
> 	gtk_widget_show(checkbutton);
> 	gtk_widget_show(w);
> 
> 	checkbutton = gtk_check_button_new_with_label("Button 2");
> 	gtk_table_attach_defaults(GTK_TABLE(table), checkbutton, 1, 2, 0, 1);
> 	gtk_widget_show(checkbutton);
> 
> 	checkbutton = gtk_check_button_new_with_label("Button 3");
> 	gtk_table_attach_defaults(GTK_TABLE(table), checkbutton, 0, 1, 1, 2);
> 	gtk_widget_show(checkbutton);
> 
> 	w = gtk_event_box_new();
> 	checkbutton = gtk_check_button_new_with_label("Button 4");
> 	gtk_container_add(GTK_CONTAINER(w), checkbutton);
> 	gtk_table_attach_defaults(GTK_TABLE(table), w, 1, 2, 1, 2);
> 	gtk_widget_show(checkbutton);
> 	gtk_widget_show(w);
> 
> 	return table;
> }
> 
> int
> main(int argc, char **argv)
> {
> 	GtkWidget *window;
> 	GtkWidget *main_widget;
> 
> 	gtk_init(&argc, &argv);
> 
> 	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> 	gtk_window_set_title(GTK_WINDOW(window), "Table");
> 
> 	gtk_signal_connect(GTK_OBJECT(window), "delete_event",
> 					GTK_SIGNAL_FUNC(delete_event), NULL);
> 	gtk_signal_connect(GTK_OBJECT(window), "destroy",
> 					GTK_SIGNAL_FUNC(destroy), NULL);
> 
> 	gtk_container_border_width(GTK_CONTAINER(window), 10);
> 
> 	main_widget = table_of_checkbuttons();
> 	gtk_widget_set_usize(main_widget, 200, 100);
> 	gtk_widget_show(main_widget);
> 
> 	gtk_container_add(GTK_CONTAINER(window), main_widget);
> 	gtk_widget_show(window);
> 
> 	gtk_main();
> 
> 	return 0;
> }
> 
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 



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