I'm modifying an existing GTK3 application, and want to handle the "back" and "forward" mouse buttons (with integer values of 8 and 9, respectively) globally.
I tried attaching a signal handler to the window:
g_signal_connect(window, "button-press-event", G_CALLBACK(onButtonPress), NULL);
This works assuming the widget underneath the cursor also doesn't handle button presses (e.g. a click / button handler for a normal button), in which case the event does not propagate up to the window as it is handled by the widget.
Key events are sent to accelerators first before the underlying widget, which is the behavior I want, but I'm using mouse buttons which don't seem to be supported as accelerators or mnemonics.
How can I setup a window-level handler for mouse buttons in this way?
Here's a reference for GTK event handling and propagation: https://developer.gnome.org/gtk3/stable/chap-input-handling.html