[resend 1/2] winex11: Don't send fake caption click to windows without a caption.

Grazvydas Ignotas notasas at gmail.com
Thu Feb 2 17:00:25 CST 2017

Confuses TFM/VGM Music Maker, see bug 41647.

The problem triggers at the time the window is activated as a result of
SetWindowPos(), then WM_MOUSEACTIVATE arrives which definitely doesn't
happen on Windows. Probably should somehow get rid the fake click
completely, but it has been around for a very long time and this patch
is enough to fix the app.

Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
 dlls/winex11.drv/event.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index a0bfe05..306e897 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -692,12 +692,14 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
     else if (protocol == x11drv_atom(WM_TAKE_FOCUS))
         HWND last_focus = x11drv_thread_data()->last_focus;
+        LONG style;
         TRACE( "got take focus msg for %p, enabled=%d, visible=%d (style %08x), focus=%p, active=%p, fg=%p, last=%p\n",
                hwnd, IsWindowEnabled(hwnd), IsWindowVisible(hwnd), GetWindowLongW(hwnd, GWL_STYLE),
                GetFocus(), GetActiveWindow(), GetForegroundWindow(), last_focus );
-        if (can_activate_window(hwnd))
+        style = GetWindowLongW( hwnd, GWL_STYLE );
+        if ((style & WS_CAPTION) == WS_CAPTION && can_activate_window(hwnd))
             /* simulate a mouse click on the caption to find out
              * whether the window wants to be activated */

More information about the wine-patches mailing list