Re: [gtk-list] Bug in Toggle Button {Was: problem with threads and toggle button]
- From: Damon Chaplin <damon karuna freeserve co uk>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Bug in Toggle Button {Was: problem with threads and toggle button]
- Date: Wed, 09 Jun 1999 19:39:14 +0100
Ionutz Borcoman wrote:
>
> Ionutz Borcoman wrote:
> >
> > if( form->_pause->Widget() == gtk_grab_get_current())
> > gtk_grab_remove(form->_pause->Widget());
> > But this makes me believe that there is a problem in
> > gdk_threads_enter() or in the design of the toggle.
>
> Hi,
>
> This was not enough. Though it removed the lock, it made the button act
> strange when enabled, because it button_down was scrued. The complete
> solution (for my case) is like this:
>
> GtkButton *btn = GTK_BUTTON(form->_pause->Widget());
> if( GTK_WIDGET(btn) == gtk_grab_get_current()){
> gtk_grab_remove( GTK_WIDGET(btn) );
> if( btn->button_down )
> btn->button_down = ! btn->button_down;
> }
>
> Now I think that the problem is more in the ToggleButton than in the
> gdk_thread_enter. And I believe the button should check if it needs to
> release the grabb when it is disabled and return to its previous state
> (act like the user has released the mouse outside the button's area, to
> cancel its action.) I didn't check other buttons, but I think all
> buttons should behave this way. Please correct me if I'm wrong.
I think the problem is partly caused by GTK+ not passing some GDK events on to
widgets which are insensitive. (See gtk_propagate_event() in gtk/gtkmain.c)
So if you are pressing a button, and it is set insensitive from another
thread, then it won't receive the button release event. So it won't release
the grab, and it may be in a bit of a weird state internally.
Is GTK+ supposed to be thread-safe?
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]