Re: The Window expose-event with gtk_window_resize() problem:



On Tue, 6 Jul 2004 09:58:28 -0400, Tom Liu <tom liu flextrade com> wrote:
If you set the double_buff off, you still get two expose, only thing is
that the next expose cover's the first expose, make it looks ok.

Also,  this problem looks only happens to GtkWindow? Why we need to call
gtk_widget_set_app_paintable for GtkWindow to print and we don't need to
call this function for the other widgets such like eventbox etc.

I'm not sure how to fix this either, but if you change your expose
handler to this, I think it (maybe) gets a bit clearer what's going
on:

static gboolean expose(GtkWidget * widget, GdkEventExpose *event, gpointer
data)
{
       int x,y,w,h;

{
        GdkRectangle *rect;
        int i, n;

        printf( "expose bounding box: x = %d, y = %d, w = %d, h = %d\n",
                event->area.x, event->area.y,
                event->area.width, event->area.height );

        gdk_region_get_rectangles( event->region, &rect, &n );
        for( i = 0; i < n; i++ )
                printf( "expose %d: x = %d, y = %d, w = %d, h = %d\n", i,
                        rect[i].x, rect[i].y, rect[i].width, rect[i].height );
        g_free( rect );
}

  ... as before
}

If I run this, when I click on the window I see:

expose bounding box: x = 0, y = 0, w = 200, h = 200
expose 0: x = 0, y = 0, w = 200, h = 200
Debug:try102.c,29:expose:wid:200,hi:200,
expose bounding box: x = 0, y = 0, w = 220, h = 220
expose 0: x = 200, y = 0, w = 20, h = 200
expose 1: x = 0, y = 200, w = 220, h = 20
Debug:try102.c,29:expose:wid:220,hi:220,

So the first expose event you see is for the whole of the old size
window. The second expose event is actually two exposes: it's the
strip down the right and the strip across the bottom being added to
your window.

In the second expose, your gdk_window_clear() is only wiping the
strips across the bottom and down the right. I guess the
double-buffering is copying the exposed parts back to the screen, not
their bounding box.

John



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