Send Events to a hidden background Window?


#1

Hello there,

I have an unique situation where I'm using Juce to draw the UI of a plug-in for a host application. The issue is, the host only allows off-screen drawing and it has it's own window management. It does provide Key & Mouse events but no Window contexts. 

My question is how to pass those events or more accurately how to simulate those events within a Juce Component? My UI works great as a standalone window, but I'm unable to figure out how to simulate Key & Mouse events without an active visible Window.

Any tips?

 

Thanks.


#2

Sounds like a fiddly project to get right!

Maybe the best plan would be to use a custom ComponentPeer?

The ComponentPeer is the bridge between a Component and a OS window, so might be a better solution than trying to use a real hidden window.


#3

Thanks for the quick reply!

I just looked into ComponentPeer class and it looks very interesting. It does have a LOT of code that would be impossible to re-implement from scratch in a custom class.  I wonder if it's possible  subclass ComponentPeer and add just two new APIs (send mouse and key events) or do I have to re-implement all the helper functions?  

 

Thanks again!


#4

Not sure I 100% understand you, but a subclass with just a subset of its paint/mouse behaviour overridden is exactly what I was suggesting.


#5

Thank you! Thats what I was asking.