http://bugs.winehq.org/show_bug.cgi?id=9320
--- Comment #12 from Vincent Povirk madewokherd@gmail.com 2009-11-08 16:47:44 --- It actually looks like we try to focus the foreground window when the virtual desktop gets WM_TAKE_FOCUS. That really should work, but in my testing it doesn't.
When I click the titlebar of a virtual desktop with notepad in it, notepad does not get the focus (I can't type into it while my mouse is on the virtual desktop titlebar), and I get this:
trace:event:handle_wm_protocols got take focus msg for 0x30032, enabled=1, visible=1 (style 96000000), focus=0x30032, active=0x30032, fg=0x20052, last=(nil) trace:event:set_focus setting foreground window to 0x20052 trace:event:set_focus setting focus to 0x30032 (480000b) time=3998603
It seems we do SetForegroundWindow(0x20052), then we really set input focus to GetAncestor(GetFocus(), GA_ROOT), which returns 0x30032. 20052 is notepad, and 30032 is the desktop.
Does setting Foreground and reading back Focus make sense? I'm not very clear on the concepts.
(The problem with X11DRV_SetFocus is different from set_focus and still exists too.)