DBus does not require a video backend, and DBus messages still need to be processed even when a video backend is not initialized. Move the DBus pump call to the main event message pump function so that DBus events are still dispatched, even when a video backend has not been initialized.
This allows changing out `__FILE__` in general and the file path reported in
SDL_assert specifically to not leak build machine path info, or just simply
not include the absolute path if you swap it out with `FILE_NAME` on Clang/GCC.
Fixes#14290.
In this case, it means a newly-created window on a specific display won't
get mouse/keyboard input (which, presumably, will continue to go to a window
on a different physical display instead).
This also makes SDL_SetWindowFocusable() functional on the kmsdrm backend, to
change this flag later, but to be clear, there are no window focus events to
jump between displays in this backend, so this is only useful to manually
tweak things later.
Fixes#14289.
There is no guarantee that libdecor will always dispatch the main queue (a future plugin may run on its own queue), so ensure that the main queue is still dispatched when showing a libdecor window, as is already the case when pumping events.
The queue running on the cursor thread might flush color events before their queue has been set. Use proxy wrappers for their parent objects to assign the queue atomically at creation time.
If the main event handling thread runs slowly, so will cursor animations. Use a dedicated thread for cursor surface events, so that animations will always run at a consistent rate.
Clean up and implement some best practices for event polling and handling:
- Ensure that events are still pumped, even if existing events are in the queue, to ensure that the most recent data is always processed.
- Handle wl_display_flush returning EAGAIN by trying to poll the socket until it can be written to.
- Ensure that events are always pumped on interrupts and broken pipe errors to handle quit events.
- Minimize double-pumping of events, since returning a success code from a wait will implicitly pump events again.
- Wake to poll when using a DBus IME, but the text input protocol is not enabled, to ensure that text events are delivered.
The higher-level functions only convert the base image, so alternate scaled images for icons and cursors need to be converted when being copied to the buffers.