[cairo] How to refer Cairo::Context outside on_expose_event

Kalle Vahlman kalle.vahlman at gmail.com
Tue May 5 23:26:04 PDT 2009


2009/5/5 Murray Cumming <murrayc at murrayc.com>:
> On Mon, 2009-05-04 at 10:14 +0800, 陈凯 wrote:
>> Unfortunately, the execution always crashes because get_window() in
>> the constructor returns NULL.
>
> That's because get_window() never returns the GDK window until the
> widget is realized. That means that the earliest you can discover it is
> in on_realize().
>
> But I don't know if you can keep the cairo context like that instead of
> getting it each time.

You can't, since usually it will be a context for a temporary surface,
not for the actual window.

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.com
Interesting stuff at http://sandbox.movial.com
See also http://syslog.movial.fi


More information about the cairo mailing list