Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0e73e478
Commit
0e73e478
authored
Feb 09, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tab: Fix TCM_SETCURSEL on negative indices.
parent
8c2b4bfe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
10 deletions
+35
-10
tab.c
dlls/comctl32/tab.c
+17
-10
tab.c
dlls/comctl32/tests/tab.c
+18
-0
No files found.
dlls/comctl32/tab.c
View file @
0e73e478
...
@@ -252,22 +252,29 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
...
@@ -252,22 +252,29 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
TRACE
(
"(%p %d)
\n
"
,
infoPtr
,
iItem
);
TRACE
(
"(%p %d)
\n
"
,
infoPtr
,
iItem
);
if
(
iItem
<
0
)
if
(
iItem
>=
(
INT
)
infoPtr
->
uNumItem
)
infoPtr
->
iSelected
=
-
1
;
else
if
(
iItem
>=
infoPtr
->
uNumItem
)
return
-
1
;
return
-
1
;
else
{
if
(
prevItem
!=
iItem
)
{
if
(
prevItem
!=
-
1
)
TAB_GetItem
(
infoPtr
,
prevItem
)
->
dwState
&=
~
TCIS_BUTTONPRESSED
;
TAB_GetItem
(
infoPtr
,
iItem
)
->
dwState
|=
TCIS_BUTTONPRESSED
;
if
(
prevItem
!=
iItem
)
{
if
(
prevItem
!=
-
1
)
TAB_GetItem
(
infoPtr
,
prevItem
)
->
dwState
&=
~
TCIS_BUTTONPRESSED
;
if
(
iItem
>=
0
)
{
TAB_GetItem
(
infoPtr
,
iItem
)
->
dwState
|=
TCIS_BUTTONPRESSED
;
infoPtr
->
iSelected
=
iItem
;
infoPtr
->
iSelected
=
iItem
;
infoPtr
->
uFocus
=
iItem
;
infoPtr
->
uFocus
=
iItem
;
TAB_EnsureSelectionVisible
(
infoPtr
);
TAB_InvalidateTabArea
(
infoPtr
);
}
}
else
{
infoPtr
->
iSelected
=
-
1
;
infoPtr
->
uFocus
=
-
1
;
}
TAB_EnsureSelectionVisible
(
infoPtr
);
TAB_InvalidateTabArea
(
infoPtr
);
}
}
return
prevItem
;
return
prevItem
;
}
}
...
...
dlls/comctl32/tests/tab.c
View file @
0e73e478
...
@@ -746,6 +746,24 @@ static void test_cursel(void)
...
@@ -746,6 +746,24 @@ static void test_cursel(void)
ok
(
tcItem
.
dwState
&
TCIS_BUTTONPRESSED
||
broken
(
tcItem
.
dwState
==
0
),
/* older comctl32 */
ok
(
tcItem
.
dwState
&
TCIS_BUTTONPRESSED
||
broken
(
tcItem
.
dwState
==
0
),
/* older comctl32 */
"Selected item should have TCIS_BUTTONPRESSED
\n
"
);
"Selected item should have TCIS_BUTTONPRESSED
\n
"
);
/* now deselect all and check previously selected item state */
focusIndex
=
SendMessageA
(
hTab
,
TCM_GETCURFOCUS
,
0
,
0
);
ok
(
focusIndex
==
1
,
"got %d
\n
"
,
focusIndex
);
selectionIndex
=
SendMessageA
(
hTab
,
TCM_SETCURSEL
,
-
1
,
0
);
ok
(
selectionIndex
==
1
,
"got %d
\n
"
,
selectionIndex
);
memset
(
&
tcItem
,
0
,
sizeof
(
TCITEMA
));
/* focus is reset too */
focusIndex
=
SendMessageA
(
hTab
,
TCM_GETCURFOCUS
,
0
,
0
);
ok
(
focusIndex
==
-
1
,
"got %d
\n
"
,
focusIndex
);
tcItem
.
mask
=
TCIF_STATE
;
tcItem
.
dwStateMask
=
TCIS_BUTTONPRESSED
;
SendMessageA
(
hTab
,
TCM_GETITEMA
,
selectionIndex
,
(
LPARAM
)
&
tcItem
);
ok
(
tcItem
.
dwState
==
0
,
"got state %d
\n
"
,
tcItem
.
dwState
);
DestroyWindow
(
hTab
);
DestroyWindow
(
hTab
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment