[cairo] Error: Target surface has been finished
Jonathon Jongsma
jonathon at quotidian.org
Sun Jan 25 09:41:30 PST 2009
On 01/25/2009 02:12 PM, Evan White wrote:
> Ok, so what i really should do is have my signal some how point to my
> expose event and re-expose the drawing surface every time i receive some
> type of data doesn't matter if its from my test file or when I'm
> actually using serial/usb to communicate with our hardware. my one
> question is how would i have it re-expose the window based on a new line
> of data coming in?
Well, we're now getting a bit off-topic for the cairo mailing list, these are
mostly gtk/gtkmm questions. So if you need further help, I'd suggest moving to
the gtkmm list (see http://www.gtkmm.org/mailinglist.shtml). But in essence,
whenever you have an event that should cause something new to be drawn, you'll
want to invalidate the widget by calling something Gtk::Widget::queue_draw()
(and possibly set some flag or update some data in your object so that next time
the expose event happens you'll know what needs to be drawn).
> >> Well, I don't see any direct calls to drawGuage in your signal_io
> callback
>
> drawGauge was called in processSpeed after i processed the value
> received and translated it into and angle.
>
> >> As a general rule of thumb, *never* draw anything to the screen
> outside of an expose event.
>
> I broke up my objects that are to be drawn to the screen into separate
> methods so that I could draw one thing instead of another based on the
> input I anticipated to receive
Yes, there's nothing wrong with grouping separate objects into separate classes
/ methods. But they should generally only be called within the expose event
handler.
> This is just a default gauge screen I am working on the main goal for
> our project is to allow the user to pick and choose how they would like
> their instrument cluster to be arranged. we plan to use an XML file to
> define a custom skin that they make using PNG files. also the user will
> be able to setup multiple scenes so that they could change their gauge
> configuration on the fly based on some input. Could you give me some
> pointers on how best to accomplish this, where each gauge is its own c++
> object so is each scene.
It's a bit difficult to give any specific and helpful advice without knowing
quite a bit more detail about your setup, but hopefully the information above
can get you started.
Good luck,
jonner
More information about the cairo
mailing list