[gtk/wip/matthiasc/focus3: 9/32] widget: Add a private setter for has-focus



commit 1e23937351a190cbfca829ddf5985522ecc8f93a
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Mar 6 22:26:27 2019 -0500

    widget: Add a private setter for has-focus

 gtk/gtkwidget.c        | 13 +++++++++++++
 gtk/gtkwidgetprivate.h |  2 ++
 2 files changed, 15 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 057ab32631..10986e0b15 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]