Re: Drawing Area issues ( continued, with example )

On Tue, Oct 10, 2017 at 09:38:03PM +1100, Daniel Kasak wrote:
I've cut down my app to a "relatively small" example which doesn't
need a database connection or loads of other stuff. It's still 400+
lines ( with lots of whitespace ). I know it's asking a lot, but if
someone can figure out what I'm doing wrong, I'd be very grateful ...

Your issues stem from the creation of multiple contexts referencing the
DrawingArea surface within the 'draw' callback, i.e.

my $surface = $cairo_context->get_target;
# and later..
my $this_stat_context = Cairo::Context->create( $surface );

If you re-write your code without doing this -- just use the context passed into the 'draw' signal callback along with save() and restore() -- I think you will find your issues disappear. I haven't completely re-written your code, but I tested on one small bit and it had the desired effect.

Why this happens is a little bit hazy to me. If you print the values
passed into the 'draw' callback, you can see that all of the pointers to the cairo context are the same for the different DAs. Somehow this gets sorted out if you just use the context as given, but my guess is that when you are calling get_target() it returns the surface for the first DrawingArea only, and then your issues arise.


Civilization is the limitless multiplication of unnecessary necessities.
                -- Mark Twain

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