Gtk4: How to completely remove a GtkScale from scroll events?

Hi!

In EasyEffects we have a list of applications that have some controls and information fields like this one


One we problem we are having right now is that the scroll of the list conflicts with the scroll in the GTkScale in the sense that once the mouse pointer is over the scale the list does not scroll anymore. Initially I tried to somehow force the scroll events to be ignored by the GtkScale Don't change volume with scrolling · Issue #1211 · wwmm/easyeffects · GitHub

auto* controller = gtk_event_controller_scroll_new(GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);

  g_signal_connect(
      controller, "scroll",
      G_CALLBACK(+[](GtkEventControllerScroll* controller, gdouble dx, gdouble dy, AppInfo* self) { return 1; }), self);

  gtk_widget_add_controller(GTK_WIDGET(self->volume), controller);

But all that this did was avoiding scroll events to change the scale value. The scale still “eats” scroll events and does not let them go to the list. Is there a way to avoid the scale being even considered for scroll events?

As I could not find a way to avoid the “scroll conflict” we are discussing new approaches New App info UI · Issue #1427 · wwmm/easyeffects · GitHub. But to be honest I would really like to find a way to keep the horizontal scale.

Best regards,
Wellington

No, currently the only thing you can do here is try in the handler of those “eaten” scroll events to emulate a real scroll event by changing the adjustment on the ScrolledWindow. To avoid creating multiple event controllers, you could put it on the ScrolledWindow itself and set it to GTK_PHASE_CAPTURE. Maybe this is worth reporting as an upstream bug? I’m not sure. This does seem like somewhat of a major frustration with Scale in any app, because it always harms the usability if it is ever placed inside a ScrolledWindow.

I see. If that is the only way I think it will be easier to use a GtkSpinButton instead of a GtkScale. I it not as elegant when it comes to volume control but at least the spinbutton does not need a large horizontal space to be comfortable to use.

I am also not sure it is something to be reported as a bug in the gtk4 page. But it is true that any widget with scroll capabilities may get in the way when added to a list.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.