Fix stuck faders on very fine adjustments.
I attempted to preserve the "don't draw unless different" by ditching rounding for more precise display_span, but that didn't work. An alternative solution would be to draw on adjustment change if there's text, since then we need to redraw regardless of slider position, but it seemed weird even just with respect to the slider, so I opted for this, which really definitely redraws when the adjustment changes, period. If this proves to be a performance issue we'll have to figure that out.
This commit is contained in:
parent
fb406e5b36
commit
587dc283ea
@ -90,7 +90,6 @@ class LIBGTKMM2EXT_API PixFader : public CairoWidget
|
||||
GdkWindow* _grab_window;
|
||||
double _grab_loc;
|
||||
double _grab_start;
|
||||
int _last_drawn;
|
||||
bool _dragging;
|
||||
float _default_value;
|
||||
int _unity_loc;
|
||||
|
@ -53,7 +53,6 @@ PixFader::PixFader (Gtk::Adjustment& adj, int orientation, int fader_length, int
|
||||
, _orien (orientation)
|
||||
, _pattern (0)
|
||||
, _hovering (false)
|
||||
, _last_drawn (-1)
|
||||
, _dragging (false)
|
||||
, _centered_text (true)
|
||||
, _current_parent (0)
|
||||
@ -331,8 +330,6 @@ PixFader::render (cairo_t *cr, cairo_rectangle_t* area)
|
||||
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.1);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
_last_drawn = ds;
|
||||
}
|
||||
|
||||
void
|
||||
@ -424,7 +421,6 @@ PixFader::on_button_release_event (GdkEventButton* ev)
|
||||
|
||||
if (ev_pos == _grab_start) {
|
||||
/* no motion - just a click */
|
||||
const double slider_pos = display_span();
|
||||
ev_pos = rint(ev_pos);
|
||||
|
||||
if (ev->state & Keyboard::TertiaryModifier) {
|
||||
@ -562,9 +558,7 @@ PixFader::on_motion_notify_event (GdkEventMotion* ev)
|
||||
void
|
||||
PixFader::adjustment_changed ()
|
||||
{
|
||||
if (display_span() != _last_drawn) {
|
||||
queue_draw ();
|
||||
}
|
||||
queue_draw ();
|
||||
}
|
||||
|
||||
/** @return pixel offset of the current value from the right or bottom of the fader */
|
||||
|
Loading…
Reference in New Issue
Block a user