Use Gtk::GestureClick. Some examples:
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/blob/master/examples/book/menus/popup/examplewindow.cc
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/blob/master/examples/book/popover/examplewindow.cc

In most (perhaps all) situations where event signals have been used in gtkmm3, use one of the many subclasses of Gtk::EventController.
https://gnome.pages.gitlab.gnome.org/gtkmm/classGtk_1_1EventController.html

Den 2022-10-06 kl. 23:57, skrev Aaron Scheinberg via gtkmm-list:
Hello,

I hope this is the right place for this, sorry if not!

I'm trying to implement an example gtkmm 3.0 code in gtkmm 4.0 and ran into a problem. The goal is to get the cursor's coordinates and what type of click occurred when clicking on a button. In gtkmm 3.0, I could use|GdkEventButton|, as in this example from thedocs <https://developer-old.gnome.org/gtkmm-tutorial/unstable/gtkmm-tutorial.html#sec-xeventsignals>:

|bool on_button_press(GdkEventButton* event); Gtk::Button button("label"); button.signal_button_press_event().connect( sigc::ptr_fun(&on_button_press) ); |

But |GdkEventButton| seems to no longer exist or no longer be accessible in gtkmm 4.0.

There is a reference to GdkEvent API changes in the migration documentation <https://docs.gtk.org/gtk4/migrating-3to4.html>, but I still do not understand how to migrate that example code. Is anyone more familiar or has any sort of related example?

I've also posted this on stack overflow: https://stackoverflow.com/questions/73979631/gdkeventbutton-when-migrating-from-gtkmm-3-0-to-gtkmm-4-0

Thanks for your help,
Aaron

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to