Skip to content
  • Sean McBride's avatar
    Various Cocoa improvements and fixes · a3e9fc90
    Sean McBride authored
    Changed behaviour of vtkCocoaRenderWindowInteractor::TerminateApp().
    It used to do one of two things: 1) terminate the application completely,
    or 2) close the NSWindow and stop the event loop.  Now it never closes
    the NSWindow, never terminates the application, and always stops the
    event loop.  Start() and TerminateApp() are now pairs, which is how other
    platforms already behave.  Also refactored NSApplication runloop
    starting/stopping code into static functions that do only that.  Makes
    more sense since there is only one event loop, there doesn't need to be
    an association with any class or instance.  Thanks to Pat Marion for
    reporting this problem and creating a patch.
    
    Changed of behaviour observing for NSWindow closing.  First, moved the
    private vtkCocoaServer class from vtkCocoaRenderWindowInteractor to
    vtkCocoaRenderWindow.  Its job is to observe window closing.  Since
    vtkCocoaRenderWindow creates the NSWindow, it make more sense there.
    We were previously careful to only observe NSWindows created by VTK,
    but are now also careful to *stop* observing only those same windows,
    whereas previously there was an outside chance of stopping observation
    of all window closes, which is something a library should not do
    (who knows what else the application is doing).  Now when an observed
    NSWindow closes, we no longer stop the event loop, but merely remove
    our reference to it.
    
    Changed vtkCocoaRenderWindow::SetWindowName() to interpret its char*
    string parameter as UTF8 instead of ASCII.
    
    Fixed possible memory leaks in ~vtkCocoaRenderWindow.
    
    Replaced most invocations of 'autorelease' in favour of 'release'.
    The motivation being that VTK, as a library, might sometimes be called
    before an autorelease pool is even setup, so better to avoid autoreleased
    objects as much as possible.
    
    Fixed some whitespace and coding conventions
    (asterisk positioning, constness, etc.)
    
    Change-Id: I5a5d410012980ee9f6c637c340e98e3daa5aee74
    a3e9fc90