Re: Image sequence problem

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

 



On Thu, 9 Feb 2006, Schevon, Catherine wrote:

> I'm working on an application that shows an image sequence alternating
> with short time delays (on the order of 500 - 1000 milliseconds).  The X
> instructions I'm using are:
>
> window = XCreateSimpleWindow (display, screen, etc);
> XMapWindow (display, window);
> XFlush (display);

    The window isn't mapped until you get the MapNotify event.
If you continue at this point, you will be displaying stuff to
an unmapped window until the window manager gets around to
displaying your window.

> while {
> 	XClearWindow(display);

    This clears the window to whatever the background is currently
set to.

> 	XSetWindowBackgroundPixmap (display, window, pixmap);

    This just changes the background that the X-server associates
with the window.  It does not display the new background until
an exposure or an explicit clear.

> 	XFlush (display);
> 	nanosleep (delay)
> }
>
> with a different pixmap and delay period each time.  What I'm finding is
> that the initial (blank) window is displayed correctly, but subsequent
> images are displayed at the beginning of the NEXT iteration; thus, the
> blank window stays up through the first loop iteration and call to
> nanosleep, followed by the first image (displayed at the time the second
> image should be up), and the last one is not displayed at all.  It's as
> if the XFlush() command doesn't work for the last event entered.
> However, when I checked there were no pending events in the queue.
>
> Of course I can work around this but I never liked inelegant solutions.
> Are there any obvious errors in this simple scheme?

   It sounds like you are making the incorrect assumption that
XSetWindowBackgroundPixmap includes an implicit clear.  It does
not.  You probably want to change the order of your
XSetWindowBackgroundPixmap and XClearWindow calls.


		Mark.

_______________________________________________
XFree86 mailing list
XFree86@xxxxxxxxxxx
http://XFree86.Org/mailman/listinfo/xfree86

[Index of Archives]     [X Forum]     [Xorg]     [XFree86 Newbie]     [IETF Announce]     [Security]     [Font Config]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux Kernel]

  Powered by Linux