Re: [gtk-list] Re: problem with threads and toggle button



Hi,

I managed to find the solution :-)

As I have thought, the problem was that the toggle button was grabing
the mouse and never giving it back to the application because it was
disabled by the threaded function. The solution was simply to add before
the disabling these lines:

if( form->_pause->Widget() == gtk_grab_get_current())
  gtk_grab_remove(form->_pause->Widget());

_pause->Widget() returns the GtkWidget * of the toggle.

But this makes me believe that there is a problem in  
gdk_threads_enter() or in the design of the toggle. Please correct me if
I am wrong.

TIA,

Ionutz

Ionutz Borcoman wrote:
> 
> Ionutz Borcoman wrote:
> >
> > My program have some toggle buttons that can set other buttons depending
> > on which button is toggled. Some of them can be also disabled. Checking
> > the run button, a thread is started and soem of the buttons are
> > disabled, including the run button. The pause button is enabled.
> >
> > When I click the pause, I can suspend the thread. When the thread stops,
> > depending of several conditions, it can disable the pause.
> >
> > Now the problem:
> >
> > When the threaded function ends, I enter the main gtk loop to set some
> > of the buttons. i use:
> >   gdk_threads_enter();
> >   ....
> >   gdk_threads_leave();
> >
> > This work almost always, unless I hapen to do this: keep mouse button
> > press down in the pause button when the threads ends and the thread
> > tries to disabled it. If I comment the line (from the threaded function)
> 
> Hi,
> 
> after further investigation it looks like the problem is that the mouse
> is grabbed by the toggle button when I click, but never released as the
> toggled button is disabled and fails to receive the release event. Is
> this a bug in the toggle ? Can this be corrected somehow by my program ?
> 
> What makes me believe this is that the window is redrawn when I resize
> it and close event is handled normaly. I even get the cross mouse when I
> move the mouse over the active part of the separator of the panned. But
> nothing else (like prelight, click, ....).
-- 
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]