Is there any simplier way to react to Control + Mouse Wheel event?


Evince use Control + Mouse Wheel shortcut as a method to change zoom level. Is there any existing GtkEventController suitable for this except GtkEventControllerLegacy?


You can use GtkEventControllerScroll and check the modifiers state using gtk_event_controller_get_current_event_state().

Thank you @ebassi . This feature is now ported by the way you suggested.

I’ve run into the same issue while porting nautilus to event controllers (still under GTK3, but as preparation for later port to GTK4).

However, GtkEventControllerScroll::scroll under GTK3 doesn’t have a boolean return value. Therefore, there is no way to conditionally propagate the event.

Would a backport of this to gtk-3-24 be acceptable?

Or, any known workaround while in GTK3?

Changing a signal’s signature is an API break, I’m afraid. All call sites for g_signal_emit() will have to be changed to pass a point to the return value; all virtual functions will have to be updated. All of these happen inside GTK, so it wouldn’t be a big deal. The real issue is that all callbacks currently returning void would fail to set the return value, which would now contain whatever value was last set on the stack before the emission started.

On top of that, there are no more GTK3 development cycles we can use to update the API.

1 Like

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