Jump to content

[SOLVED] WidgetManipulator breaks mouse when disabled


photo

Recommended Posts

Posted

When you have one of the WidgetManipulator that is disabled, all the mouse interaction breaks down as soon as you click on it. To reproduce:

WidgetManipulatorTranslator wm = new WidgetManipulatorTranslator( engine.getGui() );
wm.setEnabled(false);
WidgetButton wb = new WidgetButton( engine.getGui(), "Hodor" );
engine.gui.addChild( wb, GUI_ALIGN_OVERLAP );
engine.gui.addChild( wm, GUI_ALIGN_OVERLAP );

And of course feed the camera projection and view to wm so it becomes visible and you can click on it. After starting, you can click the button without problems. But as soon as you try to click on the manipulator, the button stops working. My findings (had to do some debugging before I realized it was caused by the widget being disabled):

  • Widget::check_default_callbacks has some fancy "disable callback" logic that sets mouse_grab to 1 when widget is disabled and you click on it.
  • WidgetManipulatorTranslator::checkCallbacks sets focus to NULL if widget is disabled.
  • Widget::check_default_callbacks never releases mouse_grab anymore since widget no longer has focus.
  • All other widgets ignore the clicks since mouse_grab is now set to 1 without anyone having focus.

Happens with the latest SDK, 2.0 RC.

Posted

Fixed. Bugfix will be available in the next SDK update.

 

In the meantime you can patch source/engine/gui/widgets/WidgetManipulatorTranslator.cpp at line 102 (checkCallbacks(int x,int y) method) and add following code:

 if (isEnabled() == 0) {
        return;
 }

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...