@@ -77,7 +77,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
77
77
gui::IGUIElement* parent, s32 id, IMenuManager *menumgr,
78
78
InventoryManager *invmgr, IGameDef *gamedef,
79
79
ISimpleTextureSource *tsrc, IFormSource* fsrc, TextDest* tdst,
80
- Client* client) :
80
+ Client* client, bool remap_dbl_click ) :
81
81
GUIModalMenu(dev->getGUIEnvironment (), parent, id, menumgr),
82
82
m_device(dev),
83
83
m_invmgr(invmgr),
@@ -97,7 +97,8 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
97
97
m_text_dst(tdst),
98
98
m_formspec_version(0 ),
99
99
m_focused_element(L" " ),
100
- m_font(NULL )
100
+ m_font(NULL ),
101
+ m_remap_dbl_click(remap_dbl_click)
101
102
#ifdef __ANDROID__
102
103
,m_JavaDialogFieldName(L" " )
103
104
#endif
@@ -2939,15 +2940,18 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event)
2939
2940
bool GUIFormSpecMenu::DoubleClickDetection (const SEvent event)
2940
2941
{
2941
2942
/* The following code is for capturing double-clicks of the mouse button
2942
- * that are *not* in/in a control (i.e. when the mouse if positioned in an
2943
- * unused area of the formspec) and translating the double-click into an
2944
- * EET_KEY_INPUT_EVENT event which closes the form.
2943
+ * and translating the double-click into an EET_KEY_INPUT_EVENT event
2944
+ * -- which closes the form -- under some circumstances.
2945
2945
*
2946
2946
* There have been many github issues reporting this as a bug even though it
2947
- * was an intended feature. For this reason the code has been disabled for
2948
- * non-Android builds
2947
+ * was an intended feature. For this reason, remapping the double-click as
2948
+ * an ESC must be explicitly set when creating this class via the
2949
+ * /p remap_dbl_click parameter of the constructor.
2949
2950
*/
2950
- #ifdef __ANDROID__
2951
+
2952
+ if (!m_remap_dbl_click)
2953
+ return false ;
2954
+
2951
2955
if (event.MouseInput .Event == EMIE_LMOUSE_PRESSED_DOWN) {
2952
2956
m_doubleclickdetect[0 ].pos = m_doubleclickdetect[1 ].pos ;
2953
2957
m_doubleclickdetect[0 ].time = m_doubleclickdetect[1 ].time ;
@@ -2986,7 +2990,7 @@ bool GUIFormSpecMenu::DoubleClickDetection(const SEvent event)
2986
2990
delete translated;
2987
2991
return true ;
2988
2992
}
2989
- # endif
2993
+
2990
2994
return false ;
2991
2995
}
2992
2996
0 commit comments