Yes. You can’t modify emacsframe because it’s an instance variable.
You’ll need to modify whatever is using it to set the frame in the
emacs event.
So, assuming the code you’re modifying is calling EV_TRAILER, for now,
replace the call to EV_TRAILER with it’s contents:
XSETFRAME (emacs_event->frame_or_window, emacsframe);
EV_TRAILER2 (e);
and work from there.