Does anyone know how to disable mouse scrolling in a GtkOptionMenu or GtkComboBox? It is annoying when you are scrolling through a window and the pointer passed over such a widget which grabs the focus and changes value!
I see that the offending code was added a while back, but there doesn't seem to be any mechanism in place to disable this functionality.
I am working in C, but help in any language would be much appreciated.
P.S. I should maybe mention that I'm using GTK 2.10, but need compatibility with GTK 2.4.
This works - I hope might help someone else that wants to do the same thing:
/* Create new closure (callback) to replace class default */   
GClosure * new_closure = 
  g_cclosure_new_object( G_CALLBACK(handler), /* my event handler */
                         G_OBJECT(gobject) /* use any static GObject to keep closure alive */
                       );
GType type = gtk_option_menu_get_type();
/* Get signal_id for "scroll_event" */
guint signal_id = g_signal_lookup("scroll_event", type);
/* Override default closure for scroll_event signal */
g_signal_override_class_closure(signal_id, type, new_closure);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With