[Interest] Finished resizing a window?

william.crocker at analog.com william.crocker at analog.com
Tue Feb 25 19:08:34 CET 2014


On 02/25/2014 12:56 PM, Thiago Macieira wrote:
> Em seg 24 fev 2014, às 14:30:29, John Weeks escreveu:
>> On 24-Feb-2014, at 2:24 PM, Thiago Macieira wrote:
>>> That's something entirely controlled by the window manager. Sorry.
>>
>> Thanks, Thiago. That's good to know.
>
> Here's a suggestion: do a delayed repainting after you get a resize event.
>
> If you wait 200 ms before repainting, if the window keeps getting resized, the
> delay keeps resetting. So effectively, you won't repaint until the window
> settles.
>

But if the user pauses for more than 200ms
the expensive redraw will commence and annoy.

Perhaps...

Break the redraw up into a number of parts,
each of which takes a relatively short amount of time.

resize() {
     partToDraw = 1;		// Start over.
     cancelAnyExistingTimer();
     singleshot(200,timeout());
}

// Draw the parts.
// If a new resize arrives, the process restarts
// in a short amount of time, without having to
// wait for the complete redraw to complete.
timeout() {
     drawPart(partToDraw)
     if( ++partToDraw != numberOfParts )
         singleshot(0,timeout();         // Return to event loop.
}





More information about the Interest mailing list