Hi Matthew,

I can't think of reason why middle mouse click would have stopped
working.  I'm using Kubuntu 12.04 and have just double checked and
middle mouse is working fine with osgviewer.

My best guess is that there is a build/linking issue of some sort.
You haven't said what version or where you got the OSG from, or
whether you've rebuilt your application or OSG when moving from 11.04
to 12.04, these are the areas I'd think would be most likely areas to
look into.

Robert.

On 26 June 2012 22:44, Matthew Grimes <[email protected]> wrote:
> I upgraded from Ubuntu 11.04 to 12.04, and as a weird side-effect, my OSG app 
> no longer handles middle-clicks correctly. When I inspect the GUIEventAdapter 
> object that represents a middle-click event, the mouse button flag is unset, 
> rather than set to GUIEventAdapter::MOUSE_MIDDLE_BUTTON.
>
> My program uses SphericalManipulator, which uses middle clicks to translate 
> the camera focus, so this is a problem. As a workaround, I've made a subclass 
> of SphericalManipulator called SphericalManipulator2. It overloads the 
> handle() method, so that it makes a copy of the shift-leftbutton event, 
> modifies it to look like a middle button event, then passes the modified 
> event to the superclass (SphericalManipulator)'s handle() implementation. See 
> below:
>
>
> Code:
>
> bool SphericalManipulator2::handle(const osgGA::GUIEventAdapter& 
> original_event, osgGA::GUIActionAdapter& adapter) {
>  const GUIEventAdapter* event = &original_event;
>
>  // GUIEventAdapter forces us to allocate on the heap, not the stack.
>  osg::ref_ptr<EventAdapter> modified_event(new EventAdapter(original_event));
>
>  int modkey = original_event.getModKeyMask();
>
>  if ( original_event.getButton() & GUIEventAdapter::LEFT_MOUSE_BUTTON && 
> (modkey & GUIEventAdapter::MODKEY_SHIFT) ) {
>      modified_event->setButton(GUIEventAdapter::RIGHT_MOUSE_BUTTON);
>      event = &*modified_event;
>  }
>
>  return SphericalManipulator::handle(event, adapter);
> }
>
>
>
>
> Very oddly, the application shows no change in behavior. Shift-left clicks 
> are still treated as left clicks, and middle clicks are of course still being 
> ignored.
>
> So two questions:
>
> 1) Is my whole approach wrong? Are there better ways of getting 
> SphericalManipulator to handle shift-clicks as middle clicks (to translate 
> the camera focus)?
>
> 2) If the approach isn't wrong, why might the above code not be working?
>
> Any help would be greatly appreciated.
>
> -- Matt[/list][/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=48548#48548
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to