SimpleWindow.handleNativeEvent_

Platform specific - handle any native message this window gets.

Note: this is called *in addition to* other event handlers, unless you either:

1) On X11, return 0 indicating that you handled it. Any other return value is simply discarded.

2) On Windows, set the mustReturn parameter to 1 indicating you've done it and your return value should be forwarded to the operating system. If you do not set mustReturn, your return value will be discarded.

On Windows, your delegate takes the form of int delegate(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, out int mustReturn).

On X, it takes the form of int delegate(XEvent).

class SimpleWindow
NativeEventHandler handleNativeEvent_;

Meta

History

In ancient versions, this was static. If you want a global hook, use handleNativeGlobalEvent instead.

Prior to November 27, 2021, the mustReturn parameter was not present, and the Windows implementation would discard return values. There's still a deprecated shim with that signature, but since the return value is often important, you shouldn't use it.