diff options
author | Yaman Qalieh <ybq987@gmail.com> | 2021-01-23 16:40:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-23 21:40:48 +0000 |
commit | 6417f4d3143bc4c4c7f175aa8e40810cfacb5947 (patch) | |
tree | 004d9b347cbe7d89ddc1f86096b6c0f6470d4a1b | |
parent | 009e39e73b9aa003c369fe6bc88f366fdc91610e (diff) | |
download | minetest-6417f4d3143bc4c4c7f175aa8e40810cfacb5947.tar.gz minetest-6417f4d3143bc4c4c7f175aa8e40810cfacb5947.tar.bz2 minetest-6417f4d3143bc4c4c7f175aa8e40810cfacb5947.zip |
Fix ESC in error dialog from closing Minetest (#10838)
-rw-r--r-- | builtin/fstk/ui.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/builtin/fstk/ui.lua b/builtin/fstk/ui.lua index 7eeebdd47..976659ed3 100644 --- a/builtin/fstk/ui.lua +++ b/builtin/fstk/ui.lua @@ -18,6 +18,8 @@ ui = {} ui.childlist = {} ui.default = nil +-- Whether fstk is currently showing its own formspec instead of active ui elements. +ui.overridden = false -------------------------------------------------------------------------------- function ui.add(child) @@ -55,6 +57,7 @@ end -------------------------------------------------------------------------------- function ui.update() + ui.overridden = false local formspec = {} -- handle errors @@ -71,6 +74,7 @@ function ui.update() "button[2,6.6;4,1;btn_reconnect_yes;" .. fgettext("Reconnect") .. "]", "button[8,6.6;4,1;btn_reconnect_no;" .. fgettext("Main menu") .. "]" } + ui.overridden = true elseif gamedata ~= nil and gamedata.errormessage ~= nil then local error_message = core.formspec_escape(gamedata.errormessage) @@ -89,6 +93,7 @@ function ui.update() error_title, error_message), "button[5,6.6;4,1;btn_error_confirm;" .. fgettext("OK") .. "]" } + ui.overridden = true else local active_toplevel_ui_elements = 0 for key,value in pairs(ui.childlist) do @@ -185,6 +190,16 @@ end -------------------------------------------------------------------------------- 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 ui.update() return |