GTK: get mouse click coordinates in a window

In GTK, I can’t understand what answer needs to be configured, so that when I click on a user in the window I can get the X / Y coordinates of the click.

+3
source share
2 answers

You are looking for a button-press-eventsignal GtkWidget.

+3
source

The event parameter in the callback usually gets the x and y element, which are the coordinates of the mouse. If you need an example, look at the gtk tutorial, there is an example code of a small drawing program where you can see how to handle mouse events

http://www.gtk.org/tutorial1.2/gtk_tut-23.html

+3
source

Source: https://habr.com/ru/post/1759730/


All Articles