https://git.reactos.org/?p=reactos.git;a=commitdiff;h=98775c4c83f028d834974d283fdbe5f8df40b143

commit 98775c4c83f028d834974d283fdbe5f8df40b143
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Mon Dec 27 10:04:29 2021 +0900
Commit:     GitHub <[email protected]>
CommitDate: Mon Dec 27 10:04:29 2021 +0900

    [COMCTL32] Handle TCIS_BUTTONPRESSED at TAB_SetCurFocus (#4179)
    
    Based on @JoachimHenze (reactosfanboy)'s patch. Switch TCIS_BUTTONPRESSED 
flag at TAB_SetCurFocus function.
    CORE-4245
---
 dll/win32/comctl32/tab.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dll/win32/comctl32/tab.c b/dll/win32/comctl32/tab.c
index cf387cf2837..f2fc59fb4b6 100644
--- a/dll/win32/comctl32/tab.c
+++ b/dll/win32/comctl32/tab.c
@@ -285,6 +285,9 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT 
iItem)
   if (iItem < 0) {
       infoPtr->uFocus = -1;
       if (infoPtr->iSelected != -1) {
+#ifdef __REACTOS__
+          TAB_GetItem(infoPtr, infoPtr->iSelected)->dwState &= 
~TCIS_BUTTONPRESSED;
+#endif
           infoPtr->iSelected = -1;
           TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
           TAB_InvalidateTabArea(infoPtr);
@@ -310,12 +313,22 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT 
iItem)
         TAB_SendSimpleNotify(infoPtr, TCN_FOCUSCHANGE);
       }
     } else {
+#ifdef __REACTOS__
+      INT oldItem = infoPtr->iSelected;
+#endif
       INT oldFocus = infoPtr->uFocus;
       if (infoPtr->iSelected != iItem || oldFocus == -1 ) {
         infoPtr->uFocus = iItem;
         if (oldFocus != -1) {
           if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING))  {
+#ifdef __REACTOS__
+            if (oldItem != -1)
+              TAB_GetItem(infoPtr, oldItem)->dwState &= ~TCIS_BUTTONPRESSED;
+#endif
             infoPtr->iSelected = iItem;
+#ifdef __REACTOS__
+            TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
+#endif
             TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
           }
           else

Reply via email to