Nicklas Karlsson
2017-07-21 01:37:31 UTC
For some reason the hal dial had stopped working. It is the first time I look into the source code and at first I made wrong conclusion and found something that made it partially react to some action.
It look a little bit odd since self.delta_scaled is incremented/decremented both in the scroll function and emit_count_changed function. The increment/decrement in the emit_count_changed_signal seems to handle the case then dial is moved fast enough to not detect the crossover. Maybe you know better, I only know now it works for me.
diff --git a/lib/python/gladevcp/hal_dial.py b/lib/python/gladevcp/hal_dial.py
index 731fe64ee..e25945195 100644
--- a/lib/python/gladevcp/hal_dial.py
+++ b/lib/python/gladevcp/hal_dial.py
@@ -142,9 +142,11 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
if event.direction == gtk.gdk.SCROLL_UP:
self._count += 1
self._minute_offset +=1
+ self._delta_scaled += self.scale
if event.direction == gtk.gdk.SCROLL_DOWN:
self._count -= 1
self._minute_offset -=1
+ self._delta_scaled -= self.scale
self._last_offset = self._minute_offset
self.redraw_canvas()
self.emit("count_changed", self._count,self.scale,self._delta_scaled)
@@ -295,6 +297,7 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
alloc = self.get_allocation()
self.queue_draw_area(alloc.x, alloc.y, alloc.width, alloc.height)
self.window.process_updates(True)
+ self.queue_draw()
# Get propertys
def do_get_property(self, property):
Nicklas Karlsson
It look a little bit odd since self.delta_scaled is incremented/decremented both in the scroll function and emit_count_changed function. The increment/decrement in the emit_count_changed_signal seems to handle the case then dial is moved fast enough to not detect the crossover. Maybe you know better, I only know now it works for me.
diff --git a/lib/python/gladevcp/hal_dial.py b/lib/python/gladevcp/hal_dial.py
index 731fe64ee..e25945195 100644
--- a/lib/python/gladevcp/hal_dial.py
+++ b/lib/python/gladevcp/hal_dial.py
@@ -142,9 +142,11 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
if event.direction == gtk.gdk.SCROLL_UP:
self._count += 1
self._minute_offset +=1
+ self._delta_scaled += self.scale
if event.direction == gtk.gdk.SCROLL_DOWN:
self._count -= 1
self._minute_offset -=1
+ self._delta_scaled -= self.scale
self._last_offset = self._minute_offset
self.redraw_canvas()
self.emit("count_changed", self._count,self.scale,self._delta_scaled)
@@ -295,6 +297,7 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
alloc = self.get_allocation()
self.queue_draw_area(alloc.x, alloc.y, alloc.width, alloc.height)
self.window.process_updates(True)
+ self.queue_draw()
# Get propertys
def do_get_property(self, property):
Nicklas Karlsson