Commit ef7464b0 authored by Yoann Peronneau's avatar Yoann Peronneau

* wxwidgets: repair slider dragging.

  my algorithm is still not perfect: it should take account of the "thumb length"
parent bd6335a4
...@@ -434,15 +434,26 @@ void InputManager::OnSliderUpdate( wxScrollEvent& event ) ...@@ -434,15 +434,26 @@ void InputManager::OnSliderUpdate( wxScrollEvent& event )
void InputManager::OnSliderClick( wxMouseEvent& event ) void InputManager::OnSliderClick( wxMouseEvent& event )
{ {
wxSlider* slider = wxStaticCast( event.GetEventObject(), wxSlider ); wxSlider* slider = wxStaticCast( event.GetEventObject(), wxSlider );
int min = slider->GetMin(); int i_min = slider->GetMin();
int max = slider->GetMax(); int i_max = slider->GetMax();
int pos = event.GetPosition().x; int i_pos = event.GetPosition().x;
int dim = slider->GetClientSize().x; int i_dim = slider->GetClientSize().x;
int i_val = i_min + ( i_pos * ( i_max - i_min + 1 ) ) / i_dim;
if( pos < 0 || pos >= dim ) return; if( i_pos < 0 || i_pos >= i_dim ) return;
int val = ( pos * ( max - min + 1 ) ) / dim; vlc_mutex_lock( &p_intf->change_lock );
slider->SetValue( min + val );
slider->SetValue( i_val );
if( i_slider_pos != i_val && p_intf->p_sys->p_input )
{
vlc_value_t pos;
pos.f_float = (float)i_val / (float)SLIDER_MAX_POS;
var_Set( p_intf->p_sys->p_input, "position", pos );
}
vlc_mutex_unlock( &p_intf->change_lock );
event.Skip(); event.Skip();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment