[backport] macos: Avoid repeatedly sending events back to macOS
This is a backport of !7158 (merged) and !7178 (merged), since this behavior is also broken in GTK 4.14.
This is a backport of !7158 (merged) and !7178 (merged), since this behavior is also broken in GTK 4.14.