Commit 0ac74d18 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

user32: Always send WM_CANCELMODE when disabling a window.

parent b4fea4f2
......@@ -1796,11 +1796,24 @@ static const struct message WmEnableWindowSeq_1[] =
static const struct message WmEnableWindowSeq_2[] =
{
{ WM_CANCELMODE, sent|wparam|lparam, 0, 0 },
{ EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ 0 }
};
static const struct message WmEnableWindowSeq_3[] =
{
{ EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ WM_ENABLE, sent|wparam|lparam, TRUE, 0 },
{ 0 }
};
static const struct message WmEnableWindowSeq_4[] =
{
{ EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
{ 0 }
};
static const struct message WmGetScrollRangeSeq[] =
{
{ SBM_GETRANGE, sent },
......@@ -5484,8 +5497,14 @@ static void test_messages(void)
EnableWindow(hparent, FALSE);
ok_sequence(WmEnableWindowSeq_1, "EnableWindow(FALSE)", FALSE);
EnableWindow(hparent, FALSE);
ok_sequence(WmEnableWindowSeq_2, "EnableWindow(FALSE)", FALSE);
EnableWindow(hparent, TRUE);
ok_sequence(WmEnableWindowSeq_3, "EnableWindow(TRUE)", FALSE);
EnableWindow(hparent, TRUE);
ok_sequence(WmEnableWindowSeq_2, "EnableWindow(TRUE)", FALSE);
ok_sequence(WmEnableWindowSeq_4, "EnableWindow(TRUE)", FALSE);
flush_events();
flush_sequence();
......
......@@ -2152,23 +2152,23 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
TRACE("( %p, %d )\n", hwnd, enable);
retvalue = !IsWindowEnabled( hwnd );
if (enable && retvalue)
if (enable)
{
WIN_SetStyle( hwnd, 0, WS_DISABLED );
SendMessageW( hwnd, WM_ENABLE, TRUE, 0 );
retvalue = (WIN_SetStyle( hwnd, 0, WS_DISABLED ) & WS_DISABLED) != 0;
if (retvalue) SendMessageW( hwnd, WM_ENABLE, TRUE, 0 );
}
else if (!enable && !retvalue)
else
{
SendMessageW( hwnd, WM_CANCELMODE, 0, 0);
WIN_SetStyle( hwnd, WS_DISABLED, 0 );
SendMessageW( hwnd, WM_CANCELMODE, 0, 0 );
if (hwnd == GetFocus())
SetFocus( 0 ); /* A disabled window can't have the focus */
retvalue = (WIN_SetStyle( hwnd, WS_DISABLED, 0 ) & WS_DISABLED) != 0;
if (!retvalue)
{
if (hwnd == GetFocus())
SetFocus( 0 ); /* A disabled window can't have the focus */
SendMessageW( hwnd, WM_ENABLE, FALSE, 0 );
SendMessageW( hwnd, WM_ENABLE, FALSE, 0 );
}
}
return retvalue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment