XCopyArea: covered areas - Xwindows

This is a discussion on XCopyArea: covered areas - Xwindows ; Hallo, i want to copy the contents of a source window into a destination window when getting an Expose-Event for the source window. Windows which hide the source window should NOT be displayed in the destination window (i have a ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: XCopyArea: covered areas

  1. XCopyArea: covered areas

    Hallo,

    i want to copy the contents of a source window into a destination
    window
    when getting an Expose-Event for the source window.

    Windows which hide the source window should NOT be displayed
    in the destination window (i have a map which i want to copy).
    If the source window is not covered by any other window ,
    everything is ok. But when i move any window (perhaps a terminal
    window)
    over the window which has to be copied an then copy the contents of
    the
    source window, the result is confuesd (the line which are displayed in
    the
    source window are moved and broken in the destination window).
    I think that the area which is coverd will not be copied well.

    I found out that when i move a window slowly over
    the source window it sometimes works well, but when i get faster,
    the result is bad.
    Here is a bit of my code

    s_win is my source window with my map
    dest_win is my destination window.

    pixmap = XCreatePixmap (disp, s_win, (unsigned int)canvasPtr->width,
    (unsigned int)canvasPtr->height, (unsigned int) depth);
    XCopyArea (disp,s_win, pixmap, gc, 0, 0, (unsigned int)canvasPtr-
    >width,(unsigned int)canvasPtr->height, 0, 0);

    XCopyArea (disp,pixmap, dest_win,gc, 0, 0, (unsigned int)canvasPtr-
    >width,(unsigned int)canvasPtr->height, 0, 0


    Does anyone has an idea?

  2. Re: XCopyArea: covered areas

    jubi wrote:
    > Hallo,
    >
    > i want to copy the contents of a source window into a destination
    > window
    > when getting an Expose-Event for the source window.
    >
    > Windows which hide the source window should NOT be displayed
    > in the destination window (i have a map which i want to copy).
    > If the source window is not covered by any other window ,
    > everything is ok. But when i move any window (perhaps a terminal
    > window)
    > over the window which has to be copied an then copy the contents of
    > the
    > source window, the result is confuesd (the line which are displayed in
    > the
    > source window are moved and broken in the destination window).
    > I think that the area which is coverd will not be copied well.
    >
    > I found out that when i move a window slowly over
    > the source window it sometimes works well, but when i get faster,
    > the result is bad.
    > Here is a bit of my code
    >
    > s_win is my source window with my map
    > dest_win is my destination window.
    >
    > pixmap = XCreatePixmap (disp, s_win, (unsigned int)canvasPtr->width,
    > (unsigned int)canvasPtr->height, (unsigned int) depth);
    > XCopyArea (disp,s_win, pixmap, gc, 0, 0, (unsigned int)canvasPtr-
    >
    >>width,(unsigned int)canvasPtr->height, 0, 0);

    >
    > XCopyArea (disp,pixmap, dest_win,gc, 0, 0, (unsigned int)canvasPtr-
    >
    >>width,(unsigned int)canvasPtr->height, 0, 0

    >
    >
    > Does anyone has an idea?


    What you want to do will not work on many (most?) graphics adapters.
    In general, the X server uses a single frame buffer area for the screen
    space and the top window at any point on the screen owns that buffer
    area. (Windows on two different planes (overlay vs base plane) don't
    have this problem so an Expose event wouldn't be issued in that case.)
    The fact that the program received an Expose event should tell it that
    the area being exposed will contain indeterminant data. This means
    that the data that may have been in the source window is gone and cannot
    be retrieved from the window. In fact, if you drew into the source
    window when another window is on top of it, the data you drew will not
    be put into the covered area at all (...the hardware clippers on the
    adapter will make sure of that...).

    Jim Lahue

  3. Re: XCopyArea: covered areas

    jubi wrote:
    > Hallo,
    >
    > i want to copy the contents of a source window into a destination
    > window
    > when getting an Expose-Event for the source window.
    >
    > Windows which hide the source window should NOT be displayed
    > in the destination window (i have a map which i want to copy).
    > If the source window is not covered by any other window ,
    > everything is ok. But when i move any window (perhaps a terminal
    > window)
    > over the window which has to be copied an then copy the contents of
    > the
    > source window, the result is confuesd (the line which are displayed in
    > the
    > source window are moved and broken in the destination window).
    > I think that the area which is coverd will not be copied well.
    >
    > I found out that when i move a window slowly over
    > the source window it sometimes works well, but when i get faster,
    > the result is bad.
    > Here is a bit of my code
    >
    > s_win is my source window with my map
    > dest_win is my destination window.
    >
    > pixmap = XCreatePixmap (disp, s_win, (unsigned int)canvasPtr->width,
    > (unsigned int)canvasPtr->height, (unsigned int) depth);
    > XCopyArea (disp,s_win, pixmap, gc, 0, 0, (unsigned int)canvasPtr-
    >>width,(unsigned int)canvasPtr->height, 0, 0);

    > XCopyArea (disp,pixmap, dest_win,gc, 0, 0, (unsigned int)canvasPtr-
    >>width,(unsigned int)canvasPtr->height, 0, 0

    >
    > Does anyone has an idea?


    You could possibly use the XDamage extension to save and restore regions
    of the window that become obscured/damaged by other windows. At least,
    that's what I understand XDamage to do. Otherwise what you want is not
    portably possible.


    George

+ Reply to Thread