Keith Stevens : comctl32: trackbar: Correctly set lSetMin and lSelMax.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Mar 16 07:20:26 CDT 2007
Module: wine
Branch: master
Commit: de608991eacc944d63ae45bb418813e7f9af09cf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=de608991eacc944d63ae45bb418813e7f9af09cf
Author: Keith Stevens <fozziethebeat at gmail.com>
Date: Thu Mar 15 22:04:45 2007 -0700
comctl32: trackbar: Correctly set lSetMin and lSelMax.
Modify the behavior when the messages TBM_SETSEL, TBM_SETSELSTART, and
TBM_SETSELEND are sent and TBS_ENABLESELRANGE is not set. When the
style TBS_ENABLESELRANGE is not set, Windows observed behavior is to
set the Selection Start and End values to 0, rather than leave them
unchanged.
---
dlls/comctl32/tests/trackbar.c | 16 ++++------------
dlls/comctl32/trackbar.c | 13 ++++++++++---
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c
index bb2ccdb..3cecd88 100644
--- a/dlls/comctl32/tests/trackbar.c
+++ b/dlls/comctl32/tests/trackbar.c
@@ -902,16 +902,12 @@ static void test_ignore_selection(HWND hWndTrackbar){
/* test TBM_SETSEL ensure that it is ignored */
SendMessage(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(0,10));
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
- todo_wine{
- expect(0, r);
- }
+ expect(0, r);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
expect(0, r);
SendMessage(hWndTrackbar, TBM_SETSEL, FALSE, MAKELONG(0,10));
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
- todo_wine{
- expect(0, r);
- }
+ expect(0, r);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
expect(0, r);
@@ -921,9 +917,7 @@ static void test_ignore_selection(HWND hWndTrackbar){
expect(0, r);
SendMessage(hWndTrackbar, TBM_SETSELEND, TRUE, 10);
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
- todo_wine{
- expect(0,r);
- }
+ expect(0,r);
SendMessage(hWndTrackbar, TBM_SETSELEND, FALSE, 0);
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
expect(0, r);
@@ -934,9 +928,7 @@ static void test_ignore_selection(HWND hWndTrackbar){
expect(0, r);
SendMessage(hWndTrackbar, TBM_SETSELSTART, TRUE, 10);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
- todo_wine{
- expect(0,r);
- }
+ expect(0,r);
SendMessage(hWndTrackbar, TBM_SETSELSTART, FALSE, 0);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
expect(0, r);
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index b61e64d..d718e00 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -1216,8 +1216,11 @@ TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMin)
inline static LRESULT
TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
{
- if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
+ if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ infoPtr->lSelMin = 0;
+ infoPtr->lSelMax = 0;
return 0;
+ }
infoPtr->lSelMin = (SHORT)LOWORD(lSel);
infoPtr->lSelMax = (SHORT)HIWORD(lSel);
@@ -1237,8 +1240,10 @@ TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
inline static LRESULT
TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
{
- if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
+ if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ infoPtr->lSelMax = 0;
return 0;
+ }
infoPtr->lSelMax = lEnd;
infoPtr->flags |= TB_SELECTIONCHANGED;
@@ -1255,8 +1260,10 @@ TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
inline static LRESULT
TRACKBAR_SetSelStart (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lStart)
{
- if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
+ if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ infoPtr->lSelMin = 0;
return 0;
+ }
infoPtr->lSelMin = lStart;
infoPtr->flags |=TB_SELECTIONCHANGED;
More information about the wine-cvs
mailing list