[gtk+/wip/matthiasc/gsk-renderer: 6/6] button: Restore focus



commit 403630c8c15385e5857fdeac16bf8fcee1120489
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 6 10:34:18 2016 -0400

    button: Restore focus
    
    The custom gadget draw function has the side effect of informing
    the gadget machinery wether to draw focus or not. Bring the
    draw function back, just for its boolean return value. We may
    want to find a better solution for this.

 gtk/gtkbutton.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index e7e89de..25b8a70 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -210,6 +210,13 @@ static void     gtk_button_allocate (GtkCssGadget        *gadget,
                                      int                  baseline,
                                      GtkAllocation       *out_clip,
                                      gpointer             data);
+static gboolean gtk_button_render   (GtkCssGadget        *gadget,
+                                     cairo_t             *cr,
+                                     int                  x,
+                                     int                  y,
+                                     int                  width,
+                                     int                  height,
+                                     gpointer             data);
 
 static GParamSpec *props[LAST_PROP] = { NULL, };
 static guint button_signals[LAST_SIGNAL] = { 0 };
@@ -742,7 +749,7 @@ gtk_button_init (GtkButton *button)
                                                      GTK_WIDGET (button),
                                                      gtk_button_measure,
                                                      gtk_button_allocate,
-                                                     NULL,
+                                                     gtk_button_render,
                                                      NULL,
                                                      NULL);
 
@@ -1793,6 +1800,22 @@ gtk_button_allocate (GtkCssGadget        *gadget,
   gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
 }
 
+static gboolean
+gtk_button_render (GtkCssGadget *gadget,
+                   cairo_t      *cr,
+                   int           x,
+                   int           y,
+                   int           width,
+                   int           height,
+                   gpointer      data)
+{
+  GtkWidget *widget;
+
+  widget = gtk_css_gadget_get_owner (gadget);
+
+  return gtk_widget_has_visible_focus (widget);
+}
+
 static GskRenderNode *
 gtk_button_get_render_node (GtkWidget   *widget,
                             GskRenderer *renderer)


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