mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
devdraw: cocoa metal screen adds a delayed update (#270)
The immediate display of the screen sometimes miss the update from the CPU side memory. No obvious synchronization mechanism is available. In order to make sure the screen updates properly, we set needsDisplay again after 16ms delay to ensure a second screen update.
This commit is contained in:
parent
d4e16c838a
commit
e995a0c101
1 changed files with 7 additions and 0 deletions
|
@ -212,12 +212,19 @@ threadmain(int argc, char **argv)
|
|||
+ (void)callsetNeedsDisplayInRect:(NSValue *)v
|
||||
{
|
||||
NSRect r;
|
||||
dispatch_time_t time;
|
||||
|
||||
r = [v rectValue];
|
||||
LOG(@"callsetNeedsDisplayInRect(%g, %g, %g, %g)", r.origin.x, r.origin.y, r.size.width, r.size.height);
|
||||
r = [win convertRectFromBacking:r];
|
||||
LOG(@"setNeedsDisplayInRect(%g, %g, %g, %g)", r.origin.x, r.origin.y, r.size.width, r.size.height);
|
||||
[layer setNeedsDisplayInRect:r];
|
||||
|
||||
time = dispatch_time(DISPATCH_TIME_NOW, 16 * NSEC_PER_MSEC);
|
||||
dispatch_after(time, dispatch_get_main_queue(), ^(void){
|
||||
[layer setNeedsDisplayInRect:r];
|
||||
});
|
||||
|
||||
[myContent enlargeLastInputRect:r];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue