From f6a9a3c52023a03d74b1d7c741060108d6e0d16c Mon Sep 17 00:00:00 2001 From: thecozies <79979276+thecozies@users.noreply.github.com> Date: Mon, 22 Jan 2024 10:45:13 -0600 Subject: [PATCH] close config modal on backdrop or x button click --- src/ui/ui_config.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ui/ui_config.cpp b/src/ui/ui_config.cpp index 1bbdf44..2620464 100644 --- a/src/ui/ui_config.cpp +++ b/src/ui/ui_config.cpp @@ -94,6 +94,17 @@ public: } } }); + // This needs to be separate from `close_config_menu` so it ensures that the event is only on the target + recomp::register_event(listener, "close_config_menu_backdrop", + [](const std::string& param, Rml::Event& event) { + if (event.GetPhase() == Rml::EventPhase::Target) { + close_config_menu(); + } + }); + recomp::register_event(listener, "close_config_menu", + [](const std::string& param, Rml::Event& event) { + close_config_menu(); + }); } void make_graphics_bindings(Rml::Context* context) { Rml::DataModelConstructor constructor = context->CreateDataModel("graphics_model");