+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return;
+ if (g_blockEventsOnDrag) return;
+
+ GtkAdjustment* adj = gtk_range_get_adjustment (range);
+ const int pos = wxRound(adj->value);
+ const double oldPos = win->m_pos;
+ win->m_pos = adj->value;
+ if (win->m_blockScrollEvent)
+ {
+ win->m_scrollEventType = GTK_SCROLL_NONE;
+ return;
+ }
+
+ wxEventType eventType = wxEVT_NULL;
+ if (win->m_isScrolling)
+ {
+ eventType = wxEVT_SCROLL_THUMBTRACK;
+ }
+ else if (win->m_scrollEventType != GTK_SCROLL_NONE)
+ {
+ // Scroll event from "move-slider" (keyboard)
+ eventType = GtkScrollTypeToWx(win->m_scrollEventType);
+ }
+ else if (win->m_mouseButtonDown)
+ {
+ // Difference from last change event
+ const double diff = adj->value - oldPos;
+ const bool isDown = diff > 0;
+
+ if (IsScrollIncrement(adj->page_increment, diff))
+ {
+ eventType = isDown ? wxEVT_SCROLL_PAGEDOWN : wxEVT_SCROLL_PAGEUP;
+ }
+ else if (wxIsSameDouble(adj->value, 0))
+ {
+ eventType = wxEVT_SCROLL_PAGEUP;
+ }
+ else if (wxIsSameDouble(adj->value, adj->upper))
+ {
+ eventType = wxEVT_SCROLL_PAGEDOWN;
+ }
+ else
+ {
+ // Assume track event
+ eventType = wxEVT_SCROLL_THUMBTRACK;
+ // Remember that we're tracking
+ win->m_isScrolling = true;
+ }
+ }
+
+ win->m_scrollEventType = GTK_SCROLL_NONE;
+
+ // If integral position has changed
+ if (wxRound(oldPos) != pos)
+ {
+ wxCHECK_RET(eventType != wxEVT_NULL, _T("Unknown slider scroll event type"));
+ ProcessScrollEvent(win, eventType);
+ win->m_needThumbRelease = eventType == wxEVT_SCROLL_THUMBTRACK;
+ }
+}