Implementation of UserData passing from the system event receiver to the Irrlicht IEventReceiver. Currently only available for Windows (thanks to rogerborg) and Linux.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1449 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
a3d72206f8
commit
1886b79274
|
@ -40,7 +40,18 @@ namespace irr
|
|||
EET_LOG_TEXT_EVENT,
|
||||
|
||||
//! A user event with user data.
|
||||
/** This is not used by Irrlicht and can be used to send user specific data though the system. */
|
||||
/** This is not used by Irrlicht and can be used to send user
|
||||
specific data though the system. The Irrlicht 'window handle'
|
||||
can be obtained from IrrlichtDevice::getExposedVideoData()
|
||||
The usage and behaviour depends on the operating system:
|
||||
Windows: send a WM_USER message to the Irrlicht Window; the
|
||||
wParam and lParam will be used to populate the
|
||||
UserData1 and UserData2 members of the SUserEvent.
|
||||
Linux: send a ClientMessage via XSendEvent to the Irrlicht
|
||||
Window; the data.l[0] and data.l[1] members will be
|
||||
casted to s32 and used as UserData1 and UserData2.
|
||||
MacOS: Not yet implemented
|
||||
*/
|
||||
EET_USER_EVENT
|
||||
};
|
||||
|
||||
|
@ -231,9 +242,6 @@ struct SEvent
|
|||
|
||||
//! Another user specified data as int
|
||||
s32 UserData2;
|
||||
|
||||
//! Some user specified data as float
|
||||
f32 UserData3;
|
||||
};
|
||||
|
||||
EEVENT_TYPE EventType;
|
||||
|
|
|
@ -837,6 +837,14 @@ bool CIrrDeviceLinux::run()
|
|||
os::Printer::log("Quit message received.", ELL_INFORMATION);
|
||||
Close = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we assume it's a user message
|
||||
irrevent.EventType = irr::EET_USER_EVENT;
|
||||
irrevent.UserEvent.UserData1 = (s32)event.xclient.data.l[0];
|
||||
irrevent.UserEvent.UserData2 = (s32)event.xclient.data.l[1];
|
||||
postEventFromUser(irrevent);
|
||||
}
|
||||
XFree(atom);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -268,9 +268,22 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
(wParam & 0xFFF0) == SC_MONITORPOWER)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
case WM_USER:
|
||||
event.EventType = irr::EET_USER_EVENT;
|
||||
event.UserEvent.UserData1 = (irr::s32)wParam;
|
||||
event.UserEvent.UserData2 = (irr::s32)lParam;
|
||||
dev = getDeviceFromHWnd(hWnd);
|
||||
|
||||
if (dev)
|
||||
dev->postEventFromUser(event);
|
||||
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace irr
|
||||
|
|
Loading…
Reference in New Issue