I am using Irrlicht in conjuction with another event input system (Qt), so I have to manually pass event to irrlicht using the IrrlichtDevice::postEventFromUser and it works very well. However, I want to know whether irrlicht absorbed the event because I need to know if I should continue processing the event using Qt for menu shortcuts to work or whether I should stop it.
The patch for this is very simple, attached below, and since we are changing the return value from void to bool, this change should not break anything.
Code: Select all
Index: source/Irrlicht/CIrrDeviceStub.cpp
===================================================================
--- source/Irrlicht/CIrrDeviceStub.cpp (revision 1485)
+++ source/Irrlicht/CIrrDeviceStub.cpp (working copy)
@@ -171,7 +171,7 @@
//! send the event to the right receiver
-void CIrrDeviceStub::postEventFromUser(const SEvent& event)
+bool CIrrDeviceStub::postEventFromUser(const SEvent& event)
{
bool absorbed = false;
@@ -187,6 +187,8 @@
if (!absorbed && inputReceiver)
absorbed = inputReceiver->postEventFromUser(event);
+
+ return absorbed;
}
Index: source/Irrlicht/CIrrDeviceStub.h
===================================================================
--- source/Irrlicht/CIrrDeviceStub.h (revision 1485)
+++ source/Irrlicht/CIrrDeviceStub.h (working copy)
@@ -83,7 +83,7 @@
virtual const char* getVersion() const;
//! send the event to the right receiver
- virtual void postEventFromUser(const SEvent& event);
+ virtual bool postEventFromUser(const SEvent& event);
//! Sets a new event receiver to receive events
virtual void setEventReceiver(IEventReceiver* receiver);
Index: include/IrrlichtDevice.h
===================================================================
--- include/IrrlichtDevice.h (revision 1485)
+++ include/IrrlichtDevice.h (working copy)
@@ -194,7 +194,7 @@
input, you can use this to post key or mouse input events to
the engine. Internally, this method only delegates the events
further to the scene manager and the GUI environment. */
- virtual void postEventFromUser(const SEvent& event) = 0;
+ virtual bool postEventFromUser(const SEvent& event) = 0;
//! Sets the input receiving scene manager.
/** If set to null, the main scene manager (returned by