View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002025VTK(No Category)public2005-07-07 10:522016-02-04 14:34
ReporterSean McBride 
Assigned ToSean McBride 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version7.0.0Fixed in Version7.0.0 
Summary0002025: vtk test applications lack proper user interaction on Mac
Descriptionvtk test applications don't allow proper user interaction on Mac. That is to say, the test apps like "Cone", "Cube", "Cyclinder" (in the /bin directory after building VTK) are all broken.

Keyboard interaction does not work at all and the window cannot be resized nor moved. Clicking to rotate does however work.

There may be several reasons for this, but the primary one is that these applications are built as command line applications. On OS X, such application _cannot_ reliably have a GUI. See:

http://developer.apple.com/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SoftwareDevelopment/chapter_3_section_11.html#//apple_ref/doc/uid/TP40001067-CH206-TPXREF118 [^]

and

http://www.cocoabuilder.com/archive/message/cocoa/2005/1/20/126215 [^]

The solution is that these must be bundled applications. See:

http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Concepts/sd_guidelines.html#//apple_ref/doc/uid/20001758-1036551-BABGBEDG [^]

I have looked into this and it seems CMake does have some understanding of Mac application bundles via its MACOSX_BUNDLE option, but it is apparently broken, see bug 1962.

In any case, the string 'MACOSX_BUNDLE' does not appear anywhere in the vtk source tree so it seems that vtk is simply not using this facility of cmake. It should.

I would very much like to see this bug fixed. When included test apps don't work, it makes a project look bad, and will discourange more people from using vtk.

I am also willing to help get this fixed, but I don't know enough about cmake to do it myself and submit a patch.
TagsNo tags attached.
ProjectTBD
Typeincorrect functionality
Attached Filestxt file icon vtk_patch.txt [^] (1,281 bytes) 1969-12-31 19:00 [Show Content]

 Relationships

  Notes
(0004640)
Sean McBride (developer)
2006-08-14 13:09

Mathieu, can you look at the attached patch? It fixes the problem and is very simple. My dashboard passed with this change. Will this change break non-Mac builds?
(0004641)
Sean McBride (developer)
2006-08-14 13:10

I should say, this patch is for only one CMakeLists.txt, if this patch is acceptable I'll do it for all the other exaple apps too.
(0004837)
Mathieu Malaterre (developer)
2006-09-04 10:17

$ cvs ci -m"BUG: Fix Bug 0002025 - vtk test applications lack proper user interaction on Mac" Examples/Rendering/Cxx/CMakeLists.txt
/cvsroot/VTK/VTK/Examples/Rendering/Cxx/CMakeLists.txt,v <-- CMakeLists.txt
new revision: 1.9; previous revision: 1.8
(0004853)
Sean McBride (developer)
2006-09-05 15:50

Mathieu, the problem is now fixed for
Cylinder
MaterialObjects
AmbientSpheres
SpecularSpheres
DiffuseSpheres

But not for other examples, such as:
Cone
Cube
etc. etc.

I'm not 100% which need the fix, but probably all of them. Certainly any that expect mouse input must be changed.
(0009622)
Sean McBride (developer)
2007-11-02 15:50

Changing some of the examples to bundled apps may be problematic because some of them require command line options... I'm not sure that works with bundled apps.

Anyway, this may be helpful too:
http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/ConfigFiles.html#//apple_ref/doc/uid/20002091-SW1 [^]
(0014330)
Sean McBride (developer)
2008-12-11 14:39

Using TransformProcessType() may work in VTK's case...

http://www.cocoabuilder.com/archive/message/cocoa/2008/12/11/225157 [^]
(0030572)
Sean McBride (developer)
2013-04-12 14:54

On the Rogue7 dashboards vtkInteractionWidgetsCxx-TestPickingManagerSeedWidget and
vtkInteractionWidgetsCxx-TestPointHandleRepresentation3D are crashing:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8e29ed46 __kill + 10
1 libsystem_c.dylib 0x00007fff88fb2df0 abort + 177
2 com.apple.CoreGraphics 0x00007fff920db242 CGSConnectionByID + 232
3 com.apple.CoreGraphics 0x00007fff9213b079 CGSSetRegisteredCursor + 50
4 com.apple.HIServices 0x00007fff8c7f39e4 CoreCursorSetAndReturnSeed + 113
5 com.apple.AppKit 0x00007fff91688fc3 -[NSCursor _reallySet] + 182
6 com.apple.AppKit 0x00007fff91688ed9 -[NSCursor set] + 50
7 libvtkRenderingOpenGL-6.0.1.dylib 0x0000000106b4436f vtkCocoaRenderWindow::SetCurrentCursor(int) + 335 (vtkCocoaRenderWindow.mm:1308)
8 libvtkRenderingCore-6.0.1.dylib 0x000000010482c15c vtkObserverMediator::RequestCursorShape(vtkInteractorObserver*, int) + 524 (vtkObserverMediator.cxx:135)
9 libvtkRenderingCore-6.0.1.dylib 0x00000001047f1ee4 vtkInteractorObserver::RequestCursorShape(int) + 116 (vtkInteractorObserver.cxx:382)
10 libvtkInteractionWidgets-6.0.1.dylib 0x00000001056c13a1 vtkHandleWidget::SetCursor(int) + 97 (vtkHandleWidget.cxx:88)
11 libvtkInteractionWidgets-6.0.1.dylib 0x0000000105620807 vtkAbstractWidget::SetEnabled(int) + 1719 (vtkAbstractWidget.cxx:158)
12 vtkInteractionWidgetsCxxTests 0x0000000101b6fea9 TestPickingManagerSeedWidget(int, char**) + 1193 (TestPickingManagerSeedWidget.cxx:673)
13 vtkInteractionWidgetsCxxTests 0x0000000101b383a0 main + 3520 (CxxTests.cxx:587)

