On Fri Feb 27 11:41:03 2026 +0000, Twaik Yont wrote:
These two calls are only relevant for the `explorer.exe /desktop=shell,,android` case, i.e. when we are actually running the Android desktop inside the JVM process. They are not generally required for every `wineandroid` initialization. Moving them into `android_init` would make them run unconditionally. In particular, it would spawn event queue file descriptors in non-desktop windows where it will remain unused. ANDROID_CreateDesktop is the point where we know we are creating the Android-backed desktop and running inside the JVM context, so keeping the calls there limits the behavior strictly to the scenario where it is required. Unlike platforms such as X11 or Wayland, Android does not provide a traditional event polling loop on the client side. Instead, the framework invokes callbacks asynchronously from one or more threads managed by its own thread pool. The number of threads and their scheduling characteristics are not fixed and may vary depending on runtime conditions.
To preserve deterministic ordering and avoid concurrency issues, the previous contributor implemented a custom event queue that forwards all Android callbacks into a single dedicated thread. This ensures serialized processing and maintains a well-defined event order, independent of how the Android runtime dispatches the callbacks. I tried to avoid redesigning or reworking the existing architecture. The goal was simply to restore the intended behavior and fix what appears to have been broken over time as the code evolved, without introducing conceptual changes or altering the original design. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9874#note_130706