Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Mouse automatically grabbed after double-key sequence for accented vowels

Credits go to SiegeLord for helping out!
This thread is locked; no one can reply to it. rss feed Print
Mouse automatically grabbed after double-key sequence for accented vowels
nakerium
Member #16,128
December 2015

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
Member #7,827
October 2006
avatar

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

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Elias
Member #358
May 2000

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

--
"Either help out or stop whining" - Evert

SiegeLord
Member #7,827
October 2006
avatar

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).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Elias
Member #358
May 2000

Maybe we should document (or remove) that feature?

--
"Either help out or stop whining" - Evert

nakerium
Member #16,128
December 2015

¡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
Member #7,827
October 2006
avatar

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.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: