XClearArea painting None-background windows?

Glynn Clements glynn at gclements.plus.com
Fri Oct 20 04:24:23 PDT 2006


sukru cinar wrote:

> I'm making a simple X11 application and got stuck. I
> create a window using
> 
> v->window= XCreateSimpleWindow(xdpy, parent,x,y
>       ,w,h, 3, 0, None);
> 
> When the widget needs to be updated, I invalidate
> the whole window by
> 
> XClearArea(xdpy, v->window, 
>   0,0, v->width, v->height,
>   True);
> 
> Then, I XShmPutImage the computed image on the window,
> inside the Expose event handler. 
> 
> From what I read in the XClearArea manual page I
> understand that the image should overwrite the
> previous contents of the window, w/o any clearing of
> the window in between.

That's incorrect.

> However, I can see a black flicker when this code runs.  

That's to be expected.

> I don't understand why this happens. Is the generation
> of an Expose clearing the window? What am I missing in
> this code? 

XClearArea actually repaints the window using its background colour
(or background pixmap). It doesn't just"invalidate" it.

If you just want to trigger your redraw handler, either send yourself
an Expose event with XSendEvent, or just call the redraw handler
directly.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list