X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ef7a25a73ef4215454d6d8e3bad63bdf5b4339a0..dd107c50be43e8d4dbdba20df162faf119a3781c:/src/gtk1/slider.cpp diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index 58aa39db81..00a061af9e 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -61,7 +61,8 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win ) else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP; else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN; - int value = (int)ceil(adjust->value); + double dvalue = adjust->value; + int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5); int orient = wxHORIZONTAL; if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL) @@ -160,7 +161,7 @@ int wxSlider::GetValue() const // we want to round to the nearest integer, i.e. 0.9 is rounded to 1 and // -0.9 is rounded to -1 double val = m_adjust->value; - return (int)(val >= 0 ? val - 0.5 : val + 0.5); + return (int)(val < 0 ? val - 0.5 : val + 0.5); } void wxSlider::SetValue( int value )