From: Mikko Rasa Date: Thu, 6 Mar 2008 01:46:11 +0000 (+0000) Subject: Fix HSlider X-Git-Tag: 0.9~11 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=14843a7e876b02d1ade422c929a066a7bab16f3b;p=libs%2Fgltk.git Fix HSlider --- diff --git a/source/hslider.cpp b/source/hslider.cpp index a0caca5..e9db05f 100644 --- a/source/hslider.cpp +++ b/source/hslider.cpp @@ -23,9 +23,9 @@ HSlider::HSlider(const Resources &r): void HSlider::button_press(int x, int y, unsigned btn) { - if(geom.is_inside(x, y)) + if(geom.is_inside_relative(x, y) && max>min) { - int sx=geom.x+static_cast((geom.w-slider_size)*(value-min)/(max-min)); + int sx=static_cast((geom.w-slider_size)*(value-min)/(max-min)); if(btn==1 && x>=sx && x(sx+slider_size)) start_drag(x); } @@ -33,7 +33,7 @@ void HSlider::button_press(int x, int y, unsigned btn) void HSlider::button_release(int, int, unsigned btn) { - if(btn==1) + if(btn==1 && dragging) end_drag(); }