Closed kmod-midori closed 3 years ago
My idea would be to create a CreateContext
that gets passed to the create
method which creates a hashmap of obs_hotkey_id
to FnMut(&mut D)
. This hashmap would then be added to DataWrapper
so that the correct function can be called by obs_hotkey_register_source
.
I'll quickly make a draft PR to see how it looks.
Had a go in #8. For some reason, obs_hotkey_regsiter_source
doesn't seem to work for me. Though obs_hotkey_register_frontend
works fine. I can't seem to find any documentation on why.
I was about to implement
obs_hotkey_register_source
, which looks like this:This API seems to be undocumented, but used in almost every plugin. By convention, this is called in
create
, in which we don't really have ourBox<DataWrapper<D>>
ready. However, without data this thing is useless. Any idea on how I can approach this?In C, we control the
malloc
process, so we can throw the pointer into this function, on Rust, this seems impossible.