Fix Exit to OS button focus in Pause Menu
This commit is contained in:
parent
a704c04f00
commit
dd2bb950be
|
@ -1157,7 +1157,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
|
||||||
LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_PAUSE_MENU");
|
LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_PAUSE_MENU");
|
||||||
|
|
||||||
create_formspec_menu(cur_formspec, invmgr, gamedef, tsrc, device, fs_src, txt_dst, NULL);
|
create_formspec_menu(cur_formspec, invmgr, gamedef, tsrc, device, fs_src, txt_dst, NULL);
|
||||||
|
(*cur_formspec)->setFocus(L"btn_continue");
|
||||||
(*cur_formspec)->doPause = true;
|
(*cur_formspec)->doPause = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
|
||||||
m_form_src(fsrc),
|
m_form_src(fsrc),
|
||||||
m_text_dst(tdst),
|
m_text_dst(tdst),
|
||||||
m_formspec_version(0),
|
m_formspec_version(0),
|
||||||
|
m_focused_element(L""),
|
||||||
m_font(NULL)
|
m_font(NULL)
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
,m_JavaDialogFieldName(L"")
|
,m_JavaDialogFieldName(L"")
|
||||||
|
@ -1757,8 +1758,6 @@ void GUIFormSpecMenu::parseElement(parserData* data, std::string element)
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||||
{
|
{
|
||||||
/* useless to regenerate without a screensize */
|
/* useless to regenerate without a screensize */
|
||||||
|
@ -1775,6 +1774,10 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||||
mydata.table_dyndata[tablename] = table->getDynamicData();
|
mydata.table_dyndata[tablename] = table->getDynamicData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//set focus
|
||||||
|
if (!m_focused_element.empty())
|
||||||
|
mydata.focused_fieldname = m_focused_element;
|
||||||
|
|
||||||
//preserve focus
|
//preserve focus
|
||||||
gui::IGUIElement *focused_element = Environment->getFocus();
|
gui::IGUIElement *focused_element = Environment->getFocus();
|
||||||
if (focused_element && focused_element->getParent() == this) {
|
if (focused_element && focused_element->getParent() == this) {
|
||||||
|
|
|
@ -246,13 +246,20 @@ public:
|
||||||
m_allowclose = value;
|
m_allowclose = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0)) {
|
void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0))
|
||||||
|
{
|
||||||
m_lock = lock;
|
m_lock = lock;
|
||||||
m_lockscreensize = basescreensize;
|
m_lockscreensize = basescreensize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeChildren();
|
void removeChildren();
|
||||||
void setInitialFocus();
|
void setInitialFocus();
|
||||||
|
|
||||||
|
void setFocus(std::wstring elementname)
|
||||||
|
{
|
||||||
|
m_focused_element = elementname;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Remove and re-add (or reposition) stuff
|
Remove and re-add (or reposition) stuff
|
||||||
*/
|
*/
|
||||||
|
@ -348,6 +355,7 @@ private:
|
||||||
IFormSource *m_form_src;
|
IFormSource *m_form_src;
|
||||||
TextDest *m_text_dst;
|
TextDest *m_text_dst;
|
||||||
unsigned int m_formspec_version;
|
unsigned int m_formspec_version;
|
||||||
|
std::wstring m_focused_element;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool explicit_size;
|
bool explicit_size;
|
||||||
|
|
Loading…
Reference in New Issue