[vtkusers] VTK tutorial, step 5 (Cone5), OSX-Cocoa: fails to capture keyboard events

Darren Weber darren.weber.lists at gmail.com
Fri Mar 20 21:05:01 EDT 2009

Hey Guys,

Forgive me as a novice, but I think the easy solution is to modify the VTK
class for anything related to Cocoa (or Carbon).  Given that
TransformProcessType() etc. is mac specific, I see no problem in putting it
into any of the .mm files that are using Carbon or Cocoa (or OpenStep).  As
I see it, those VTK classes are only called when required (ie, they are
sort-of platform specific children of the parent vtkRenderWindow class) , so
the examples on other platforms will not call them and they will work fine.
As for _builds_ on other platforms, are there problems for cross-platform
builds that do not call those classes?  That is, does the #include for mac
specific libraries in any of .mm files cause a problem for builds on
windows, etc. if the libraries are not there?  (I assume cmake takes care of
all this.)

It seems that TransformProcessType() is a "window" or "application"
modifier, rather than an interaction level modification.  It seems to allow
the NS (Carbon, Cocoa etc.) window manager to handle the event queue
correctly.  That is, without it, the window manager is not notified that
there is a window (or an app) that can handle keyboard events, while with
the hack, the window manager puts the window into the event handler queue
(as if it's an app, along with some window decorations etc.).  Is that

I may be WAY off in my speculations here, because I do not understand the NS
window manager at all.

Take care, Darren

On Fri, Mar 20, 2009 at 3:25 PM, Sean McBride <sean at rogue-research.com>wrote:

> I agree #2 is problematic.  Ironically, it is the best solution from the
> point of view of the Mac design, but it does not work well cross-
> platform.  Apple basically says "apps that display GUI should/must be
> bundled" TransformProcessType() is a hack really, added exactly for the
> kind of situation we are in: the cross platform situation.
> Perhaps we should make as many examples bundles as possible, all those
> that take no command line arguments...?
> Mike, what do you mean about 'coming to the front'?
> TransformProcessType() does not bring an app nor a window to the front.
> Docs: "You can use this call to transform a background-only application
> into a foreground application. A foreground application appears in the
> Dock (and in the Force Quit dialog) and contains a menu bar. This
> function does not cause the application to be brought to the front; you
> must call SetFrontProcess to do so"
> I don't remember from my testing what happens if you want keyboard
> events to go to both the GUI window and stdin (in the Terminal window)....
> On 3/20/09 5:57 PM, Michael Jackson said:
> >I vote for #1.
> >
> >#2 gets "interesting" for apps that take command line arguments
> >
> >#3 - VTK doesn't know when _you_ want your application to come to the
> >front. Only _you_ know that so I don't think putting the fix in any
> >deeper than the examples is a good idea.
> >
> >Now, just to find some one with the time to update all the examples....
> >
> >_________________________________________________________
> >Mike Jackson                  mike.jackson at bluequartz.net
> >BlueQuartz Software                    www.bluequartz.net
> >Principal Software Engineer                  Dayton, Ohio
> >
> >
> >
> >On Mar 20, 2009, at 5:43 PM, Sean McBride wrote:
> >
> >> On 3/19/09 9:17 PM, Michael Jackson said:
> >>
> >>> The code I submitted is designed for _you_ to put in _your_ code and
> >>> NOT into any of the vtk code. Well maybe the cone examples and stuff
> >>> like that but NOT the render classes.
> >>
> >> Mike,
> >>
> >> Any thoughts on what to do about the VTK examples?  It is lame that
> >> the
> >> VTK examples don't work 'out of the box', and it has been so for many
> >> years now.
> >>
> >> Possibilities include:
> >> 1- Changing each example's code to call TransformProcess().
> >> 2- Making each example a bundle.  (Will this work for examples that
> >> need
> >> command line arguments?)
> >> 3- calling TransformProcess(), perhaps only optionally, from VTK
> >> itself.
> >> 4- ?
> >>
> >> --
> >> ____________________________________________________________
> >> Sean McBride, B. Eng                 sean at rogue-research.com
> >> Rogue Research                        www.rogue-research.com
> >> Mac Software Developer              Montréal, Québec, Canada
> >>
> >>
> >
> >_______________________________________________
> >Powered by www.kitware.com
> >
> >Visit other Kitware open-source projects at http://www.kitware.com/
> >opensource/opensource.html
> >
> >Please keep messages on-topic and check the VTK FAQ at: http://
> >www.vtk.org/Wiki/VTK_FAQ
> >
> >Follow this link to subscribe/unsubscribe:
> >http://www.vtk.org/mailman/listinfo/vtkusers
> >
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
> _______________________________________________
> Powered by www.kitware.com
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090320/30e8dd40/attachment.htm>

More information about the vtkusers mailing list