Skip to content

Commit c1bd240

Browse files
committed
input: Fix order of processing contexts.
1 parent e2fc577 commit c1bd240

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libopenage/input/input_manager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
// Copyright 2015-2023 the openage authors. See copying.md for legal info.
1+
// Copyright 2015-2024 the openage authors. See copying.md for legal info.
22

33
#include "input_manager.h"
44

5+
#include <ranges>
6+
57
#include "input/controller/camera/controller.h"
68
#include "input/controller/game/controller.h"
79
#include "input/controller/hud/controller.h"
810
#include "input/event.h"
911
#include "input/input_context.h"
1012
#include "renderer/gui/guisys/public/gui_input.h"
1113

14+
1215
namespace openage::input {
1316

1417
InputManager::InputManager() :
@@ -131,7 +134,7 @@ bool InputManager::process(const QEvent &ev) {
131134
input::Event input_ev{ev};
132135

133136
// Check context list on top of the stack (most recent bound first)
134-
for (auto const &ctx : this->active_contexts) {
137+
for (auto const &ctx : this->active_contexts | std::views::reverse) {
135138
if (ctx->is_bound(input_ev)) {
136139
auto &actions = ctx->lookup(input_ev);
137140
for (auto const &action : actions) {

0 commit comments

Comments
 (0)