git bisect revealed it started here:

----------------------
5bb0f14f70c059472e053e6b08a05e986b6e284c is the first bad commit
commit 5bb0f14f70c059472e053e6b08a05e986b6e284c
Author: Sean McBride <sean@rogue-research.com>
Date: Thu Mar 21 12:04:07 2013 -0400

    Prevent division by 0 by bailing early
    
    If size[0] or size[1] are <= 0, bail early in the same
    way as is currently done if size is NULL.
    
    Fixes undefined behavior reported by clang's
    -fsanitize=float-cast-overflow where the resulting
    NaN is later converted to float (a UB).
    
    Thanks to Dave Cole for the suggested fix.
    
    Change-Id: Iae41eb91701e79f56bb1adb3d9fc7631260e203a

:040000 040000 e55749fad77bee0c68ebd184d78efeccc7d3a1c4 a0c29a9409eae687fc7d4012b671f49ef5eac448 M Rendering
----------------------

Superficially, the crash is because of this bug (0002025).

NSCursor, being a "GUI thing", cannot be reliably used in a command line application.

As a test, I stuck a call to TransformProcessType() at the beginning of vtkCocoaRenderWindow::SetCurrentCursor() and the crash went away. TransformProcessType() is by now a little dated, as of 10.6 a better API is NSApplication's setActivationPolicy, which also fixed the crash.

The trick is to find where in VTK is the right place and right time to call TransformProcessType/setActivationPolicy.........

commit 5bb0f14f70c059472e053e6b08a05e986b6e284c changed the order of certain things in vtkCocoaRenderWindow. Before it, with these two tests at least, vtkCocoaRenderWindow::CreateAWindow was called before vtkCocoaRenderWindow::SetCurrentCursor; after it, CreateAWindow is never reached. CreateAWindow creates the NSApplication, which is probably enough of a "GUI initialization" to allow NSCursor to work (or at least not abort). Need to dig deeper there....
(0035482)
Sean McBride (developer)
2015-11-20 10:36

I finally got around to fixing this, by calling setActivationPolicy: appropriately. Should be in VTK 7. git commit 5234e0b8c1d93f96c12fcdaf5cb2b5a926fa3ce7.

https://gitlab.kitware.com/vtk/vtk/merge_requests/909 [^]
(0035695)
Sean McBride (developer)
2016-02-04 14:33

5bb0f14 is restored here:

https://gitlab.kitware.com/vtk/vtk/merge_requests/1183 [^]
(0035696)
Sean McBride (developer)
2016-02-04 14:34

This was fixed in VTK 7.

(5bb0f14 isn't really related exactly.)

 Issue History
Date Modified Username Field Change
2007-11-02 15:50 Sean McBride Note Added: 0009622
2007-11-02 15:50 Sean McBride Status backlog => tabled
2007-11-02 15:50 Sean McBride Assigned To Mathieu Malaterre => Sean McBride
2007-11-02 15:52 Sean McBride Description Updated
2008-09-02 13:42 Sean McBride Note Deleted: 0004852
2008-12-11 14:39 Sean McBride Note Added: 0014330
2011-01-13 17:00 Source_changeset_attached => VTK master a2bd8391
2011-01-13 17:00 Source_changeset_attached => VTK master 020ef709
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2013-04-12 14:54 Sean McBride Note Added: 0030572
2014-10-02 18:47 Sean McBride Project => TBD
2014-10-02 18:47 Sean McBride Type => incorrect functionality
2014-10-02 18:47 Sean McBride Status backlog => active development
2014-10-02 18:47 Sean McBride Target Version => 6.2.0
2015-11-20 10:36 Sean McBride Note Added: 0035482
2016-02-04 14:33 Sean McBride Note Added: 0035695
2016-02-04 14:34 Sean McBride Note Added: 0035696
2016-02-04 14:34 Sean McBride Status active development => closed
2016-02-04 14:34 Sean McBride Resolution reopened => fixed
2016-02-04 14:34 Sean McBride Fixed in Version => 7.0.0
2016-02-04 14:34 Sean McBride Target Version 6.2.0 => 7.0.0


Copyright © 2000 - 2018 MantisBT Team