http://bugs.winehq.org/show_bug.cgi?id=2981
Summary: direct input device only works when created in the thread which created the window Product: Wine Version: unspecified Platform: Other OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-directx AssignedTo: wine-bugs@winehq.org ReportedBy: allefant@gmail.com
All windows programs created with the Allegro games library (http://alleg.sf.net) don't have keyboard input under Wine. Here is an .exe (one of the example programs that come with it) to show the problem: http://allefant.sf.net/uploads/exkeys.exe. You can also get the complete library (http://prdownloads.sourceforge.net/alleg/all403.zip?download), it includes it as example. (Or you should be able to find some windows games made with it, like the ones here: http://www.freelunchdesign.com/games.shtml)
I also tracked down the cause of this in the Allegro source code: If the direct input device for the keyboard is created in the primary thread, Wine doesn't deliver keyboard events. If it is created in the same thread which also created the window, everything works.
The critical place in the source code is this line: http://srnet.cz/~stepan/allegro/srcs/allegro-4.2.0-beta3/src/win/wkeybd.c.ht...
If this line (and only this line) is moved into the same thread which created the window, keyboard starts working.
I assume, most windows programs create the window in the primary thread, so this is why Wine could have this bug for so long. But since it works in real windows (in fact, all version from the most ancient to most recent - everything that supports at least dx 3.0), and also MSDN doesn't require it to be the primary thread, it should be fixed.
Tell me if you need any more info. I can also try to provide a short testcase independent of Allegro, which shows the problem: Simply create a window not in the primary thread, then intialize the direct input keyboard device from the primary thread: It will work in real windows, but not in wine.
Oh, and somewhat off-topic for this, but it's the reason I report the bug - do you think we should add a work-around for this in Allegro, or will future Wine versions have it fixed?