Add x/y to GtkEventControllerMotion::enter

We have this information available in enter events,
and having it in the controller signal as well makes
porting easier.

Update existing users.
This commit is contained in:
Matthias Clasen 2018-01-01 20:07:24 -05:00 committed by Carlos Garnacho
parent 8b2c3a8c1a
commit 1f9de707f7

View File

@ -67,9 +67,15 @@ gtk_event_controller_motion_handle_event (GtkEventController *controller,
type = gdk_event_get_event_type (event); type = gdk_event_get_event_type (event);
if (type == GDK_ENTER_NOTIFY) if (type == GDK_ENTER_NOTIFY)
g_signal_emit (controller, signals[ENTER], 0); {
double x, y;
gdk_event_get_coords (event, &x, &y);
g_signal_emit (controller, signals[ENTER], 0, x, y);
}
else if (type == GDK_LEAVE_NOTIFY) else if (type == GDK_LEAVE_NOTIFY)
{
g_signal_emit (controller, signals[LEAVE], 0); g_signal_emit (controller, signals[LEAVE], 0);
}
else if (type == GDK_MOTION_NOTIFY) else if (type == GDK_MOTION_NOTIFY)
{ {
double x, y; double x, y;
@ -92,6 +98,8 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
/** /**
* GtkEventControllerMotion::enter: * GtkEventControllerMotion::enter:
* @controller: The object that received the signal * @controller: The object that received the signal
* @x: the x coordinate
* @y: the y coordinate
* *
* Signals that the pointer has entered the widget. * Signals that the pointer has entered the widget.
*/ */
@ -101,7 +109,8 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
0, NULL, NULL, 0, NULL, NULL,
NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
/** /**
* GtkEventControllerMotion::leave: * GtkEventControllerMotion::leave:
* @controller: The object that received the signal * @controller: The object that received the signal