Re: [cairo] Context in ExposeEvent with gtkmm



Massimo Redaelli wrote:
> Hi!
> 
> Thanks for the quick answer :)
> 
> On Fri, Jul 24, 2009 at 6:01 AM, Jonathon Jongsma<jonathon quotidian org> wrote:
>> You should not cache the Cairo context between expose events.  That will not work as you expect it to.  You should simply create a new context in each expose handler
> 
> Ok.
> 
>>> bool eWriteWin::onExposeEvent ( GdkEventExpose *event)
>>> {
>>>   std::cerr << "Expose!" << std::endl;
>>>   // cr = pda->get_window()->create_cairo_context();
>> As this commented-out-code does here ^
>>
>>> I tried to create a new context, but I have no idea if that's the
>>> right thing to do (afterall, the ols context works if I draw *after*
>>> the ExposeEvent), and even if it is, how do I get create a c++ Context
>>> (or how do I get the c++ Gtk::Window from event->window)?
>> first of all: I assume that the expose event that you're handling is the drawing area's expose event and not some parent widget's expose event (?).  If so, then the commented-out code above should work fine.
> 
> Yes, it is the drawing area event. But that line doesn't change
> anything: still nothing appears.
> Do I maybe have to get (how?) the window handler through the
> GdkEventExpose parameter of the handler?

no, from what I can tell, your code should work properly.  If you can provide a *minimal* compilable example that still exhibits the problem, I might be able to provide more insight.

Also, please reply on-list so others with input can chime in if they want to

-- 
jonner


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