-static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
-{
- if (!win->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
-
- float diff = win->m_adjust->value - win->m_oldPos;
- if (fabs(diff) < 0.2) return;
-
- wxEventType command = wxEVT_NULL;
-
- float line_step = win->m_adjust->step_increment;
- float page_step = win->m_adjust->page_increment;
-
- if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
- else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
- else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
- else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
- else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
- else command = wxEVT_SCROLL_THUMBTRACK;
-
- int value = (int)(win->m_adjust->value+0.5);
-
- int orient = wxHORIZONTAL;
- if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
-
- wxScrollEvent event( command, win->GetId(), value, orient );
- event.SetEventObject( win );
- win->ProcessEvent( event );
-
- wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
- cevent.SetEventObject( win );
- win->ProcessEvent( cevent );
+static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return;
+ if (g_blockEventsOnDrag) return;
+
+ float diff = adjust->value - win->m_oldPos;
+ if (fabs(diff) < sensitivity) return;
+
+ win->m_oldPos = adjust->value;
+
+ GtkRange *range = GTK_RANGE( win->m_widget );
+
+ wxEventType command = wxEVT_SCROLL_THUMBTRACK;
+ if (range->scroll_type == GTK_SCROLL_STEP_BACKWARD) command = wxEVT_SCROLL_LINEUP;
+ else if (range->scroll_type == GTK_SCROLL_STEP_FORWARD) command = wxEVT_SCROLL_LINEDOWN;
+ 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);
+
+ int orient = wxHORIZONTAL;
+ if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
+ orient = wxVERTICAL;
+
+ wxScrollEvent event( command, win->GetId(), value, orient );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
+
+ wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
+ cevent.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( cevent );