-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only allowed one SDL_SetEventFilter #28
Comments
You can set your own filter that overrides ours, as SDL will throw out the previous filter when setting: https://hg.libsdl.org/SDL/file/5b61e12c0a30/src/events/SDL_events.c#l480 You can pull in what FNA's doing and get the same thing, you'd just have to inline this redraw func: https://github.com/FNA-XNA/FNA/blob/master/src/Game.cs#L591 As long as you add the filter after we've added ours you'll be fine, and because of that you can probably skip that TimeSpan.Zero check too, so it should be 100% compatible with the public API for Game. |
Yeah that seems to be the best, thanks for your help. Is that windows pumping issue just a problem in the current SDL library? or is there something fundamentally which prevents windows providing the required events? |
It appears to be a fundamental problem with Windows. I have a patch submitted to do the InvalidateRect call: https://bugzilla.libsdl.org/show_bug.cgi?id=3307 The problem is that Windows stalls everything (but it does still send events to the WndProc) when resizing, so we'd only redraw after the user has finished resizing. I'm hoping to get the InvalidateRect part in at least, but the event timings are something that may be unfixable. |
Hi,
Code was added recently due to poor Windows event pumping at https://github.com/FNA-XNA/FNA/blob/master/src/SDL2/SDL2_FNAPlatform.cs#L160 which makes use of an SDL_SetEventFilter. However it looks like after googling it, that SDL only supports a single EventFilter (and multiple event watchers) which means its now not possible to intercept the events being polled by the main FNA loop.
I was trying to make use of the EventFilter to catch SDL_EventType.SDL_QUIT and use that to delay the closing so I can put up a prompt for the user to Save before quitting or just to cancel the close. However it clashes with FNAs usage because I am in the unfortunate position of being on Windows and allowing user resizing.
I was wondering if you have any ideas for how this can be handled without changing the FNA code?
Thanks in advance.
The text was updated successfully, but these errors were encountered: