Current Target/Original target/Param of event object

Hi all,

As mentioned in another thread I’m trying to create a wrapper for LVGL for cpython.
And I hit a small wall with the event object.
It has information about the current and original target objects which are stored as void *-
As far as I can tell, there is no information in the event object itself which would indicate if the target is an lv_obj_t subclass or a display (no sure if currently any other object can send an event).
Therefore the wrapper has NO idea what class it should return to the caller.
The same goes for the param field. The wrapper does not have any idea what the *raiser" of the event has stored in the param field.

The only way right now I see is that the cpython wrapper returns a generic object and the user needs to use .obj or .display to cast to the current type:

event.get_current_target ().widget
event.get_current_target ().display

And the same for the param field:

event..get_param ().uint
event..get_param ().int
event..get_param ().str
event..get_param ().bytes

Another solution would be to add this information the the event object and the “raiser” needs to set the type of source (obj or display) and also provide information about the type of the param data. (Like the variant type used in Qt)

Or has anybody a better way of handling this? Any suggestions are more than welcome.