mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
input_filter.run: stabilize key-repeat test
Under certain timing conditions, the test would end up flushing the input from the input filter in a nested way, which ultimately resulted in lost input events of the outer nesting level. This patch eliminates this corner case and thereby stabilizes the key-repeat test.
This commit is contained in:
parent
b9834bc388
commit
ec007c0f27
@ -75,11 +75,17 @@ class Test::Input_from_filter
|
|||||||
|
|
||||||
bool _input_expected = false;
|
bool _input_expected = false;
|
||||||
|
|
||||||
|
bool _handle_input_in_progress = false;
|
||||||
|
|
||||||
void _handle_input()
|
void _handle_input()
|
||||||
{
|
{
|
||||||
|
_handle_input_in_progress = true;
|
||||||
|
|
||||||
if (_input_expected)
|
if (_input_expected)
|
||||||
_connection.for_each_event([&] (Input::Event const &event) {
|
_connection.for_each_event([&] (Input::Event const &event) {
|
||||||
_event_handler.handle_event_from_filter(event); });
|
_event_handler.handle_event_from_filter(event); });
|
||||||
|
|
||||||
|
_handle_input_in_progress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Signal_handler<Input_from_filter> _input_handler {
|
Signal_handler<Input_from_filter> _input_handler {
|
||||||
@ -97,6 +103,12 @@ class Test::Input_from_filter
|
|||||||
void input_expected(bool expected)
|
void input_expected(bool expected)
|
||||||
{
|
{
|
||||||
_input_expected = expected;
|
_input_expected = expected;
|
||||||
|
|
||||||
|
/* prevent nested call of '_handle_input' */
|
||||||
|
if (!_input_expected || _handle_input_in_progress)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* if new step expects input, process currently pending events */
|
||||||
_handle_input();
|
_handle_input();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user