[gtk/wip/readonly-events: 19/22] Add coordinates to handle_crossing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/readonly-events: 19/22] Add coordinates to handle_crossing
- Date: Fri, 14 Feb 2020 19:04:49 +0000 (UTC)
commit 5a1eead9e6cc4999e4147f438f97791a0baa5fbf
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 14 08:20:35 2020 -0500
Add coordinates to handle_crossing
This will be needed for pointer crossing events.
gtk/gtkeventcontroller.c | 12 +++++++++---
gtk/gtkeventcontroller.h | 7 +++++--
gtk/gtkeventcontrollerkey.c | 4 +++-
gtk/gtkeventcontrollerprivate.h | 4 +++-
gtk/gtkwidget.c | 6 ++++--
gtk/gtkwidgetprivate.h | 4 +++-
gtk/gtkwindow.c | 4 ++--
7 files changed, 29 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkeventcontroller.c b/gtk/gtkeventcontroller.c
index 46828b6929..9c77d49444 100644
--- a/gtk/gtkeventcontroller.c
+++ b/gtk/gtkeventcontroller.c
@@ -129,7 +129,9 @@ gtk_event_controller_handle_event_default (GtkEventController *self,
static void
gtk_event_controller_handle_crossing_default (GtkEventController *self,
- const GtkCrossingData *crossing)
+ const GtkCrossingData *crossing,
+ double x,
+ double y)
{
}
@@ -318,13 +320,17 @@ gtk_event_controller_handle_event (GtkEventController *controller,
* gtk_event_controller_handle_crossing:
* @controller: a #GtkEventController
* @crossing: a #GtkCrossingData
+ * @x: event position in widget coordinates
+ * @y: event position in widget coordinates
*
* Feeds a crossing event into @controller, so it can be interpreted
* and the controller actions triggered.
**/
void
gtk_event_controller_handle_crossing (GtkEventController *controller,
- const GtkCrossingData *crossing)
+ const GtkCrossingData *crossing,
+ double x,
+ double y)
{
GtkEventControllerClass *controller_class;
@@ -334,7 +340,7 @@ gtk_event_controller_handle_crossing (GtkEventController *controller,
controller_class = GTK_EVENT_CONTROLLER_GET_CLASS (controller);
g_object_ref (controller);
- controller_class->handle_crossing (controller, crossing);
+ controller_class->handle_crossing (controller, crossing, x, y);
g_object_unref (controller);
}
diff --git a/gtk/gtkeventcontroller.h b/gtk/gtkeventcontroller.h
index 00bd00ff71..bec6a09ab4 100644
--- a/gtk/gtkeventcontroller.h
+++ b/gtk/gtkeventcontroller.h
@@ -43,7 +43,8 @@ G_BEGIN_DECLS
typedef struct _GtkCrossingData GtkCrossingData;
typedef enum {
- GTK_CROSSING_FOCUS
+ GTK_CROSSING_FOCUS,
+ GTK_CROSSING_POINTER
} GtkCrossingType;
typedef enum {
@@ -90,7 +91,9 @@ gboolean gtk_event_controller_handle_event (GtkEventController *controller
double y);
GDK_AVAILABLE_IN_ALL
void gtk_event_controller_handle_crossing (GtkEventController *controller,
- const GtkCrossingData *crossing);
+ const GtkCrossingData *crossing,
+ double x,
+ double y);
GDK_AVAILABLE_IN_ALL
void gtk_event_controller_reset (GtkEventController *controller);
diff --git a/gtk/gtkeventcontrollerkey.c b/gtk/gtkeventcontrollerkey.c
index cdb487cc10..3676fc65e0 100644
--- a/gtk/gtkeventcontrollerkey.c
+++ b/gtk/gtkeventcontrollerkey.c
@@ -193,7 +193,9 @@ update_focus (GtkEventController *controller,
static void
gtk_event_controller_key_handle_crossing (GtkEventController *controller,
- const GtkCrossingData *crossing)
+ const GtkCrossingData *crossing,
+ double x,
+ double y)
{
if (crossing->type != GTK_CROSSING_FOCUS)
return;
diff --git a/gtk/gtkeventcontrollerprivate.h b/gtk/gtkeventcontrollerprivate.h
index 6a4dc7d69c..aed93f311a 100644
--- a/gtk/gtkeventcontrollerprivate.h
+++ b/gtk/gtkeventcontrollerprivate.h
@@ -41,7 +41,9 @@ struct _GtkEventControllerClass
void (* reset) (GtkEventController *controller);
void (* handle_crossing) (GtkEventController *controller,
- const GtkCrossingData *crossing);
+ const GtkCrossingData *crossing,
+ double x,
+ double y);
/*<private>*/
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c2077c3b2a..d04bce2661 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4822,7 +4822,9 @@ gtk_widget_run_controllers (GtkWidget *widget,
void
gtk_widget_handle_crossing (GtkWidget *widget,
- const GtkCrossingData *crossing)
+ const GtkCrossingData *crossing,
+ double x,
+ double y)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GList *l;
@@ -4833,7 +4835,7 @@ gtk_widget_handle_crossing (GtkWidget *widget,
{
GtkEventController *controller = l->data;
- gtk_event_controller_handle_crossing (controller, crossing);
+ gtk_event_controller_handle_crossing (controller, crossing, x, y);
}
g_object_unref (widget);
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 9cca016309..bc24a9c728 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -348,7 +348,9 @@ gboolean gtk_widget_run_controllers (GtkWidget
double y,
GtkPropagationPhase phase);
void gtk_widget_handle_crossing (GtkWidget *widget,
- const GtkCrossingData *crossing);
+ const GtkCrossingData *crossing,
+ double x,
+ double y);
guint gtk_widget_add_surface_transform_changed_callback (GtkWidget
*widget,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 65d5f0d250..551fb06e5d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6444,7 +6444,7 @@ synthesize_focus_change_events (GtkWindow *window,
widget = old_focus;
while (widget)
{
- gtk_widget_handle_crossing (widget, &crossing);
+ gtk_widget_handle_crossing (widget, &crossing, 0, 0);
gtk_widget_unset_state_flags (widget, flags);
gtk_widget_set_focus_child (widget, NULL);
widget = gtk_widget_get_parent (widget);
@@ -6467,7 +6467,7 @@ synthesize_focus_change_events (GtkWindow *window,
focus_child = l->next->data;
else
focus_child = NULL;
- gtk_widget_handle_crossing (widget, &crossing);
+ gtk_widget_handle_crossing (widget, &crossing, 0, 0);
gtk_widget_set_state_flags (widget, flags, FALSE);
gtk_widget_set_focus_child (widget, focus_child);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]