mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-29 15:29:50 +00:00
vbox5: drop KEY_CAPSLOCK events on capslock="rom"
Guests are easily confused by spurious KEY_CAPSLOCK input events in caps="rom" mode. These spurious events may reach the VMM if KEY_CAPSLOCK is not pressed as first key in a combination and, therefore, is not filtered as global key. Now, we filter KEY_CAPSLOCK in ROM mode in the VMM explicitly, but let it pass in non-ROM mode. Fixes #4087
This commit is contained in:
parent
002037ce15
commit
37f1873f2e
@ -150,8 +150,14 @@ void GenodeConsole::_handle_input()
|
|||||||
if (!_vbox_keyboard || !_vbox_mouse)
|
if (!_vbox_keyboard || !_vbox_mouse)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool const caps_lock_from_rom { _caps_lock.constructed() };
|
||||||
|
|
||||||
auto keyboard_submit = [&] (Input::Keycode key, bool release) {
|
auto keyboard_submit = [&] (Input::Keycode key, bool release) {
|
||||||
|
|
||||||
|
/* don't confuse guests and drop CapsLock events in ROM mode */
|
||||||
|
if (caps_lock_from_rom && key == Input::KEY_CAPSLOCK)
|
||||||
|
return;
|
||||||
|
|
||||||
Scan_code scan_code(key);
|
Scan_code scan_code(key);
|
||||||
|
|
||||||
unsigned char const release_bit = release ? 0x80 : 0;
|
unsigned char const release_bit = release ? 0x80 : 0;
|
||||||
@ -552,6 +558,7 @@ void GenodeConsole::_handle_sticky_keys()
|
|||||||
/* remember last seen host caps lock state */
|
/* remember last seen host caps lock state */
|
||||||
host_caps_lock = caps_lock;
|
host_caps_lock = caps_lock;
|
||||||
|
|
||||||
|
/* CapsLock was toggled in ROM - inject press-release events */
|
||||||
if (trigger_caps_lock) {
|
if (trigger_caps_lock) {
|
||||||
_vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK);
|
_vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK);
|
||||||
_vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK | 0x80);
|
_vbox_keyboard->PutScancode(Input::KEY_CAPSLOCK | 0x80);
|
||||||
|
@ -160,7 +160,7 @@ class GenodeConsole : public Console {
|
|||||||
_input_sticky_keys_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_sticky_keys)
|
_input_sticky_keys_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_sticky_keys)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i <= Input::KEY_MAX; i++)
|
for (unsigned i = 0; i <= Input::KEY_MAX; i++)
|
||||||
_key_status[i] = 0;
|
_key_status[i] = false;
|
||||||
|
|
||||||
_input.sigh(_input_signal_dispatcher);
|
_input.sigh(_input_signal_dispatcher);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user