[PATCH v4 1/4] user32: Move internal message from EnableWindow to WIN_SetStyle(). (resend)

Zebediah Figura z.figura12 at gmail.com
Fri Apr 7 14:17:08 CDT 2017


This is the only part that needs internal messaging, and, in fact,
should be preferred, since otherwise the focus is incorrectly killed.

This causes the internal message tests to be "fixed", however, the
underlying phenomenon still exists, so I have changed the function to
SetParent(), which still displays the relevant behaviour.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/user32/message.c      | 4 ++--
 dlls/user32/spy.c          | 2 +-
 dlls/user32/tests/msg.c    | 4 ++--
 dlls/user32/user_private.h | 2 +-
 dlls/user32/win.c          | 9 +--------
 5 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 9bfb453..d13a9b0 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -1867,9 +1867,9 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
         return (LRESULT)SetParent( hwnd, (HWND)wparam );
     case WM_WINE_SETWINDOWLONG:
         return WIN_SetWindowLong( hwnd, (short)LOWORD(wparam), HIWORD(wparam), lparam, TRUE );
-    case WM_WINE_ENABLEWINDOW:
+    case WM_WINE_SETSTYLE:
         if (is_desktop_window( hwnd )) return 0;
-        return EnableWindow( hwnd, wparam );
+        return WIN_SetStyle(hwnd, wparam, lparam);
     case WM_WINE_SETACTIVEWINDOW:
         if (is_desktop_window( hwnd )) return 0;
         if (!wparam && GetForegroundWindow() == hwnd) return 0;
diff --git a/dlls/user32/spy.c b/dlls/user32/spy.c
index 4f8e56f..ff80051 100644
--- a/dlls/user32/spy.c
+++ b/dlls/user32/spy.c
@@ -1136,7 +1136,7 @@ static const char * const WINEMessageTypeNames[SPY_MAX_WINEMSGNUM + 1] =
     "WM_WINE_SHOWWINDOW",
     "WM_WINE_SETPARENT",
     "WM_WINE_SETWINDOWLONG",
-    "WM_WINE_ENABLEWINDOW",
+    "WM_WINE_SETSTYLE",
     "WM_WINE_SETACTIVEWINDOW",
     "WM_WINE_KEYBOARD_LL_HOOK",
     "WM_WINE_MOUSE_LL_HOOK",
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index fbadf7d..093aaa6 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -16298,8 +16298,8 @@ static DWORD WINAPI SendMessage_thread_2(void *param)
     PostMessageA(wnd_event->hwnd, WM_USER+1, 0, 0);
 
     /* this leads to sending an internal message under Wine */
-    trace("thread: call EnableWindow\n");
-    EnableWindow(wnd_event->hwnd, TRUE);
+    trace("thread: call SetParent\n");
+    SetParent(wnd_event->hwnd, wnd_event->hwnd);
 
     trace("thread: call SendMessage\n");
     SendMessageA(wnd_event->hwnd, WM_USER+2, 0, 0);
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 0b5b2ac..b4a756c 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -48,7 +48,7 @@ enum wine_internal_message
     WM_WINE_SHOWWINDOW,
     WM_WINE_SETPARENT,
     WM_WINE_SETWINDOWLONG,
-    WM_WINE_ENABLEWINDOW,
+    WM_WINE_SETSTYLE,
     WM_WINE_SETACTIVEWINDOW,
     WM_WINE_KEYBOARD_LL_HOOK,
     WM_WINE_MOUSE_LL_HOOK,
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 5c27a01..8443c4d 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -768,8 +768,7 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits )
     if (win == WND_OTHER_PROCESS)
     {
         if (IsWindow(hwnd))
-            ERR( "cannot set style %x/%x on other process window %p\n",
-                 set_bits, clear_bits, hwnd );
+            return SendMessageW(hwnd, WM_WINE_SETSTYLE, set_bits, clear_bits);
         return 0;
     }
     style.styleOld = win->dwStyle;
@@ -2137,7 +2136,6 @@ HWND WINAPI GetDesktopWindow(void)
 BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
 {
     BOOL retvalue;
-    HWND full_handle;
 
     if (is_broadcast(hwnd))
     {
@@ -2145,11 +2143,6 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
         return FALSE;
     }
 
-    if (!(full_handle = WIN_IsCurrentThread( hwnd )))
-        return SendMessageW( hwnd, WM_WINE_ENABLEWINDOW, enable, 0 );
-
-    hwnd = full_handle;
-
     TRACE("( %p, %d )\n", hwnd, enable);
 
     if (enable)
-- 
2.7.4




More information about the wine-patches mailing list