newbie: GtkListView redraw (again)



I apologize for asking yet another redraw question.  From the
archives, it looks like a popular topic.  I haven't found a good
answer yet, alas.

The application is multi-threaded, with 1 'GTK thread' running the app
and N 'listener threads' listening to the network.  The GTK consists
of a simple GtkListView.  When a network packet comes in, the data in
the packet is added to the end of the GtkListStore, and optionally
older data is removed from the top of the list.

Note that this requires the 'listener threads' to call a
'add_to_list_store' function.  It is protected by a g_static_mutex and
I don't seem to have any contention problems, even at high speeds.

The app seems to work fine, but I can't seem to get it to redraw
the tree _except_ when the app is getting Xevents.  If I just run the
app, it won't redraw -- I have to scroll the mouse around, or press
keys.

I've tried gtk_widget_queue_draw( ); in a few
different places, with no luck.

I've tried the traditional approach of adding an idle function up at
the top level which calls gtk_main_iteration_do( FALSE ).  It works,
but consumes significant CPU resources idling away.

I've tried gtk_main_iteration_do( FALSE ) within the
'add_to_list_store,' but it causes contention issues, even with
mutexing.  I've had 'add_to_list_store' add idle and timeout functions
as necessary, typically removing them after 1 iteration -- but they
only seem to run when the app gets X events...?

Is there another strategy that I'm missing?


Thanks,

Aaron Marsh
Bluefin Robotics
marsh bluefinrobotics com



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