[Glade-users] Sending events (somewhat OT)
Lukasz Gromotowicz
gromot at gmail.com
Tue Mar 17 04:01:25 EDT 2009
Trivial question - do you enable gtk threads in your application and do you
use gdk_thread_enter() and gdk_threads_leave() before accessing TreeView
from the second (USB) thread?
Regards,
LUK
2009/3/15 Steve <zephod at cfl.rr.com>
>
> ---- Tristan Van Berkom <tristan.van.berkom at gmail.com> wrote:
> > On Sat, Mar 14, 2009 at 12:28 AM, Steve Blackwell <zephod at cfl.rr.com>
> wrote:
> > > I have written a program using glade 3 that has 2 threads. The main
> > > thread handles user input from the GUI while the second thread monitors
> > > a USB port for input. When data arrives at the USB port, it is
> processed
> > > and written to a GtkTreeView widget.
> > >
> > > The problem is that the data does not appear in the TreeView until I
> > > move the mouse or press a key. I think that this is because the main
> > > thread controlling the GUI is blocking in gtk_main() until an event
> > > arrives. So I added code to the second thread to send a
> > > GDK_CLIENT_EVENT to the GtkDialog widget that contains the TreeView.
> > >
> > > It didn't work.
> >
> > When you recieve data from your USB in your worker thread; call
> > g_idle_add() to schedule a one time idle function in the main thread.
> >
> > From that function - call gtk_widget_queue_draw() on your treeview.
>
> Unfortunately, that didn't work. I get the same results as before - ie the
> data is only displayed after a mouse or keyboard event is received. I also
> tried g_idle_add_full() and set the priority to G_PRIORITY_HIGH_IDLE but no
> luck there either.
>
> Tomorrow I'll think about sending the data back to the UI thread and have
> that write to the treeview.
>
> Thanks,
> Steve
>
> _______________________________________________
> Glade-users maillist - Glade-users at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20090317/c188c0ca/attachment.html
More information about the Glade-users
mailing list