[COMCTL32] Handle TCIS_BUTTONPRESSED at TAB_SetCurFocus (#4179)

Based on @JoachimHenze (reactosfanboy)'s patch. Switch TCIS_BUTTONPRESSED flag at TAB_SetCurFocus function.
CORE-4245
This commit is contained in:
Katayama Hirofumi MZ 2021-12-27 10:04:29 +09:00 committed by GitHub
parent 691139c090
commit 98775c4c83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -285,6 +285,9 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
if (iItem < 0) { if (iItem < 0) {
infoPtr->uFocus = -1; infoPtr->uFocus = -1;
if (infoPtr->iSelected != -1) { if (infoPtr->iSelected != -1) {
#ifdef __REACTOS__
TAB_GetItem(infoPtr, infoPtr->iSelected)->dwState &= ~TCIS_BUTTONPRESSED;
#endif
infoPtr->iSelected = -1; infoPtr->iSelected = -1;
TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
TAB_InvalidateTabArea(infoPtr); TAB_InvalidateTabArea(infoPtr);
@ -310,12 +313,22 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
TAB_SendSimpleNotify(infoPtr, TCN_FOCUSCHANGE); TAB_SendSimpleNotify(infoPtr, TCN_FOCUSCHANGE);
} }
} else { } else {
#ifdef __REACTOS__
INT oldItem = infoPtr->iSelected;
#endif
INT oldFocus = infoPtr->uFocus; INT oldFocus = infoPtr->uFocus;
if (infoPtr->iSelected != iItem || oldFocus == -1 ) { if (infoPtr->iSelected != iItem || oldFocus == -1 ) {
infoPtr->uFocus = iItem; infoPtr->uFocus = iItem;
if (oldFocus != -1) { if (oldFocus != -1) {
if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) { if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) {
#ifdef __REACTOS__
if (oldItem != -1)
TAB_GetItem(infoPtr, oldItem)->dwState &= ~TCIS_BUTTONPRESSED;
#endif
infoPtr->iSelected = iItem; infoPtr->iSelected = iItem;
#ifdef __REACTOS__
TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
#endif
TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
} }
else else