[gtk+/wip/carlosg/event-delivery: 23/105] gtk: Add private _gtk_toplevel_pick() method
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-delivery: 23/105] gtk: Add private _gtk_toplevel_pick() method
- Date: Sun, 14 May 2017 23:39:23 +0000 (UTC)
commit ba3bbc7320388fc256b6a4afc155748974738986
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Mar 31 16:49:22 2017 +0200
gtk: Add private _gtk_toplevel_pick() method
This function returns both the widget at the given toplevel coordinates,
and the translated x/y in widget relative coordinates.
gtk/gtkmain.c | 23 +++++++++++++++++++++++
gtk/gtkprivate.h | 5 +++++
2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index b145f00..70b1439 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -2304,3 +2304,26 @@ _gtk_propagate_captured_event (GtkWidget *widget,
{
return propagate_event (widget, event, TRUE, topmost);
}
+
+GtkWidget *
+_gtk_toplevel_pick (GtkWindow *toplevel,
+ gdouble x,
+ gdouble y,
+ gdouble *x_out,
+ gdouble *y_out)
+{
+ GtkWidget *target = NULL, *widget = GTK_WIDGET (toplevel);
+
+ while (widget)
+ {
+ target = widget;
+ widget = GTK_WIDGET_GET_CLASS (target)->pick (widget, x, y, &x, &y);
+ }
+
+ if (x_out)
+ *x_out = x;
+ if (y_out)
+ *y_out = y;
+
+ return target;
+}
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index de26e9f..21de486 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -91,6 +91,11 @@ gboolean _gtk_propagate_captured_event (GtkWidget *widget,
GdkEvent *event,
GtkWidget *topmost);
+GtkWidget * _gtk_toplevel_pick (GtkWindow *toplevel,
+ gdouble x,
+ gdouble y,
+ gdouble *x_out,
+ gdouble *y_out);
gdouble _gtk_get_slowdown (void);
void _gtk_set_slowdown (gdouble slowdown_factor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]