csete / gpredict

Gpredict satellite tracking application
http://gpredict.oz9aec.net/
GNU General Public License v2.0
878 stars 250 forks source link

mouse scroll wheel not working #362

Open n4ogw opened 4 months ago

n4ogw commented 4 months ago

The mouse scroll wheel isn't working to adjust the frequency or rotator position. To receive mouse wheel events one needs to enable the #GDK_SCROLL_MASK mask.


diff --git a/src/gtk-freq-knob.c b/src/gtk-freq-knob.c
index 9225acc..cab21de 100644
--- a/src/gtk-freq-knob.c
+++ b/src/gtk-freq-knob.c
@@ -358,6 +358,7 @@ GtkWidget      *gtk_freq_knob_new(gdouble val, gboolean buttons)
             g_signal_connect(knob->evtbox[i],
                              "button_press_event", (GCallback) on_button_press,
                              widget);
+           gtk_widget_add_events(GTK_WIDGET(knob->evtbox[i]), GDK_SCROLL_MASK);
             g_signal_connect(knob->evtbox[i], "scroll_event",
                              (GCallback) on_button_scroll, widget);

diff --git a/src/gtk-rot-knob.c b/src/gtk-rot-knob.c
index a7d0771..25f52cd 100644
--- a/src/gtk-rot-knob.c
+++ b/src/gtk-rot-knob.c
@@ -528,6 +528,7 @@ GtkWidget      *gtk_rot_knob_new(gdouble min, gdouble max, gdouble val)

         g_signal_connect(knob->evtbox[i], "button_press_event",
                          (GCallback) on_button_press, widget);
+       gtk_widget_add_events(GTK_WIDGET(knob->evtbox[i]), GDK_SCROLL_MASK);
         g_signal_connect(knob->evtbox[i], "scroll_event",
                          (GCallback) on_button_scroll, widget);
csete commented 1 month ago

I will include this enhancement, thanks!