mirror of
https://github.com/gentoo-mirror/guru.git
synced 2025-04-10 20:18:41 -04:00
gui-libs/text-engine: Backport upstream -Wincompatible-pointer-types fix
Closes: https://bugs.gentoo.org/921918 Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
This commit is contained in:
parent
37daa1c3f8
commit
26e9247462
@ -0,0 +1,183 @@
|
||||
From 4190331e437081017296033b1202731302771726 Mon Sep 17 00:00:00 2001
|
||||
From: oscfdezdz <42654671+oscfdezdz@users.noreply.github.com>
|
||||
Date: Fri, 24 May 2024 20:12:19 +0200
|
||||
Subject: [PATCH 1/2] display: Fix incompatible pointer types
|
||||
|
||||
---
|
||||
src/ui/display.c | 24 ++++++++++++------------
|
||||
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/ui/display.c b/src/ui/display.c
|
||||
index cea11b9..a9c65f9 100644
|
||||
--- a/src/ui/display.c
|
||||
+++ b/src/ui/display.c
|
||||
@@ -29,7 +29,7 @@ struct _TextDisplay
|
||||
|
||||
TextFrame *frame;
|
||||
TextLayout *layout;
|
||||
- TextLayoutBox *layout_tree;
|
||||
+ TextNode *layout_tree;
|
||||
};
|
||||
|
||||
G_DEFINE_FINAL_TYPE (TextDisplay, text_display, GTK_TYPE_WIDGET)
|
||||
@@ -120,7 +120,7 @@ layout_snapshot_recursive (GtkWidget *widget,
|
||||
g_assert (TEXT_IS_LAYOUT_BOX (node));
|
||||
|
||||
int delta_height;
|
||||
- layout_snapshot_recursive (widget, node, snapshot, fg_color, &delta_height);
|
||||
+ layout_snapshot_recursive (widget, TEXT_LAYOUT_BOX (node), snapshot, fg_color, &delta_height);
|
||||
offset += delta_height;
|
||||
}
|
||||
|
||||
@@ -158,17 +158,17 @@ text_display_snapshot (GtkWidget *widget,
|
||||
|
||||
// TODO: Don't recreate this each time - do in size allocate instead?
|
||||
g_clear_object (&self->layout_tree);
|
||||
- self->layout_tree = text_layout_build_layout_tree (self->layout,
|
||||
- gtk_widget_get_pango_context (GTK_WIDGET (self)),
|
||||
- self->frame,
|
||||
- gtk_widget_get_width (GTK_WIDGET (self)));
|
||||
+ self->layout_tree = TEXT_NODE (text_layout_build_layout_tree (self->layout,
|
||||
+ gtk_widget_get_pango_context (GTK_WIDGET (self)),
|
||||
+ self->frame,
|
||||
+ gtk_widget_get_width (GTK_WIDGET (self))));
|
||||
|
||||
GdkRGBA fg_color;
|
||||
gtk_style_context_get_color (gtk_widget_get_style_context (widget), &fg_color);
|
||||
|
||||
// Display the layout tree
|
||||
int delta_height;
|
||||
- layout_snapshot_recursive (widget, self->layout_tree, snapshot, &fg_color, &delta_height);
|
||||
+ layout_snapshot_recursive (widget, TEXT_LAYOUT_BOX (self->layout_tree), snapshot, &fg_color, &delta_height);
|
||||
}
|
||||
|
||||
static GtkSizeRequestMode
|
||||
@@ -192,12 +192,12 @@ text_display_measure (GtkWidget *widget,
|
||||
PangoContext *context = gtk_widget_get_pango_context (widget);
|
||||
|
||||
g_clear_object (&self->layout_tree);
|
||||
- self->layout_tree = text_layout_build_layout_tree (self->layout,
|
||||
- context,
|
||||
- self->frame,
|
||||
- for_size);
|
||||
+ self->layout_tree = TEXT_NODE (text_layout_build_layout_tree (self->layout,
|
||||
+ context,
|
||||
+ self->frame,
|
||||
+ for_size));
|
||||
|
||||
- *minimum = *natural = text_layout_box_get_bbox (self->layout_tree)->height;
|
||||
+ *minimum = *natural = text_layout_box_get_bbox (TEXT_LAYOUT_BOX (self->layout_tree))->height;
|
||||
|
||||
g_debug ("Height: %d\n", *minimum);
|
||||
}
|
||||
--
|
||||
2.44.2
|
||||
|
||||
|
||||
From 3defd388148f0ac72a7af995adc632efdf2ba40c Mon Sep 17 00:00:00 2001
|
||||
From: Yuan Liao <liaoyuan@gmail.com>
|
||||
Date: Sun, 7 Jul 2024 09:10:51 -0400
|
||||
Subject: [PATCH 2/2] layout: Clean g_debug statements to fix
|
||||
-Wincompatible-pointer-types
|
||||
|
||||
These statements have already been removed in upstream commits
|
||||
221a5f9480b6ba861e1e53cfbc81f4bdbb821406 and
|
||||
be5def2b352227c54bf03e68c01596ffa66fd6f8 after v0.1.1 release. These
|
||||
statements should be for logging purposes only, and their removal should
|
||||
not affect the package's functionality.
|
||||
---
|
||||
src/layout/layout-box.c | 12 ------------
|
||||
src/layout/layout.c | 4 ----
|
||||
2 files changed, 16 deletions(-)
|
||||
|
||||
diff --git a/src/layout/layout-box.c b/src/layout/layout-box.c
|
||||
index 9c635c9..b93df38 100644
|
||||
--- a/src/layout/layout-box.c
|
||||
+++ b/src/layout/layout-box.c
|
||||
@@ -111,11 +111,6 @@ text_layout_box_layout (TextLayoutBox *self,
|
||||
|
||||
int height = 0;
|
||||
|
||||
- g_debug ("Starting for %s\n", g_type_name_from_instance (self));
|
||||
-
|
||||
- g_debug ("Has item: %d\n", priv->item != NULL);
|
||||
- g_debug ("Has paragraph: %d\n", TEXT_IS_PARAGRAPH (priv->item));
|
||||
-
|
||||
if (priv->item && TEXT_IS_PARAGRAPH (priv->item))
|
||||
{
|
||||
GString *str = g_string_new ("");
|
||||
@@ -126,11 +121,9 @@ text_layout_box_layout (TextLayoutBox *self,
|
||||
const gchar *run_text;
|
||||
g_object_get (run, "text", &run_text, NULL);
|
||||
g_string_append (str, run_text);
|
||||
- g_debug (" - Counting run\n");
|
||||
}
|
||||
|
||||
gchar *text = g_string_free (str, FALSE);
|
||||
- g_debug (" - String %s\n", text);
|
||||
|
||||
if (!priv->layout)
|
||||
priv->layout = pango_layout_new (context);
|
||||
@@ -139,7 +132,6 @@ text_layout_box_layout (TextLayoutBox *self,
|
||||
pango_layout_set_wrap (priv->layout, PANGO_WRAP_WORD_CHAR);
|
||||
pango_layout_set_width (priv->layout, PANGO_SCALE * width);
|
||||
pango_layout_get_pixel_size (priv->layout, NULL, &height);
|
||||
- g_debug (" - Height %d\n", height);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
@@ -153,14 +145,11 @@ text_layout_box_layout (TextLayoutBox *self,
|
||||
{
|
||||
TextLayoutBox *child_box = TEXT_LAYOUT_BOX (node);
|
||||
|
||||
- g_debug (" - Found child\n");
|
||||
-
|
||||
// We can assume bbox already exists by now, as the layout() method
|
||||
// has been called already in the layout manager.
|
||||
|
||||
TextLayoutBoxPrivate *priv = text_layout_box_get_instance_private (child_box);
|
||||
height += priv->bbox.height;
|
||||
- g_debug (" - Child height %d\n", height);
|
||||
}
|
||||
|
||||
priv->bbox.x = 0;
|
||||
@@ -175,7 +164,6 @@ text_layout_box_set_item (TextLayoutBox *self,
|
||||
{
|
||||
TextLayoutBoxPrivate *priv = text_layout_box_get_instance_private (self);
|
||||
priv->item = item;
|
||||
- g_debug ("Set item to non null: %d\n", priv->item != NULL);
|
||||
}
|
||||
|
||||
TextItem *
|
||||
diff --git a/src/layout/layout.c b/src/layout/layout.c
|
||||
index b730455..04cf458 100644
|
||||
--- a/src/layout/layout.c
|
||||
+++ b/src/layout/layout.c
|
||||
@@ -96,8 +96,6 @@ do_layout_recursive (TextLayout *self,
|
||||
{
|
||||
g_assert (TEXT_IS_ITEM (node));
|
||||
|
||||
- g_debug ("Counting child %s\n", g_type_name_from_instance (node));
|
||||
-
|
||||
// Let's treat paragraphs opaquely for now. In the future, we need
|
||||
// to manually consider each text run in order for inline equations
|
||||
// and images.
|
||||
@@ -107,7 +105,6 @@ do_layout_recursive (TextLayout *self,
|
||||
text_layout_box_set_item (box, TEXT_ITEM (node));
|
||||
|
||||
text_node_append_child (TEXT_NODE (parent), TEXT_NODE (box));
|
||||
- g_debug ("Added child %s\n", g_type_name_from_instance (node));
|
||||
|
||||
// TODO: This function should be properly recursive in the future,
|
||||
// so avoid calling it here. Below should be the only time it is
|
||||
@@ -117,7 +114,6 @@ do_layout_recursive (TextLayout *self,
|
||||
}
|
||||
|
||||
text_layout_box_layout (parent, context, width);
|
||||
- g_debug ("Layout for %s\n", g_type_name_from_instance (parent));
|
||||
}
|
||||
|
||||
TextLayoutBox *
|
||||
--
|
||||
2.44.2
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2022 Gentoo Authors
|
||||
# Copyright 2022-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
@ -42,6 +42,7 @@ RDEPEND="
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${P}-fix-package-version.patch"
|
||||
"${FILESDIR}/${P}-fix-Wreturn-type.patch"
|
||||
"${FILESDIR}/${P}-fix-Wincompatible-pointer-types.patch"
|
||||
)
|
||||
|
||||
src_prepare() {
|
Loading…
x
Reference in New Issue
Block a user