mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Fix ESC in error dialog from closing Minetest (#10838)
This commit is contained in:
parent
009e39e73b
commit
6417f4d314
@ -18,6 +18,8 @@
|
|||||||
ui = {}
|
ui = {}
|
||||||
ui.childlist = {}
|
ui.childlist = {}
|
||||||
ui.default = nil
|
ui.default = nil
|
||||||
|
-- Whether fstk is currently showing its own formspec instead of active ui elements.
|
||||||
|
ui.overridden = false
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function ui.add(child)
|
function ui.add(child)
|
||||||
@ -55,6 +57,7 @@ end
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
function ui.update()
|
function ui.update()
|
||||||
|
ui.overridden = false
|
||||||
local formspec = {}
|
local formspec = {}
|
||||||
|
|
||||||
-- handle errors
|
-- handle errors
|
||||||
@ -71,6 +74,7 @@ function ui.update()
|
|||||||
"button[2,6.6;4,1;btn_reconnect_yes;" .. fgettext("Reconnect") .. "]",
|
"button[2,6.6;4,1;btn_reconnect_yes;" .. fgettext("Reconnect") .. "]",
|
||||||
"button[8,6.6;4,1;btn_reconnect_no;" .. fgettext("Main menu") .. "]"
|
"button[8,6.6;4,1;btn_reconnect_no;" .. fgettext("Main menu") .. "]"
|
||||||
}
|
}
|
||||||
|
ui.overridden = true
|
||||||
elseif gamedata ~= nil and gamedata.errormessage ~= nil then
|
elseif gamedata ~= nil and gamedata.errormessage ~= nil then
|
||||||
local error_message = core.formspec_escape(gamedata.errormessage)
|
local error_message = core.formspec_escape(gamedata.errormessage)
|
||||||
|
|
||||||
@ -89,6 +93,7 @@ function ui.update()
|
|||||||
error_title, error_message),
|
error_title, error_message),
|
||||||
"button[5,6.6;4,1;btn_error_confirm;" .. fgettext("OK") .. "]"
|
"button[5,6.6;4,1;btn_error_confirm;" .. fgettext("OK") .. "]"
|
||||||
}
|
}
|
||||||
|
ui.overridden = true
|
||||||
else
|
else
|
||||||
local active_toplevel_ui_elements = 0
|
local active_toplevel_ui_elements = 0
|
||||||
for key,value in pairs(ui.childlist) do
|
for key,value in pairs(ui.childlist) do
|
||||||
@ -185,6 +190,16 @@ end
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
core.event_handler = function(event)
|
core.event_handler = function(event)
|
||||||
|
-- Handle error messages
|
||||||
|
if ui.overridden then
|
||||||
|
if event == "MenuQuit" then
|
||||||
|
gamedata.errormessage = nil
|
||||||
|
gamedata.reconnect_requested = false
|
||||||
|
ui.update()
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if ui.handle_events(event) then
|
if ui.handle_events(event) then
|
||||||
ui.update()
|
ui.update()
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user