Bug in Toggle Button {Was: problem with threads and toggle button]



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.

TIA,

Ionutz
-- 
Mental backup in progress - Do Not Disturb!
--
http://borco-ei.eng.hokudai.ac.jp/~borco/



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