[gtk/wip/readonly-events: 21/25] Add coordinates to handle_crossing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/readonly-events: 21/25] Add coordinates to handle_crossing
- Date: Fri, 14 Feb 2020 22:02:44 +0000 (UTC)
commit d9c43f67f226233046d2a966d676f683a1a0168c
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 46828b69298..9c77d49444a 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 00bd00ff710..bec6a09ab40 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 cdb487cc109..3676fc65e0f 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 6a4dc7d69c0..aed93f311a4 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 5e997e52d94..b5925a8c968 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 9cca0163096..bc24a9c7282 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 44e4f915d4b..c777eef8d17 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6371,7 +6371,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);
@@ -6394,7 +6394,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]