user32: Always send WM_CANCELMODE when disabling a window.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b4fea4f2f0
commit
0ac74d180a
|
@ -1795,12 +1795,25 @@ static const struct message WmEnableWindowSeq_1[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct message WmEnableWindowSeq_2[] =
|
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 },
|
{ EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
|
||||||
{ WM_ENABLE, sent|wparam|lparam, TRUE, 0 },
|
{ WM_ENABLE, sent|wparam|lparam, TRUE, 0 },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct message WmEnableWindowSeq_4[] =
|
||||||
|
{
|
||||||
|
{ EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static const struct message WmGetScrollRangeSeq[] =
|
static const struct message WmGetScrollRangeSeq[] =
|
||||||
{
|
{
|
||||||
{ SBM_GETRANGE, sent },
|
{ SBM_GETRANGE, sent },
|
||||||
|
@ -5484,8 +5497,14 @@ static void test_messages(void)
|
||||||
EnableWindow(hparent, FALSE);
|
EnableWindow(hparent, FALSE);
|
||||||
ok_sequence(WmEnableWindowSeq_1, "EnableWindow(FALSE)", FALSE);
|
ok_sequence(WmEnableWindowSeq_1, "EnableWindow(FALSE)", FALSE);
|
||||||
|
|
||||||
|
EnableWindow(hparent, FALSE);
|
||||||
|
ok_sequence(WmEnableWindowSeq_2, "EnableWindow(FALSE)", FALSE);
|
||||||
|
|
||||||
EnableWindow(hparent, TRUE);
|
EnableWindow(hparent, TRUE);
|
||||||
ok_sequence(WmEnableWindowSeq_2, "EnableWindow(TRUE)", FALSE);
|
ok_sequence(WmEnableWindowSeq_3, "EnableWindow(TRUE)", FALSE);
|
||||||
|
|
||||||
|
EnableWindow(hparent, TRUE);
|
||||||
|
ok_sequence(WmEnableWindowSeq_4, "EnableWindow(TRUE)", FALSE);
|
||||||
|
|
||||||
flush_events();
|
flush_events();
|
||||||
flush_sequence();
|
flush_sequence();
|
||||||
|
|
|
@ -2152,24 +2152,24 @@ BOOL WINAPI EnableWindow( HWND hwnd, BOOL enable )
|
||||||
|
|
||||||
TRACE("( %p, %d )\n", hwnd, enable);
|
TRACE("( %p, %d )\n", hwnd, enable);
|
||||||
|
|
||||||
retvalue = !IsWindowEnabled( hwnd );
|
if (enable)
|
||||||
|
|
||||||
if (enable && retvalue)
|
|
||||||
{
|
{
|
||||||
WIN_SetStyle( hwnd, 0, WS_DISABLED );
|
retvalue = (WIN_SetStyle( hwnd, 0, WS_DISABLED ) & WS_DISABLED) != 0;
|
||||||
SendMessageW( hwnd, WM_ENABLE, TRUE, 0 );
|
if (retvalue) SendMessageW( hwnd, WM_ENABLE, TRUE, 0 );
|
||||||
}
|
}
|
||||||
else if (!enable && !retvalue)
|
else
|
||||||
{
|
{
|
||||||
SendMessageW( hwnd, WM_CANCELMODE, 0, 0);
|
SendMessageW( hwnd, WM_CANCELMODE, 0, 0 );
|
||||||
|
|
||||||
WIN_SetStyle( hwnd, WS_DISABLED, 0 );
|
|
||||||
|
|
||||||
|
retvalue = (WIN_SetStyle( hwnd, WS_DISABLED, 0 ) & WS_DISABLED) != 0;
|
||||||
|
if (!retvalue)
|
||||||
|
{
|
||||||
if (hwnd == GetFocus())
|
if (hwnd == GetFocus())
|
||||||
SetFocus( 0 ); /* A disabled window can't have the focus */
|
SetFocus( 0 ); /* A disabled window can't have the focus */
|
||||||
|
|
||||||
SendMessageW( hwnd, WM_ENABLE, FALSE, 0 );
|
SendMessageW( hwnd, WM_ENABLE, FALSE, 0 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue