Mouse automatically grabbed after double-key sequence for accented vowels
nakerium

Hello all.

There seems to be a bug when I press a double-key sequence for, for example, type an 'á' (ie. press the '´' key, release, press 'a' and release) the unicode value is correctly registered in the event queue but the mouse gets confined to the allegro window.

If I press the sequence again the mouse gets released so it seems that the grabbing is being toggled every time I press that kind of sequence keys.

The workaround I found is to call al_ungrab_mouse() every time I get a unicode event, but it is quite annoying and not optimal.

I'm using the allegro bundled in debian testing (I think it's 5.0.11-1), under plasma (KDE) with a Spanish keyboard layout and IBus for Japanese input (that, however, doesn't seem to work with allegro. I'll have to research about ibus).

SiegeLord

Wow! I can reproduce this with 5.1.12, I wonder what causes this.

Elias

I wonder if it has to do with the x-input-manager, like it's trying to display some sort of extended input dialog and confine the mouse to it... it does sound really weird for sure :P

SiegeLord

So turns out Allegro has this feature where you can set a key binding to grab the mouse. Unfortunately, it was buggy in that if it wasn't set, it'd get triggered when these special compose keys were used. I just fixed this in git HEAD, but for your case you can work around it by adding this code before you create the display:

al_set_config_value(al_get_system_config(), "keyboard", "toggle_mouse_grab_key", "ScrollLock");

Now only ScrollLock will work (you can set some other key if you want to, but it has to be set to some real key to work around the broken behavior in your Allegro version).

Elias

Maybe we should document (or remove) that feature?

nakerium

¡Thanks! The al_set_config_value workaround works perfectly.

However, following what Elias says, what is the original intention of that feature? I don't see any reason you'd want to lock the mouse in the screen while typing.
If it is for some multi-key input system, then just going outside the window should or don't affect the input, or, if that's not possible, just discard it imho.

SiegeLord

Looking at the commit that added this feature, it wasn't really clear what it was for. Maybe just convenience? It's probably okay to remove it, I really doubt anybody is actually using it.

Thread #615926. Printed from Allegro.cc