[gtk/wip/matthiasc/focus2: 45/50] drop gtk_widget_send_focus_change
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/focus2: 45/50] drop gtk_widget_send_focus_change
- Date: Thu, 7 Mar 2019 11:44:09 +0000 (UTC)
commit 39e58b2e756225afb5975241ed528b618c5d1ca8
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Mar 6 22:51:19 2019 -0500
drop gtk_widget_send_focus_change
Replace this with gtk_widget_set_has_focus + gtk_widget_event.
gtk/gtktreeview.c | 3 ++-
gtk/gtkwidget.c | 50 --------------------------------------------------
gtk/gtkwidgetprivate.h | 3 ---
gtk/gtkwindow.c | 5 +++--
4 files changed, 5 insertions(+), 56 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 4b1bafbc50..ca56a51a24 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -9929,7 +9929,8 @@ send_focus_change (GtkWidget *widget,
fevent->focus_change.in = in;
gdk_event_set_device (fevent, device);
- gtk_widget_send_focus_change (widget, fevent);
+ gtk_widget_set_has_focus (widget, in);
+ gtk_widget_event (widget, fevent);
g_object_unref (fevent);
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 643a8d21cc..db21c83af0 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11550,56 +11550,6 @@ gtk_widget_get_overflow (GtkWidget *widget)
return priv->overflow;
}
-/**
- * gtk_widget_send_focus_change:
- * @widget: a #GtkWidget
- * @event: a #GdkEvent of type GDK_FOCUS_CHANGE
- *
- * Sends the focus change @event to @widget
- *
- * This function is not meant to be used by applications. The only time it
- * should be used is when it is necessary for a #GtkWidget to assign focus
- * to a widget that is semantically owned by the first widget even though
- * it’s not a direct child - for instance, a search entry in a floating
- * window similar to the quick search in #GtkTreeView.
- *
- * An example of its usage is:
- *
- * |[<!-- language="C" -->
- * GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
- *
- * fevent->focus_change.type = GDK_FOCUS_CHANGE;
- * fevent->focus_change.in = TRUE;
- * fevent->focus_change.surface = _gtk_widget_get_surface (widget);
- * if (fevent->focus_change.surface != NULL)
- * g_object_ref (fevent->focus_change.surface);
- *
- * gtk_widget_send_focus_change (widget, fevent);
- *
- * g_object_unref (event);
- * ]|
- *
- * Returns: the return value from the event signal emission: %TRUE
- * if the event was handled, and %FALSE otherwise
- */
-gboolean
-gtk_widget_send_focus_change (GtkWidget *widget,
- GdkEvent *event)
-{
- GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- g_return_val_if_fail (event != NULL && event->any.type == GDK_FOCUS_CHANGE, FALSE);
-
- priv->has_focus = event->focus_change.in;
-
- gtk_propagate_event (widget, event);
-
- g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_FOCUS]);
-
- return TRUE;
-}
-
void
gtk_widget_set_has_focus (GtkWidget *widget,
gboolean has_focus)
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 4a6433d815..f6c939e005 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -339,9 +339,6 @@ gboolean gtk_widget_run_controllers (GtkWidget
const GdkEvent *event,
GtkPropagationPhase phase);
-gboolean gtk_widget_send_focus_change (GtkWidget *widget,
- GdkEvent *event);
-
gboolean gtk_widget_can_take_focus (GtkWidget *widget);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6b6b462e97..7f4da96251 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6901,7 +6901,7 @@ gtk_window_real_activate_focus (GtkWindow *window)
static void
do_focus_change (GtkWidget *widget,
- gboolean in)
+ gboolean in)
{
GdkSeat *seat;
GList *devices, *d;
@@ -6930,7 +6930,8 @@ do_focus_change (GtkWidget *widget,
fevent->focus_change.in = in;
gdk_event_set_device (fevent, dev);
- gtk_widget_send_focus_change (widget, fevent);
+ gtk_widget_set_has_focus (widget, in);
+ gtk_widget_event (widget, fevent);
g_object_unref (fevent);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]