I posted a patch that would fix a focus related livelock. However, I have to admit that the patch is quite hacky and likely not to be included in Wine. Since I would like to get this bug fixed, I thought to ask opinions about the correct way to fix the bug.
The short description of the bug is that setting active/foreground/focus window in Wine calls X11DRV_SetFocus, which calls XSetInputFocus. This makes Wine receive FocusIn event, the handler of which calls SetForegroundWindow. Even though SetForegroundWindow does nothing if its parameter matches current foreground window, it can be easily seen that having more than one window can lead into livelock. This happens repeatably every time you start Colonization for Windows.
I'm currently thinking about calling directly some WINPOS_* routine from X11 FocusIn handler instead of SetForegroundWindow. If the routine acted exactly like SetForegroundWindow except it made sure that it causes no calls to X11DRV_SetFocus, focus problem would be fixed. Unfortunately I have not figured any good way to pass an extra flag to default handler for WM_ACTIVATE, so that the routine would call something like SetFocus_DontCallDriver instead of regular SetFocus...
-- Jukka Heinonen http://www.iki.fi/jhei/