macos: Fix IMContext for popovers
When we need an NSEvent
, while we only have a GdkEvent
,
we cannot depend on comparing event pointers,
since some events (e.g. for popups) are rewritten.
Therefore we need to determine the NSEvent
based on
heuristics. The primary suspects are event-type, device and timestamp.
This allows us to fix IMContext for popups.
This fixes the macOS side of #6041.