lxpanel-0.10.1-volume-plugin-fix-mouse-scrolling.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. diff -ru a/plugins/volumealsa/volumealsa.c b/plugins/volumealsa/volumealsa.c
  2. --- a/plugins/volumealsa/volumealsa.c 2021-01-29 23:33:27.000000000 +0100
  3. +++ b/plugins/volumealsa/volumealsa.c 2021-03-21 13:49:00.124807793 +0100
  4. @@ -794,10 +794,25 @@
  5. gdouble val = gtk_range_get_value(GTK_RANGE(vol->volume_scale));
  6. /* Dispatch on scroll direction to update the value. */
  7. - if ((evt->direction == GDK_SCROLL_UP) || (evt->direction == GDK_SCROLL_LEFT))
  8. + switch (evt->direction)
  9. + {
  10. + case GDK_SCROLL_UP: ;
  11. + case GDK_SCROLL_LEFT: ;
  12. val += 2;
  13. - else
  14. + break;
  15. + case GDK_SCROLL_DOWN: ;
  16. + case GDK_SCROLL_RIGHT: ;
  17. val -= 2;
  18. + break;
  19. + case GDK_SCROLL_SMOOTH: ;
  20. + gdouble delta_x;
  21. + gdouble delta_y;
  22. + gdk_event_get_scroll_deltas(evt, &delta_x, &delta_y);
  23. + if (delta_y > 0)
  24. + val -= 2;
  25. + else
  26. + val += 2;
  27. + }
  28. /* Reset the state of the vertical scale. This provokes a "value_changed" event. */
  29. gtk_range_set_value(GTK_RANGE(vol->volume_scale), CLAMP((int)val, 0, 100));