[gtk/wip/matthiasc/popup5: 119/186] scale button: Allocate popovers



commit e781a5b9bbca2e39a2151c299ab676fa1a1bd059
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 4 17:14:06 2019 +0000

    scale button: Allocate popovers
    
    Call gtk_native_check_resize() from size_allocate,
    as is required now. This gets volume buttons closer
    to working again (dragging the slider still doesn't
    work).

 gtk/gtkscalebutton.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 7e76ea9fdd..1f6dc9b772 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -54,6 +54,7 @@
 #include "gtkscale.h"
 #include "gtktypebuiltins.h"
 #include "gtkwindowprivate.h"
+#include "gtknative.h"
 
 #include "a11y/gtkscalebuttonaccessible.h"
 
@@ -135,6 +136,10 @@ static void        gtk_scale_button_get_property   (GObject             *object,
                                                 guint                prop_id,
                                                 GValue              *value,
                                                 GParamSpec          *pspec);
+static void     gtk_scale_button_size_allocate  (GtkWidget           *widget,
+                                                 int                  width,
+                                                 int                  height,
+                                                 int                  baseline);
 static void gtk_scale_button_set_orientation_private (GtkScaleButton *button,
                                                       GtkOrientation  orientation);
 static void     gtk_scale_button_clicked        (GtkButton           *button);
@@ -174,6 +179,8 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass)
   gobject_class->set_property = gtk_scale_button_set_property;
   gobject_class->get_property = gtk_scale_button_get_property;
 
+  widget_class->size_allocate = gtk_scale_button_size_allocate;
+
   button_class->clicked = gtk_scale_button_clicked;
 
   /**
@@ -989,3 +996,17 @@ cb_popup_mapped (GtkWidget *popup,
 
   gtk_widget_grab_focus (priv->scale);
 }
+
+static void
+gtk_scale_button_size_allocate (GtkWidget *widget,
+                                int        width,
+                                int        height,
+                                int        baseline)
+{
+  GtkScaleButton *button = GTK_SCALE_BUTTON (widget);
+  GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
+
+  GTK_WIDGET_CLASS (gtk_scale_button_parent_class)->size_allocate (widget, width, height, baseline);
+
+  gtk_native_check_resize (GTK_NATIVE (priv->dock));
+}


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