Re: drawing area and GPtrArray illogical error



frederico schardong <frede sch gmail com> writes:

When I click with the mouse on the drawing area the callback
button_pressed is called and the g_print message shows, and when I
move the window the callback expose_event is called and shows its
g_print. The only difference between both g_print is the first word,
in other words, o parray is correct and the points should be drawned
in the drawing area. But that isn't happening.

Does anyone have an idea about it?

Instead of drawing the points in the button press handler, just queue
a repaint for the drawing area and let the expose handler take care of
the drawing:


static gboolean button_pressed (GtkWidget *a, GdkEventButton *event, GtkDesenho *desenho)
{
        gtk_widget_queue_draw (a);

        return FALSE;
}

Generally, you should not draw in things like event handlers, only in
the expose handler. This lets gtk+ do automatic double buffering and
combine multiple repaints into one.


Soren



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