[PATCH v2 2/5] user32: Move internal message from EnableWindow() to WIN_SetStyle().
Zebediah Figura
z.figura12 at gmail.com
Fri Mar 17 09:48:35 CDT 2017
This is the only part that needs internal messaging, and, in fact,
should be preferred, since otherwise the focus is incorrectly killed.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/user32/message.c | 4 ++--
dlls/user32/spy.c | 2 +-
dlls/user32/user_private.h | 2 +-
dlls/user32/win.c | 15 +--------------
4 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 92caf64..48d2a20 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/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 4406577..fb8f948 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);
retvalue = !IsWindowEnabled( hwnd );
@@ -2161,8 +2154,6 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
}
else if (!enable && !retvalue)
{
- HWND capture_wnd;
-
SendMessageW( hwnd, WM_CANCELMODE, 0, 0);
WIN_SetStyle( hwnd, WS_DISABLED, 0 );
@@ -2170,10 +2161,6 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
if (hwnd == GetFocus())
SetFocus( 0 ); /* A disabled window can't have the focus */
- capture_wnd = GetCapture();
- if (hwnd == capture_wnd || IsChild(hwnd, capture_wnd))
- ReleaseCapture(); /* A disabled window can't capture the mouse */
-
SendMessageW( hwnd, WM_ENABLE, FALSE, 0 );
}
return retvalue;
--
2.7.4
More information about the wine-patches
mailing list