window should repaint - Xwindows

This is a discussion on window should repaint - Xwindows ; Hi When i resize the window, part the window become black out, i think i should repaint it, so how can i get the repaint event and what function i can use to repaint the GC to the display? thanks ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: window should repaint

  1. window should repaint

    Hi
    When i resize the window, part the window become black out, i think
    i should repaint it, so how can i get the repaint event and what
    function i can use to repaint the GC to the display?
    thanks
    from Peter (cmk128@hotmail.com)


  2. Re: window should repaint

    In comp.windows.x, cmk128@hotmail.com

    wrote
    on 25 Sep 2006 10:19:35 -0700
    <1159204775.872472.75480@m7g2000cwm.googlegroups.co m>:
    > Hi
    > When i resize the window, part the window become black out, i think
    > i should repaint it, so how can i get the repaint event and what
    > function i can use to repaint the GC to the display?
    > thanks
    > from Peter (cmk128@hotmail.com)
    >


    The new size of the window can be had by specifying StructureNotifyMask,
    then processing ConfigureNotify in one's event loop. Note that
    ConfigureNotify events are generated any time the window is moved
    or resized -- moving may not require redraw, or it might, depending
    on window manager (though most nowadays try to preserve the window
    as it moves on the desktop, unless one tells them not to). If you want
    to scale your lines, etc., you will probably need that window size.

    Window Expose events can be had by using ExposureMask either during
    window creation or by calling XSelectInput() later. These events
    will tell you the part of the window that need redrawing upon their
    receipt.

    XGraphicsExpose and XNoExpose probably needn't concern you, and I'd
    frankly have to study them myself. Unless you're using a pixmap
    to cache your drawing you probably needn't worry yourself with
    them.

    Expose events include a count, as a hint of the number of Expose events
    known following; this may be useful.

    You can also specify bitgravity, which might simplify things slightly,
    depending on what you're doing. For example, specifying bitgravity of
    CenterGravity will allow one to resize a window that represents a map
    at a fixed scale, expanding the map without changing the centerpoint.
    (Note that some care may be needed in redrawing the newly exposed
    areas; I'll admit I've not tried this. A "half-off" error here might
    result in slight discrepancies, since coordinates must be integers.)

    If one specifies ForgetGravity, the entire window will need to be
    redrawn. This may be an advantage for those applications who wish
    to rescale their graphics as opposed to merely expand their viewing
    area.

    Many of the functions can be used to repaint, for the most part; in fact,
    that's more or less the idea. :-) However, one does not repaint the
    GC (though one can specify tile and stipple); the GC is a graphics
    context and specifies state important to the drawing process; this state
    includes but is not limited to:

    - foreground color
    - background color
    - tile pixmap (same depth as window)
    - stipple pixmap (must be depth 1)
    - clip region (usually a set of exactly one clip rectangle, or
    the entire window)
    - font
    - line thickness
    - line style (solid, dashed)
    - for dashed lines, dash length(s)
    - cap style (rounded, butted, squared)
    - join style (rounded, mitered, beveled)

    Some care is needed if you with to redraw rubberbands (XGCValues.function =
    GxXOR). If the window has a background pixel or pixmap clipping before
    redraw on an Expose should be enough; if one sees a mouse movement which
    changes the rubberband one should make sure the clip region is set to
    None.

    HTH

    --
    #191, ewill3@earthlink.net
    Windows Vista. Because it's time to refresh your hardware. Trust us.

+ Reply to Thread