diff --git a/gtk/gtkpointerfocus.c b/gtk/gtkpointerfocus.c index 7c522a0dd0..3a4026d3d5 100644 --- a/gtk/gtkpointerfocus.c +++ b/gtk/gtkpointerfocus.c @@ -78,6 +78,19 @@ gtk_pointer_focus_get_target (GtkPointerFocus *focus) return focus->target; } +void +gtk_pointer_focus_set_implicit_grab (GtkPointerFocus *focus, + GtkWidget *grab_widget) +{ + focus->grab_widget = grab_widget; +} + +GtkWidget * +gtk_pointer_focus_get_implicit_grab (GtkPointerFocus *focus) +{ + return focus->grab_widget; +} + void gtk_pointer_focus_set_coordinates (GtkPointerFocus *focus, gdouble x, @@ -87,6 +100,21 @@ gtk_pointer_focus_set_coordinates (GtkPointerFocus *focus, focus->y = y; } +GtkWidget * +gtk_pointer_focus_get_effective_target (GtkPointerFocus *focus) +{ + GtkWidget *target; + + target = focus->target; + + if (focus->grab_widget && + focus->grab_widget != target && + !gtk_widget_is_ancestor (target, focus->grab_widget)) + target = focus->grab_widget; + + return target; +} + void gtk_pointer_focus_repick_target (GtkPointerFocus *focus) { diff --git a/gtk/gtkpointerfocusprivate.h b/gtk/gtkpointerfocusprivate.h index 56735d8dcd..5d5be955e0 100644 --- a/gtk/gtkpointerfocusprivate.h +++ b/gtk/gtkpointerfocusprivate.h @@ -47,6 +47,12 @@ void gtk_pointer_focus_set_target (GtkPointerFocus *focus, GtkWidget *target); GtkWidget * gtk_pointer_focus_get_target (GtkPointerFocus *focus); +void gtk_pointer_focus_set_implicit_grab (GtkPointerFocus *focus, + GtkWidget *grab_widget); +GtkWidget * gtk_pointer_focus_get_implicit_grab (GtkPointerFocus *focus); + +GtkWidget * gtk_pointer_focus_get_effective_target (GtkPointerFocus *focus); + void gtk_pointer_focus_repick_target (GtkPointerFocus *focus); #endif /* _GTK_POINTER_FOCUS_PRIVATE_H_ */