[vbox-dev] XPCOM EventListener
rudolfs.bundulis at gmail.com
Tue Nov 7 00:14:00 UTC 2017
thanks for the response. Yeah the example seems very similar. The thing i
was wondering about - the xpcom samples do stuff with the nsIEventQueue,
which I only instantiate but do not poll in any way (there are so many
sources involving this that I got confused). Should I be doing something -
like calling the EventLoop() method to actually make the events route?
Since everything else apart the event callbacks (which I didn't need so far,
but now I need to know when the machine has been stopped) was working fine
I just didn't care. But if running/polling this queue actually pumps
some internal event loop which in turn fires the callbacks that could be
the thing I'm missing.
2017-11-06 22:39 GMT+02:00 Klaus Espenlaub <klaus.espenlaub at oracle.com>:
> Hi Rūdolfs,
> On 05.11.2017 17:05, Rūdolfs Bundulis wrote:
> > Hi,
> > I'm having issues adding an active event listener via the XPCOM api.
> > I've created a class from the template in the documentation:
> > and put the NS_IMPL_ISUPPORTS1(CVirtualBoxEventListener,
> > IEventListener) macro in my cpp file. But the HandleEvent method is
> > never called. I register the listener by getting the event source from
> > the console object like this (sorry for all the macros, that I have
> > for exception handling):
> > No events are triggered but on shutdown the VBOX XPCOM runtime
> > actually releases the object so it seems that it is aware of it. With
> > active mode, is there anything else I should be calling? I looked up
> > some python examples which do call a python VBOX API method
> > waitForEvents. Is there something similar in the C++ XPCOM API?
> Most python examples I'm aware of use passive event delivery, so aren't
> relevant when you've decided to go for active event delivery. Also the
> VirtualBox GUI is not a good example any more since it's been converted
> to passive event delivery a while ago (IIRC 5.0 still had the active
> variant), so let's go for one of the most simple places I could find,
> Still it uses templates (ListenerImpl<>) and lots of magic wrappers to
> abstract over the differences between COM and XPCOM (which lots of
> people would like to use but so far we didn't manage to include in a
> sensible way in the SDK package), which needs way more apologies than
> your couple of comparably harmless macros for error checking. The
> ListenerImpl<> template is defined in
> and the rest (if you really need to know) in the same directory.
> The C bindings example would have both active and passive event delivery
> as compile-time option, but that's too low level I assume...
> Hope this gives enough inspiration to identify the problem - your code
> didn't look far off the track.
> vbox-dev mailing list
> vbox-dev at virtualbox.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vbox-dev