Page 1 of 2

ralt does not result pressed?

Posted: Wed Dec 07, 2022 8:40 am
by svalorzen
The code

Code: Select all

function love.keypressed(key)
    print(key, love.keyboard.isDown('ralt'))
prints, when pressing the right alt key,

Code: Select all

ralt	false
and in general isDown never returns true for the right alt key. All other modifiers work correctly, but isDown refuses to recognize 'ralt'. Am I doing something wrong? (Lubuntu 20.04, LOVE 11.4)

To make sure it's not necessarily my machine settings, I've also tested a C SDL program.

Code: Select all

const Uint8 *state = SDL_GetKeyboardState(NULL);

// In a loop...
if (state[SDL_SCANCODE_RALT]) {
    printf("<RALT> is pressed.\n");
}
This works correctly and prints whenever my right alt key is pressed.

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 9:45 am
by darkfrei
And what is by key released?

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 10:52 am
by svalorzen
Still ralt.

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 11:53 am
by GVovkiv
For me ralt returns true, on flatpak love (https://flathub.org/apps/details/org.love2d.love2d) on Fedora 37. I don't know what version of sdl packaged in this flatpak, but it probably different from what lubuntu repositories have?

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 12:58 pm
by Andlac028
I can reproduce it, Ubuntu 22.04 LTS, LÖVE 11.4 from bartbes ppa, with code:

Code: Select all

function love.keypressed(key)
	print(key, love.keyboard.isDown('ralt'), love.keyboard.isDown(key))
end
I get output:

Code: Select all

a	false	true
s	false	true
d	false	true
f	false	true
g	false	true
h	false	true
lshift	false	true
capslock	false	true
rctrl	false	true
ralt	false	false -- notice this line
unknown	false	false
lalt	false	true
lctrl	false	true
lshift	false	true
tab	false	true
delete	false	true
escape	false	true
insert	false	true
home	false	true
pageup	false	true
pagedown	false	true
The only key I noticed, that didn't work was ralt (also unknown, but it is somehow expected behavior)

Try reporting it in issue tracker

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 2:33 pm
by svalorzen
Thanks for also confirming the issue. I have opened an issue here: https://github.com/love2d/love/issues/1875

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 2:42 pm
by zorg
What kind of keyboard do you have? does it have a right alt key, or does it have an "alt gr" key?

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 3:27 pm
by svalorzen
Normal alt, but I built it myself so I hope it doesn't have an effect :)

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 4:21 pm
by svalorzen
Turns out the problem is once again (like every problem I encounter apparently xD) with my SDL version. Turns out the fix for this actually only came out in October this year, so it's very recent, and even Ubuntu 22.10 doesn't have it yet. Only fix is to use the AppImage for LOVE then which apparently has the most up-to-date SDL version.

Re: ralt does not result pressed?

Posted: Wed Dec 07, 2022 5:09 pm
by Ross
I get the same issue myself—on Linux Mint, normal keyboard, normal alt, only happens with 'ralt'.

love.keyboard.isScancodeDown('ralt') does work though, so this could be a workaround for you (yet another reason to use scancodes instead of keycodes :P).