how to reduce picture redraw when drag open dialog - Motif

This is a discussion on how to reduce picture redraw when drag open dialog - Motif ; Hello. How to reduce picture redraw when drag open dialog by mouse. I have refresh function which makes graphics to redraw many times, like jello shaking, it is annoying, lower I try to block redrawing using every 2, 3 redraw ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: how to reduce picture redraw when drag open dialog

  1. how to reduce picture redraw when drag open dialog

    Hello.
    How to reduce picture redraw when drag open dialog by mouse.
    I have refresh function which makes graphics to redraw
    many times, like jello shaking, it is annoying, lower I try
    to block redrawing using every 2, 3 redraw to skip,
    on my laptop with 700Mhz it is ok, slow, but on 1GHz
    machine it is still shaking like crazy.
    Any ideas?
    Valeri
    ambal007@netzero.net

    wait_expose(w)
    Widget w ;
    {
    XEvent event ;

    do {
    XtAppNextEvent(app_context , &event) ;
    XtDispatchEvent(&event) ;
    }
    while (event.type != Expose ||
    event.xexpose.window != XtWindow(w)) ;
    }

    int no_redraw;//VK reduce picture redraw while drag open dialog
    int kk=0;//VK reduce picture redraw while drag open dialog

    void refresh(w , client_data , call_data)
    Widget w ;
    XtPointer client_data , call_data ;
    {
    if (working)
    return ;

    if (numpics == 0)
    return ;

    kk++;//VK reduce picture redraw while drag open dialog
    if(no_redraw && (kk%2)) return;//VK
    if(no_redraw && (kk%3)) return;//VK
    if(no_redraw && (kk%4)) return;//VK
    if(!kk%4) kk=0;//VK

    XCopyArea(thedisp , zirim , thewindow , thegc , 0 , 0 ,
    (int)(winx*1.13) ,
    winy , 3 , 3) ;
    XCopyArea(thedisp , pics[curpic].pix , thewindow , thegc , 0 , 0 ,
    swinx , swiny , (int)(0.1*winx)+3 , (int)(0.1*winy)+3) ;
    XFlush(thedisp) ;
    }


  2. Re: how to reduce picture redraw when drag open dialog

    Valeri wrote:
    > Hello.
    > How to reduce picture redraw when drag open dialog by mouse.
    > I have refresh function which makes graphics to redraw
    > many times, like jello shaking, it is annoying, lower I try
    > to block redrawing using every 2, 3 redraw to skip,
    > on my laptop with 700Mhz it is ok, slow, but on 1GHz
    > machine it is still shaking like crazy.
    > Any ideas?


    It is wrong to randomly skip certain % of events.
    You should process them all, and examine the event structure
    and expose just what needs to be redrawn, not the whole window.
    http://www.die.net/doc/linux/man/man...seevent.3.html
    You check event.xexpose.window, but why do you
    disregard event.xexpose.x, y, width, height?

    If you want to be lazy and do full window redraw,
    then use "count" to skip redraw if more events are in the queue.
    But in my experience, this does not always work.

    On a side note, if you want to write fast programs,
    avoid integer division and % at all costs.
    It is an order of magnitude slower than multiplication.
    Next time you need to do "k%2" write "k&1".

    Hope this helps,

    DuĊĦan Peterc
    http://www.arahne.si

  3. Re: how to reduce picture redraw when drag open dialog


    "Valeri" wrote in message
    news:1165005910.494821.217430@73g2000cwn.googlegro ups.com...
    > Hello.
    > How to reduce picture redraw when drag open dialog by mouse.
    > I have refresh function which makes graphics to redraw
    > many times, like jello shaking, it is annoying, lower I try
    > to block redrawing using every 2, 3 redraw to skip,
    > on my laptop with 700Mhz it is ok, slow, but on 1GHz
    > machine it is still shaking like crazy.
    > Any ideas?
    > Valeri
    > ambal007@netzero.net
    >
    > wait_expose(w)
    > Widget w ;
    > {
    > XEvent event ;
    >
    > do {
    > XtAppNextEvent(app_context , &event) ;
    > XtDispatchEvent(&event) ;
    > }
    > while (event.type != Expose ||
    > event.xexpose.window != XtWindow(w)) ;
    > }
    >
    > int no_redraw;//VK reduce picture redraw while drag open dialog
    > int kk=0;//VK reduce picture redraw while drag open dialog
    >
    > void refresh(w , client_data , call_data)
    > Widget w ;
    > XtPointer client_data , call_data ;
    > {
    > if (working)
    > return ;
    >
    > if (numpics == 0)
    > return ;
    >
    > kk++;//VK reduce picture redraw while drag open dialog
    > if(no_redraw && (kk%2)) return;//VK
    > if(no_redraw && (kk%3)) return;//VK
    > if(no_redraw && (kk%4)) return;//VK
    > if(!kk%4) kk=0;//VK
    >
    > XCopyArea(thedisp , zirim , thewindow , thegc , 0 , 0 ,
    > (int)(winx*1.13) ,
    > winy , 3 , 3) ;
    > XCopyArea(thedisp , pics[curpic].pix , thewindow , thegc , 0 , 0 ,
    > swinx , swiny , (int)(0.1*winx)+3 , (int)(0.1*winy)+3) ;
    > XFlush(thedisp) ;
    > }
    >


    In your expose event handler, call XCheckTypedWindowEvent().
    Perform the XCopyArea only if there are no other expose
    events on your window in the queue. Something like:
    if ( !XCheckTypedWindowEvent( dpy, win, Expose, &ev))
    {
    XCopyArea(...);
    }
    --
    Fred L. Kleinschmidt
    Boeing Associate Technical Fellow
    Technical Architect, Software Reuse Project




+ Reply to Thread