summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-03-06 22:26:27 -0500
committerMatthias Clasen <mclasen@redhat.com>2019-03-16 21:24:44 -0400
commit15300f839e8078b7c18dd6acabf4da7e53553651 (patch)
tree5268db6b3f13a5646470d4ac141f5b856f2b6f23
parent94b0e99be5d860b13cc23fd7f7dd64ce7c3cb496 (diff)
downloadgtk+-15300f839e8078b7c18dd6acabf4da7e53553651.tar.gz
widget: Add a private setter for has-focus
-rw-r--r--gtk/gtkwidget.c13
-rw-r--r--gtk/gtkwidgetprivate.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2d76855c42..c5eb6d63cb 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11623,6 +11623,19 @@ gtk_widget_send_focus_change (GtkWidget *widget,
return TRUE;
}
+void
+gtk_widget_set_has_focus (GtkWidget *widget,
+ gboolean has_focus)
+{
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+
+ if (priv->has_focus == has_focus)
+ return;
+
+ priv->has_focus = has_focus;
+ g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_FOCUS]);
+}
+
/**
* gtk_widget_in_destruction:
* @widget: a #GtkWidget
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 314d793090..ca30e9b0f3 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -318,6 +318,8 @@ void gtk_widget_focus_sort (GtkWidget *wi
GPtrArray *focus_order);
gboolean gtk_widget_focus_move (GtkWidget *widget,
GtkDirectionType direction);
+void gtk_widget_set_has_focus (GtkWidget *widget,
+ gboolean has_focus);
void gtk_widget_get_surface_allocation (GtkWidget *widget,
GtkAllocation *allocation);