bug in gtk 1.2 still in gtk 1.3 - code example to show it



Hi all,

I have many times reported that if you got the mouse just where the button is going to appear (gdm, nautilus-installer, ...) you won't be able to click the button, it is confusing and anoying.

Here is a simple example showing it. It raises a big window with a button on it (set_sensitive = false). After 2 seconds, a timeout makes the button sensitive. If you have the mouse over the button before the timeout sets it sensitive, you WON'T be able to click the button, it will refuse to do so. Leaving the button and entering it again makes it work.

I will love to fix it myself, but I don't have the skills.

As perhaps it is not a simple fix, I'm sending the bug here.

Try it out. Don't know if this applies to other widgets as well.

gcc button.c `gtk-config --cflags gtk` `gtk-config --libs gtk` -o button-bug

gcc button.c `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` -o button-bug

Thanks.

--
Manuel Clos
llanero jazzfree com

* Si no puedes hacerlo bien, hazlo bonito (Bill Gates)
* If you can't do it well, do it nice (Bill Gates)
/* Little example showing the "not activated" bug in gtk+ 1.2 and 1.3
   Please, send comments to llanero jazzfree com 
 */

#include <gtk/gtkbutton.h>

int active_button(gpointer foo)
{
	gtk_widget_set_sensitive((GtkWidget *)foo, 1);
	g_print("button activated!\n");
	return 0;
}

int main (int argc, char argv[])
{
	GtkWidget *window;
	GtkWidget *button;

	gtk_init(&argc, &argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

	gtk_widget_set_usize(window, 400, 400);

	button = gtk_button_new_with_label("Hello!");
	
	gtk_container_add(window, button);

	gtk_widget_set_sensitive(button, 0);
	
	gtk_widget_show(button);
	gtk_widget_show(window);

	gtk_timeout_add(2000, active_button, button);
	
	gtk_main();

	return 0;
}


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