[PATCH 4/4] Reset current selection on negative focus value

Nikolay Sivov bunglehead at gmail.com
Fri Nov 20 06:32:44 CST 2009


---
 dlls/comctl32/tab.c       |    8 +++++++-
 dlls/comctl32/tests/tab.c |    8 +++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index a9e29e2..35985f8 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -269,8 +269,14 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
 {
   TRACE("(%p %d)\n", infoPtr, iItem);
 
-  if (iItem < 0)
+  if (iItem < 0) {
       infoPtr->uFocus = -1;
+      if (infoPtr->iSelected != -1) {
+          infoPtr->iSelected = -1;
+          TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
+          TAB_InvalidateTabArea(infoPtr);
+      }
+  }
   else if (iItem < infoPtr->uNumItem) {
     if (infoPtr->dwStyle & TCS_BUTTONS) {
       /* set focus to new item, leave selection as is */
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 144f834..6774d51 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -660,9 +660,7 @@ static void test_curfocus(HWND parent_wnd, INT nTabs)
 
     /* Testing CurFocus with value larger than number of tabs */
     focusIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
-    todo_wine{
-        expect(-1, focusIndex);
-    }
+    expect(-1, focusIndex);
 
     SendMessage(hTab, TCM_SETCURFOCUS, nTabs+1, 0);
     focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
@@ -1059,7 +1057,7 @@ static void test_insert_focus(HWND parent_wnd)
     expect(2, r);
 
     ok_sequence(sequences, TAB_SEQ_INDEX, insert_focus_seq, "insert_focus test sequence", FALSE);
-    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", FALSE);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", TRUE);
 
     DestroyWindow(hTab);
 }
@@ -1108,7 +1106,7 @@ static void test_delete_focus(HWND parent_wnd)
     expect(-1, r);
 
     ok_sequence(sequences, TAB_SEQ_INDEX, delete_focus_seq, "delete_focus test sequence", FALSE);
-    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "delete_focus parent test sequence", FALSE);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "delete_focus parent test sequence", TRUE);
 
     DestroyWindow(hTab);
 }
-- 
1.5.6.5


--=-HMxiuKD+ACLHzSpfuY2t--




More information about the wine-patches mailing list