Re: Gtk app partly white when brought to the foreground from behind a window, any thoughts why?



Antony Stace <antony claire co jp> writes:

I have an application(app.x) which I want to make a little better.  If
functions fine except it has the annoying property that if I put part of
the application behind another window and the click the toolbar on app.x
to bring it to the foreground the application comes to the foreground
but the part which was behind the window is all white for a brief
instance of time.  If I run other applications like xclock, xcalc,
netscape, etc this does not happen.  The application consists of a few
gtk drawing areas(about 4 inches high and 2 inches wide(not sure if this
would be classed as a large drawing area)) which remain unchanged for
most of the time so they are not being update.
Is there anything anyone can think of that might be causing this
behaviour?


The reason is that your drawing area has a white background color set,
I would guess. I'm not sure how you did that (normally GTK would set
it to gray by default).

There has to be something in your window between the time it gets
exposed and the time you redraw it. X lets you choose between:

 - background color; the window gets cleared to its background color
 - nothing; set the background to NULL, and whatever was already
   in the framebuffer gets displayed; makes your window look 
   "transparent" for a moment
 - background pixmap; you can set the background to a tiled pixmap

The other apps you mention are probably just redrawing really quickly
and smoothly. The usual way to do that is to draw to a backing pixmap
first, then copy a portion of the backing pixmap to the screen.  You
can keep the pixmap around and handle exposes instantly. See the
"scribble" example in the GTK tutorial.

Havoc




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