ralt does not result pressed?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

ralt does not result pressed?

Post 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.
User avatar
darkfrei
Party member
Posts: 1168
Joined: Sat Feb 08, 2020 11:09 pm

Re: ralt does not result pressed?

Post by darkfrei »

And what is by key released?
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: ralt does not result pressed?

Post by svalorzen »

Still ralt.
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: ralt does not result pressed?

Post 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?
Andlac028
Party member
Posts: 174
Joined: Fri Dec 14, 2018 2:27 pm
Location: Slovakia

Re: ralt does not result pressed?

Post 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
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: ralt does not result pressed?

Post by svalorzen »

Thanks for also confirming the issue. I have opened an issue here: https://github.com/love2d/love/issues/1875
User avatar
zorg
Party member
Posts: 3435
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: ralt does not result pressed?

Post by zorg »

What kind of keyboard do you have? does it have a right alt key, or does it have an "alt gr" key?
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: ralt does not result pressed?

Post by svalorzen »

Normal alt, but I built it myself so I hope it doesn't have an effect :)
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: ralt does not result pressed?

Post 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.
Ross
Citizen
Posts: 97
Joined: Tue Mar 13, 2018 12:12 pm
Contact:

Re: ralt does not result pressed?

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

Who is online

Users browsing this forum: Bing [Bot], Lua Developer and 18 guests