user32 - set_active_window uses SendMessage instead of PostMessage for WM_ACTIVATEAPP messages.

Peter Dons Tychsen donpedro at tdcadsl.dk
Fri Aug 3 19:44:23 CDT 2007


Hello again,

1) Yes i did testing on Windows-XP. I did it by putting together various
examples and by checking with InSendMessage() for all cases. This
clearly showed that WM_ACTIVATEAPP was always posted and never sent.

2) Yes, i tested with the msg.c test-cases. The patch does "break" some
tests in it. Please read note below:

However, the test system for msg.c in user32 i severely broken. If i
upgrade the test system, it will require lots of more changes to prevent
even more test-cases from breaking.

The problem is in the ok_sequence_() function of the test system. It is
missing a call to:

while(PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg);

This is needed to make sure that all messages are pulled from the queue
before it starts comparing with the expected messages (especially for
posted message - sent messages are always received).

I think is is also the reason why these tast-cases are a bit flaky.
On machine the number of passed cases vary allot (because it ends up
being timing dependent).

If i introduce this in this patch, i will either be flamed for
destroying working test cases or for changing too much. The change
(which i think needs to be done) breaks around 100 test cases (allot of
small changes). Mostly because they now get all the messages which were
previously stuck on the queue.

I think the missing line should be added in a patch by itself along with
a fix for all the broken cases. Trying to blend it in with this patch
will end up a mess.

/Pedro


On Thu, 2007-08-02 at 20:34 -0600, Vitaliy Margolen wrote:
> Peter Dons Tychsen wrote:
> > Hello Wine.
> > 
> > On original Windows, the messages WM_ACTIVATEAPP are sent using
> > PostMessage() and not SendMessage() like in the current Wine
> > implementation.
> > 
> > I have thoroughly verified that this is the case on Windows-XP (that it
> > uses PostMessage()). 
> > 
> > This error can lead to fatal focusing problems, as some programs call
> > more focus related functions when they receive this message. This leads
> > to recursive calls into set_active_calls. It does not crash, but leads
> > to unexpected results such as lost focus for mouse and keyboard.
> > 
> > This fixes the focus for the game "Wild Metal" if you switch focus from
> > the game to the desktop, and then back again.
> > 
> > http://www.rockstargames.com/classics/
> > 
> > Cheers,
> > 
> > /Pedro
> > 
> > 
> 
> This patch makes 45 msg.c tests in user32 fail for me. Could you double 
> check your findings? Also when you say "thoroughly verified" have you used 
> Wine tests or your own program?
> 
> 
> Vitaliy
> 
> 




More information about the wine-devel mailing list