[gtk+/wip/matthiasc/kill-event-signals: 84/126] Add x/y to GtkEventControllerMotion::enter
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/kill-event-signals: 84/126] Add x/y to GtkEventControllerMotion::enter
- Date: Mon, 15 Jan 2018 13:06:52 +0000 (UTC)
commit 0888f743da06296077c60ee211bfd0a769bde5f1
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jan 1 20:07:24 2018 -0500
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.
gtk/gtkeventcontrollermotion.c | 17 +++++++++++++----
tests/testoverlay.c | 5 ++++-
2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkeventcontrollermotion.c b/gtk/gtkeventcontrollermotion.c
index 6fe5f23..75c293e 100644
--- a/gtk/gtkeventcontrollermotion.c
+++ b/gtk/gtkeventcontrollermotion.c
@@ -67,9 +67,15 @@ gtk_event_controller_motion_handle_event (GtkEventController *controller,
type = gdk_event_get_event_type (event);
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)
- g_signal_emit (controller, signals[LEAVE], 0);
+ {
+ g_signal_emit (controller, signals[LEAVE], 0);
+ }
else if (type == GDK_MOTION_NOTIFY)
{
double x, y;
@@ -92,6 +98,8 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
/**
* GtkEventControllerMotion::enter:
* @controller: The object that received the signal
+ * @x: the x coordinate
+ * @y: the y coordinate
*
* Signals that the pointer has entered the widget.
*/
@@ -101,7 +109,8 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
G_SIGNAL_RUN_FIRST,
0, NULL, NULL,
NULL,
- G_TYPE_NONE, 0);
+ G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
+
/**
* GtkEventControllerMotion::leave:
* @controller: The object that received the signal
@@ -113,7 +122,7 @@ gtk_event_controller_motion_class_init (GtkEventControllerMotionClass *klass)
GTK_TYPE_EVENT_CONTROLLER_MOTION,
G_SIGNAL_RUN_FIRST,
0, NULL, NULL,
- NULL,
+ NULL,
G_TYPE_NONE, 0);
/**
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index 9eea960..381ad91 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -315,7 +315,10 @@ test_builder (void)
}
static void
-on_enter (GtkEventController *controller, GtkWidget *overlay)
+on_enter (GtkEventController *controller,
+ double x,
+ double y,
+ GtkWidget *overlay)
{
GtkWidget *child = gtk_event_controller_get_widget (controller);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]