BillyDM / iced_baseview

A baseview backend for the Iced GUI library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to pass keyboard events into iced_baseview?

a2aaron opened this issue · comments

I was wondering if there is a way to pass keyboard events into iced_baseview? Previously I did this by storing the Handle returned by iced_baseview::Runner, but it looks like that's been removed somewhat recently (and then hackilly forwarding keyboard events to it). Is there a different way to do this now? I noticed you added open_parented, but I'm not sure how to actually pass through a keyboard event, since it doesn't look like you get a handle or anything.

What is your use case? Why do you need to send custom keyboard events? Baseview should already send those from the keyboard.

I'm writing a VST plugin using the vst crate. VST hosts will generally capture any keyboard events of a plugin window and forwards them explicitly along to the plugin via the VST api. In particular, I've found this happens on LMMS, VSTHost, and Ableton. This makes anything which reacts to the keyboard unusable, since Baseview ends up never receiving them and so widgets cannot react to them (in particular, this makes iced_audio's widgets not respond to holding modifier keys to fine tune them). Sending keyboard events manually would allow me to work around this issue.

Note: I am on Windows 10, I'm not sure if the behavior is different for other OSes.

Hmm, I wonder if this is an issue at the baseview level and not the GUI level. Let me ask the developer of baseview about this.

Alright, I added a WindowHandle struct for sending events to the window. Does it work how you want?

Yes! This would work perfectly for me. Thank you!!