Fix #257

This is slightly hacky. It would also be possible to go through and add type information to `set_window_callback!` and all of its invocations.