[vtk-developers] VTK_CURSOR_DEFAULT unsets the cursor on vtkXOpenGLRenderWindow

David Gobbi david.gobbi at gmail.com
Tue Jan 29 12:15:50 EST 2013


On Tue, Jan 29, 2013 at 9:35 AM, Giuseppe D'Angelo
<giuseppe.dangelo at kdab.com> wrote:
> Hello,
>
> I'm working on a fix for http://paraview.org/Bug/view.php?id=13707 in VTK
> 5.10.1.
>
> The nature of the bug is that the cursor inside a vtkXOpenGLRenderWindow is
> reset to the default cursor (usually an arrow, as XUndefineCursor gets
> called) as soon as it leaves a VTK widget that overrides it, f.i. with a
> "hand" cursor because the widget is able to be moved around. This happens
> because the widget asks for a VTK_CURSOR_DEFAULT when the cursor is not
> inside its boundaries.
>
> I think this behaviour is wrong: the cursor should be reset to the one that
> has been set on the vtkRenderWindow, if any; hence my bug report.
>
> I'm not 100% sure about where the fix should be applied, though. Given that
> widgets use VTK_CURSOR_DEFAULT to say "I'm not interested in overriding the
> cursor" and render windows instead interpret that as "unset any cursor that
> has been set", it seems to me that the most natural place to put the fix in
> the glue that holds the two things together, namely
> vtkObserverMediator::RequestCursorShape, which should somehow remember the
> renderWindow's cursor (when it overrides it the first time (?)) and then
> restore it back.
>
> Or perhaps the meaning of SetCurrentCursor(VTK_CURSOR_DEFAULT) should be
> changed and another "UnsetCurrentCursor()" should be added.

I have a simpler idea that might work.  You could add a method
SetDefaultCursor(..) to the vtkRenderWindow.  Then change the
method SetCurrentCursor(VTK_CURSOR_DEFAULT) so that it
will reset the cursor to this selected default shape, instead of to
the system default shape.

The idea is that the application will use window->SetDefaultCursor(...)
to set the default cursor for the window, and the widgets/observers
will use window->SetCurrentCursor().  When the widgets are done with
the cursor, it will call SetCurrentCursor(VTK_CURSOR_DEFAULT) just
like they do now.

 - David



More information about the vtk-developers mailing list