mirror of
https://github.com/TermiT/Flycut.git
synced 2025-09-21 12:34:33 +08:00
Move pollPBTimer to a run loop and mode that allows it to keep firing while the menu is open.
This commit is contained in:
parent
c125b4de17
commit
5a81af5942
1 changed files with 10 additions and 6 deletions
|
@ -150,12 +150,16 @@
|
|||
}
|
||||
|
||||
// Build our listener timer
|
||||
pollPBTimer = [[NSTimer scheduledTimerWithTimeInterval:(1.0)
|
||||
target:self
|
||||
selector:@selector(pollPB:)
|
||||
userInfo:nil
|
||||
repeats:YES] retain];
|
||||
|
||||
NSDate *oneSecondFromNow = [NSDate dateWithTimeIntervalSinceNow:1.0];
|
||||
pollPBTimer = [[NSTimer alloc] initWithFireDate:oneSecondFromNow
|
||||
interval:(1.0)
|
||||
target:self
|
||||
selector:@selector(pollPB:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
// Assign it to NSRunLoopCommonModes so that it will still poll while the menu is open. Using a simple NSTimer scheduledTimerWithTimeInterval: would result in polling that stops while the menu is active. In the past this was okay but with Universal Clipboard a new clipping an arrive while the user has the menu open.
|
||||
[[NSRunLoop currentRunLoop] addTimer:pollPBTimer forMode:NSRunLoopCommonModes];
|
||||
|
||||
// Finish up
|
||||
srTransformer = [[[SRKeyCodeTransformer alloc] init] retain];
|
||||
pbBlockCount = [[NSNumber numberWithInt:0] retain];
|
||||
|
|
Loading…
Add table
Reference in a new issue