From 0161d514b713d64d288db3de1164ed823f98ad16 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Wed, 8 Jun 2022 19:29:10 +0200 Subject: [PATCH] Fix collision between ImGui and WebGui The callbacks of WebGui (which is on top) now gets priority --- modules/webbrowser/src/eventhandler.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/webbrowser/src/eventhandler.cpp b/modules/webbrowser/src/eventhandler.cpp index 261b707bf6..a1f91d369d 100644 --- a/modules/webbrowser/src/eventhandler.cpp +++ b/modules/webbrowser/src/eventhandler.cpp @@ -149,7 +149,7 @@ namespace { namespace openspace { void EventHandler::initialize() { - global::callback::character->emplace_back( + global::callback::character->emplace(global::callback::character->begin(), [this](unsigned int charCode, KeyModifier mod) -> bool { if (_browserInstance) { return charCallback(charCode, mod); @@ -157,7 +157,7 @@ void EventHandler::initialize() { return false; } ); - global::callback::keyboard->emplace_back( + global::callback::keyboard->emplace(global::callback::keyboard->begin(), [this](Key key, KeyModifier mod, KeyAction action) -> bool { if (_browserInstance) { return keyboardCallback(key, mod, action); @@ -165,7 +165,7 @@ void EventHandler::initialize() { return false; } ); - global::callback::mousePosition->emplace_back( + global::callback::mousePosition->emplace(global::callback::mousePosition->begin(), [this](double x, double y) -> bool { if (_browserInstance) { return mousePositionCallback(x, y); @@ -173,15 +173,16 @@ void EventHandler::initialize() { return false; } ); - global::callback::mouseButton->emplace_back( [this](MouseButton button, MouseAction action, KeyModifier mods) -> bool { if (_browserInstance) { + global::callback::mouseButton->emplace(global::callback::mouseButton->begin(), return mouseButtonCallback(button, action, mods); } return false; } ); - global::callback::mouseScrollWheel->emplace_back( + global::callback::mouseScrollWheel->emplace( + global::callback::mouseScrollWheel->begin(), [this](double x, double y) -> bool { if (_browserInstance) { return mouseWheelCallback(glm::ivec2(x, y)); @@ -190,7 +191,7 @@ void EventHandler::initialize() { } ); - global::callback::touchDetected->emplace_back( + global::callback::touchDetected->emplace(global::callback::touchDetected->begin(), [&](TouchInput input) -> bool { if (!_browserInstance) { return false; @@ -229,7 +230,7 @@ void EventHandler::initialize() { } ); - global::callback::touchUpdated->emplace_back( + global::callback::touchUpdated->emplace(global::callback::touchUpdated->begin(), [&](TouchInput input) -> bool { if (!_browserInstance || _validTouchStates.empty()) { return false; @@ -267,7 +268,7 @@ void EventHandler::initialize() { } ); - global::callback::touchExit->emplace_back( + global::callback::touchExit->emplace(global::callback::touchExit->begin(), [&](TouchInput input) { if (!_browserInstance) { return;