Alt-Key not working when moving mouse


#1

Hello,

I'm just reposting this to the linux part of the forum. I just overlooked this section until now.

I'm on Arch LInux with Gnome 3.18.

In my mouseDown(), ... functions the Alt-key never gets set as a modifier. I tried to find the error and after searching in the linux windowing code I think I found it. After the Alt-key was pressed and a keyboard event was send everything is fine and the flag for the Alt-key is set properly. But as soon as you move the mouse it gets unset.

The difference between the two cases is that after a keyboard event updateKeyModifiersFromSym() in juce_linux_Windowing.cpp is called and after a mouse event the function updateKeyModifiers() is called.

The updateKeyModifiers() triggered the Alt-key when I pressed Meta on my keyboard. It checks for a flag specified by Keys::AltMask that is set in updateModifierMappings(). The keycode for Alt gets determined by XKeysymToKeycode(display, XK_Alt_L), and this seems to be the source of the whole error. On my system that function call returns the same keycode for XK_Alt_L and XK_Meta_L. Based on that error also the value for Keys::AltMask gets set wrong. With my configuration everything worked correct when I set Keys::AltMask manually to 8, but I'm not sure how to make this work in a dynamic way with false output from XKeysymToKeycode().

(I'm also not 100% sure if the bitshifting "if (mapping->modifiermap [i << 1] == altLeftCode)" is correct that way, according to the doku it should be something like modifiermap[i * mapping->max_keypermod])

I hope anyone has an idea how to fix this.


#2

I've managed to reproduce this issue and will start digging into it soon.

Thanks for the report!


#3

did you found something or can I help you somehow?


#4

Any more clues on this one would be appreciated!