Re: Error showing widgets from a thread



Hello,

On Mon, Jul 10, 2006 at 03:33:57PM +0200, Armin Burgmeier wrote:
> > I have a problem where some widgets do not show up after a
> > gtk_widget_show() in a second thread. Below is a small test case.
> > 
> > In the main program a notebook with two pages is created. On the second
> > page is a scrolled window with a viewport, a vbox, and a button. In a
> > second thread a second button is added to the vbox inside the viewport.
> 
> I am not quite sure whether this could cause the problem, but have you
> considered calling gdk_flush right before gdk_threads_leave to send any
> pending requests to the X server?

Yes, I tried that. But it does not change anything, and causing a window
redraw by e.g. minimizing the window does not change anything as well. So
X requests which are not send to the server should not be the problem.

After some further investigation it seems that the size requisition/allocation
is not performed correctly for the button which is created in the thread. If
the second notebook page is visible during creation of the second button, its
requisition and allocation are:
    requisition = {width = 33, height = 24},
    allocation = {x = 0, y = 39, width = 173, height = 24}

But if I switch to the second page after the button was created and then
wait some seconds (to be sure that any idle handler finished), the button
requisition and allocation are:
    requisition = {width = 0, height = 0}
    allocation = {x = -1, y = -1, width = 1, height = 1}
After pressing the first button these values get somehow fixed and the
second button shows up.

But I do not have any idea why the requisition/allocation does not work
correctly in this case.

Thanks,

Frank



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