diff options
author | Jérémie Laval <jeremie.laval@gmail.com> | 2013-10-19 02:37:39 +0400 |
---|---|---|
committer | Jérémie Laval <jeremie.laval@gmail.com> | 2013-10-19 02:37:39 +0400 |
commit | 7b64262fe926a8aa35354ce343e4146887340c0a (patch) | |
tree | ae0bfb4cebdf95d61d6ce2353ab5590a726b5bb6 /Xwt.Mac | |
parent | c0fb2787ba440f15c90e59b8c3b5bf2c9274b561 (diff) |
[Xwt.Mac] Schedule NSTimer on both runloop main mode and modal mode.
If we don't do this, any dialog brought up with NSApplication.RunModalForWindow will stop timers from firing.
Diffstat (limited to 'Xwt.Mac')
-rw-r--r-- | Xwt.Mac/Xwt.Mac/MacEngine.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Xwt.Mac/Xwt.Mac/MacEngine.cs b/Xwt.Mac/Xwt.Mac/MacEngine.cs index 588a1a2d..f4e15226 100644 --- a/Xwt.Mac/Xwt.Mac/MacEngine.cs +++ b/Xwt.Mac/Xwt.Mac/MacEngine.cs @@ -168,10 +168,13 @@ namespace Xwt.Mac public override object TimerInvoke (Func<bool> action, TimeSpan timeSpan) { NSTimer timer = null; - timer = NSTimer.CreateRepeatingScheduledTimer (timeSpan, delegate { + var runLoop = NSRunLoop.Current; + timer = NSTimer.CreateRepeatingTimer (timeSpan, delegate { if (!action ()) timer.Invalidate (); }); + runLoop.AddTimer (timer, NSRunLoop.NSDefaultRunLoopMode); + runLoop.AddTimer (timer, NSRunLoop.NSRunLoopModalPanelMode); return timer; } |