[gnome-builder/wip/gtk4-port: 274/343] libide/gui: work around weirdness with GtkPicture
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 274/343] libide/gui: work around weirdness with GtkPicture
- Date: Mon, 4 Apr 2022 20:02:17 +0000 (UTC)
commit 154f112c6b9301cbc164e53aa1df58ddebe573d4
Author: Christian Hergert <chergert redhat com>
Date: Thu Mar 31 21:45:42 2022 -0700
libide/gui: work around weirdness with GtkPicture
src/libide/gui/ide-style-variant-preview.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/src/libide/gui/ide-style-variant-preview.c b/src/libide/gui/ide-style-variant-preview.c
index ce9b80f6b..3efca63cb 100644
--- a/src/libide/gui/ide-style-variant-preview.c
+++ b/src/libide/gui/ide-style-variant-preview.c
@@ -117,6 +117,25 @@ ide_style_variant_preview_snapshot (GtkWidget *widget,
GTK_WIDGET_CLASS (ide_style_variant_preview_parent_class)->snapshot (widget, snapshot);
}
+static void
+ide_style_variant_preview_measure (GtkWidget *widget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline)
+{
+ GTK_WIDGET_CLASS (ide_style_variant_preview_parent_class)->measure (widget, orientation, for_size,
minimum, natural, minimum_baseline, natural_baseline);
+
+ /* Work around GtkPicture wierdness */
+ if (orientation == GTK_ORIENTATION_VERTICAL)
+ {
+ *natural = *minimum;
+ *natural_baseline = *minimum_baseline;
+ }
+}
+
static void
ide_style_variant_preview_dispose (GObject *object)
{
@@ -178,6 +197,7 @@ ide_style_variant_preview_class_init (IdeStyleVariantPreviewClass *klass)
object_class->set_property = ide_style_variant_preview_set_property;
widget_class->snapshot = ide_style_variant_preview_snapshot;
+ widget_class->measure = ide_style_variant_preview_measure;
properties [PROP_COLOR_SCHEME] =
g_param_spec_enum ("color-scheme",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]