Reading input (keyboard, mouse) on an unfocused window?

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.
Post Reply
Moonkis
Prole
Posts: 14
Joined: Thu Jan 09, 2014 4:37 pm

Reading input (keyboard, mouse) on an unfocused window?

Post by Moonkis »

Well as the title says I'm wondering if it's at all possible within love to read keystrokes, mouse inputs when the game is unfocused (foreground)? isDown, keypressed and keyreleased seems to produce nothing when the window isn't focused.
User avatar
slime
Solid Snayke
Posts: 3134
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Reading input (keyboard, mouse) on an unfocused window?

Post by slime »

love (and SDL, the library love uses for cross-platform input) don't have that capability. What sort of thing would you use it for?
Moonkis
Prole
Posts: 14
Joined: Thu Jan 09, 2014 4:37 pm

Re: Reading input (keyboard, mouse) on an unfocused window?

Post by Moonkis »

slime wrote: Tue Aug 01, 2017 4:22 pm love (and SDL, the library love uses for cross-platform input) don't have that capability. What sort of thing would you use it for?
Ah, I see. I imagine it being platform dependent. In this case I would use it to create a few graphical twitch/stream tools that are ran in the background, and needs to read the keyboard/mouse/gamepad, outside of Löve2D's scope I'm sure but I thought it was worth a shot to ask.
User avatar
slime
Solid Snayke
Posts: 3134
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Reading input (keyboard, mouse) on an unfocused window?

Post by slime »

You can enable joystick/gamepad input events while the window isn't in focus, at least: https://bitbucket.org/rude/love/issues/ ... ndow-focus
DarkShroom
Citizen
Posts: 86
Joined: Mon Jul 17, 2017 2:07 pm

Re: Reading input (keyboard, mouse) on an unfocused window?

Post by DarkShroom »

can i add, if it's useful, that i have the same issue everywhere, it's the same on java for example

it's a security issue, it stops you from key logging, in the case of java, you need an OS specific hook, to do that keylogging :P
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Reading input (keyboard, mouse) on an unfocused window?

Post by zorg »

You can also use the FFI to achieve the same thing in löve, probably; it wouldn't be a cross-platform solution though.
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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 60 guests