I am building an application that monitors a signal that is being digitized and the samples are delivered to the serial port.
There are two threads of execution, one is handling reading and decoding of the incoming stream of data and the other is handling processing. For the time processing involves only plotting the data to the surface of a widget. There is a double linked list with mutex protection so that two buffer areas can not be accessed concurrently. A simpler way to visualize the operation of these two threads is taking the Read and decode thread as the producer of buffers and the processing thread as the consumer of buffers. For the time, when a buffer becomes available it gets drawn immediately.
The reading and decoding thread works OK but problems gloom when i try to plot the function. The problems are as follows:
1. Several captured frames are printed one on top of the other
2. Some times i get some error messages from the X Window Server and some times i get Critical Errors from GDK.
I am more inclined towards believing that my problems are focused in the plotting procedure. This is a very simple procedure where i draw a simple black rectangle around the widget and then set up an array of GdkPoints and then call the function that draws lines from these points...When this function is put to the OnClick of a button it works with no problems...Also i believe that its also going to work if i hook it up on a timer, but i dont like this solution, i would like to be able to plot the data as soon as i have it available.
Additionaly i can not find a way to invalidate the widget (as i would do in Win for example). (I have read the official and unofficial docs, Tutorials, i have tested some code which is supposed to invalidate the region, but no luck)
If that makes sense, is there anyone out there with any suggestions on this problem?
Thanks in advance for any help you wish to provide thanOS
P.S. I really like the concept of GTK but i believe that the project would be highly benefited from a document that describes its architecture and gives the bigger picture about the operation of Gtk / Gdk. Just by reading the documentation it is not obvious which fields in all these structures need to be modified in order to achieve something...In case i have not searched enough....is there anything like this available on the internet? (Or in any format, book, scribled stones....anything)
gtk-app-devel-list mailing list