discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheduling functions to be run all the time in runloop


From: Dr . H . Nikolaus Schaller
Subject: Re: Scheduling functions to be run all the time in runloop
Date: Mon, 9 Jul 2012 22:11:36 +0200

Am 09.07.2012 um 21:58 schrieb Ivan Vučica:

> Hi,
> 
> for Core Animation's implicit animations to work properly, I need to schedule 
> creation and flushing of implicit CATransaction whenever event processing is 
> entered, and whenever the runloop code is entered again. This can be either a 
> C function or an Objective-C method, but I need these two pieces of code to 
> run each and every time runloop calls user code and whenever user code is 
> done running.
> 
> Note, I'm not trying to accomplish continuous calling of these methods 
> (that's trivial using e.g. timers); instead, I need these methods to be 
> called, for example, when user chooses a menu item or clicks on a button.
> 
> What's the easiest way to accomplish this?

Since this is similar to the displayIfNeeded-mechanism, I think you have to add 
it to -[NSApplication run] or -[NSApplication runModalSession:]. Maybe it could 
also be added to -[NSApplication updateWindows].

But if you need to have to do this in any tracking loop (usually in 
mouseDown:), you should add it to -[NSApplication nextEventMatchingMask:...].

Please don't think you can add it to NSRunLoop since this is Base and not GUI...

If all this does not work, you could try the applicationWillUpdate / 
applicationDidUpdate notifications.

Nikolaus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]