bugGNUstep - Bugs: bug #25327, NSAnimation no longer works

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25327: NSAnimation no longer works

Submitted by:  Fred Kiefer <FredKiefer>
Submitted on:  Thu 15 Jan 2009 09:49:45 AM UTC  
 
Category: Gui/AppKitSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sat 17 Jan 2009 03:01:21 PM UTC, comment #4:

Great, I would even say better then ever before.

Fred Kiefer <FredKiefer>
Project Member
Fri 16 Jan 2009 02:12:50 PM UTC, comment #3:

I'm fairly confident this is now fixed ... it was a bug in the use of runloops which was hidden by an older bug in the base library and exposed when the base library bug was fixed.

The fix in NSAnimation was to run the runloop if it has inputs, or cause the thread to sleep until the next timeout, or stop if there is neither a timer nor inputs.

Richard Frith-Macdonald <CaS>
Project Member
Fri 16 Jan 2009 01:27:02 PM UTC, comment #2:

Categorise this correctly and update status.

Richard Frith-Macdonald <CaS>
Project Member
Thu 15 Jan 2009 03:40:28 PM UTC, comment #1:

I've spent a long time looking at this, and now rather suspect that NSAnimation is at fault here rather than NSRunLoop, and fixing a bug in NSRunLoop has exposed the problem in NSAnimation.

The Cocoa docs specifically state that runMode:beforeDate: returns NO without running the loop if the loop has no input sources, but don't say clearly what acceptInputForMode:beforeDate: does. In gnustep-base it now matches the MacOS-X implementation (to return immediately if there are no input sources). I checked these behaviors using a small test program on MacOS-X. It's a bit confusing because a naive test (using NSDefaultRunLoopMode) appears to give a different result from the documentation. I think we have to assume that MacOS-X generally has its own input sources in the default run loop mode ... perhaps we should emulate that or find out more somehow. In any case, this should not effect the animation code as it's not using the default run loop mode.

Now, I've currently left -runMode:beforeDate: broken (it returns YES when there are no input sources) because I think the correct behavior (returning NO) was causing the animation code to stop.

However, the animation still doesn't look good, and I think that's because acceptInputForMode:beforeDate: now returns immediately when there are no input sources, and this means that the animation code is doing a busy wait (calling the method repeatedly) and so using up all the CPU and making the actual drawing slow and jerky.

So my guess at a proper fix is that the animation code should be modified to:
1. keep repeatedly calling -runMode:beforeDate: until it should terminate, irrespective of the return value.
2. put some sort of delay into the code to animate at the correct rate and stop it consuming all of the cpu.

However, I'd like someone else to confirm the diagnosis.

Richard Frith-Macdonald <CaS>
Project Member
Thu 15 Jan 2009 09:49:45 AM UTC, original submission:

Since a few weeks the test code for NSAnimation in usr-apps/examples/gui/GSTest/GSTest no longer works. First no animation at all was shown and now, perhaps after some changes to NSTimer, at least one of the different animations gets displayed.
This used to fully work and was a nice way to show how little code in GNUstep could result in great behaviour. The last time this was broken I had to dig deep into NSRunLoop, something I threat to do again.

Fred Kiefer <FredKiefer>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by FredKiefer (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 16 Jan 2009 02:12:50 PM UTCCaSStatusIn Progress=>Fixed
      Assigned toCaS=>None
      Open/ClosedOpen=>Closed
    Fri 16 Jan 2009 01:27:02 PM UTCCaSCategoryBase/Foundation=>Gui/AppKit
      StatusNone=>In Progress
      Assigned toNone=>CaS

    Back to the top


    Powered by Savane 3.1-cleanup1