Enable/Disable a button and mouse clicks

2007-01-03 Thread Gabriele Greco
I've found that if I disable a button after a click on it 
(gtk_widget_set_sensitive(button, FALSE)), and then enable it back after 
a timed event or something else occurs (...set_sensitive(button, TRUE) 
), I'm unable to click on the button with the mouse pointer unless I 
exit with the pointer from the button rectangle and enter back in it.

This is a minimal example showing this strange behaviour, I think it's a 
wanted behaviour and not a bug (I found this behaviour in GTK 2.6, 2.8, 
but not in GTK 2.4), but it's not what I want from my button, there is 
any workaround for it?

#include gtk/gtk.h
#include stdio.h

int do_timeout(GtkWidget *w)
{
 printf(Timed out, enabling button\n);
 gtk_widget_set_sensitive(w, TRUE);
 return 0;
}

int clicked(GtkWidget *w)
{
 printf(Button clicked!\n);
 gtk_widget_set_sensitive(w, FALSE);
 g_timeout_add(2000, do_timeout, w);
}

int main(int argc, char *argv[])
{
 gtk_init(argc, argv);
 GtkWidget *w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 GtkWidget *b = gtk_button_new_with_label(Test);
 gtk_container_add(GTK_CONTAINER(w), b);
 g_signal_connect(b, clicked, clicked, NULL);
 gtk_widget_show_all(w);
 gtk_main();
}

Bye,
  Gabry



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Enable/Disable a button and mouse clicks

2007-01-03 Thread Ed Catmur
Gabriele Greco wrote:
 I've found that if I disable a button after a click on it 
 (gtk_widget_set_sensitive(button, FALSE)), and then enable it back after 
 a timed event or something else occurs (...set_sensitive(button, TRUE) 
 ), I'm unable to click on the button with the mouse pointer unless I 
 exit with the pointer from the button rectangle and enter back in it.

You've discovered bug 56070[1].  There are some workarounds at the bug, but 
we're fairly close to getting it fixed in GTK+. 

Ed 

1. http://bugzilla.gnome.org/show_bug.cgi?id=56070
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: [SPAM] Re: Enable/Disable a button and mouse clicks

2007-01-03 Thread Gabriele Greco
Ed Catmur wrote:

 You've discovered bug 56070[1].  There are some workarounds at the bug, but 
 we're fairly close to getting it fixed in GTK+. 
After a complete read of the thread I've implemented the workaround 
based on the window motion events capture, seems to work correctly both 
on linux and win32.

Bye,
 Gabry


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list