Thomas Faber : comctl32: Unset the toolbar' s hot item when deleting a button.
Alexandre Julliard
julliard at winehq.org
Fri Jan 19 15:43:21 CST 2018
Module: wine
Branch: master
Commit: 4c5723296290d1db609a4c0c4078dcea6f828fad
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4c5723296290d1db609a4c0c4078dcea6f828fad
Author: Thomas Faber <thomas.faber at reactos.org>
Date: Fri Jan 19 11:44:43 2018 +0100
comctl32: Unset the toolbar's hot item when deleting a button.
Signed-off-by: Thomas Faber <thomas.faber at reactos.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/tests/toolbar.c | 10 ++++++++++
dlls/comctl32/toolbar.c | 1 +
2 files changed, 11 insertions(+)
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 1dfd4b2..2c1b789 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -923,6 +923,16 @@ static void test_hotitem(void)
ok(ret == 1, "TB_GETHOTITEM returned %ld, expected 1\n", ret);
ok(g_fReceivedHotItemChange == FALSE, "Unexpected TBN_HOTITEMCHANGE\n");
+ /* deleting a button unsets the hot item */
+ ret = SendMessageA(hToolbar, TB_SETHOTITEM, 0, 0);
+ ok(ret == 1, "TB_SETHOTITEM returned %ld, expected 1\n", ret);
+ g_fReceivedHotItemChange = FALSE;
+ ret = SendMessageA(hToolbar, TB_DELETEBUTTON, 1, 0);
+ ok(ret == TRUE, "TB_DELETEBUTTON returned %ld, expected TRUE\n", ret);
+ ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
+ ok(ret == -1, "TB_GETHOTITEM returned %ld, expected -1\n", ret);
+ ok(g_fReceivedHotItemChange == FALSE, "Unexpected TBN_HOTITEMCHANGE\n");
+
DestroyWindow(hToolbar);
}
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 8a03597..f9a2220 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -3233,6 +3233,7 @@ TOOLBAR_DeleteButton (TOOLBAR_INFO *infoPtr, INT nIndex)
TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[nIndex]);
+ infoPtr->nHotItem = -1;
if (infoPtr->nNumButtons == 1) {
TRACE(" simple delete\n");
free_string( infoPtr->buttons );
More information about the wine-cvs
mailing list