[Glade-users] Sending events (somewhat OT)




---- Tristan Van Berkom <tristan.van.berkom at gmail.com> wrote: 
On Tue, Mar 17, 2009 at 4:33 PM, Steve <zephod at cfl.rr.com> wrote:

---- Lukasz Gromotowicz <gromot at gmail.com> wrote:
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?

Trivial answer - no.

But seriously, I have since chenged my code so that I don't access the TreeView or any other GTK code 
from the 2nd thread. I now send the data to the 1st thread via a client event. My problem still exists 
though. I still have to move the mouse or press a key to get the data to show up.

This is strange, you say you tried using g_idle_add[_full] instead of
client events and call
gtk_widget_queue_draw (treeview) after updating the model from there
and it still doesnt
work ?

does the queue draw code get called before you move the mouse/press a key ?

The helper thread that handles the USB input data sends a client event containing the data I want displayed 
to the main thread with a gtk_propagate_event ( main_window, client_msg ) call.

In the main UI thread a client event callback on the main_window widget is triggered which writes the data to 
the TreeView widget which is contained in a dialog box which may or may not be displayed at that time. At the 
end of this callback I put a g_idle_add_full ( G_PRIORITY_HIGH_IDLE, trigger_display, NULL, NULL ) call. 
Everything up to this point gets executed when data arrives from the USB but the trigger_display() function 
does not.

Previously I had thought that trigger_display() was called as soon as I moved the mouse but I have now 
realized that it gets called only when I move the mouse over one of the applications windows. Is that an 
enter-notify-event?

Steve.






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