On Tue, 04 May 2021 at 15:47:03 +0200, Cyril Brulebois wrote: > would it seem reasonable to add a hack in whatever would make sense > (pango1.0, harfbuzz, and/or gtk+2.0), but only in the udeb build, so > that we dodge the issue for Bullseye without impacting installed > systems/deb packages? If git bisecting yields a prospective (set of) > patch(es) of course…
Adding a udeb-specific hack in one of those packages seems reasonable, *if* we can find a suitable hack. pango1.0 just has one build shared between the udeb and the full .deb, so if the hack goes there, a prerequisite would be to build it twice (fairly straightforward, just annoying). gtk+2.0 and harfbuzz already build twice, so it would be easy to add -DDEBIAN_INSTALLER to the udeb build, or similar. The problem is finding the right hack. I don't think bisecting Pango is necessarily going to get you very far: if you arrive at the version/commit where Pango switched from doing text layout internally to using Harfbuzz for everything, then that'll be a dead end. Conditionally reverting the switch from internal layout engines to Harfbuzz doesn't seem likely to yield a reasonable patch - the internal layout engines were deleted about 2 years ago and the rest of the pango codebase has moved on since then. I've added some printf debugging to GTK2 (attached) and it looks as though the problem is that the layout code flaps between two different pixel sizes for the same "line" of text (GTK calls it a "line" but it's really more like a paragraph - it will be line-wrapped to fit the available width). With the test-case of going back to language selection and choosing Sinhala, which I've been using because it's an easy one to reproduce: May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: GtkTextLayout 0x560b7b142110: validating near anchor 0x7f28cd080e20 from 0px to 576px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: anchor 0x7f28cd080e20 is in line 0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: තේරූ භාෂාව සඳහා ස්ථාපකයේ පරිවර්තනය අසම්පූර්ණයි. May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 72x102px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 73x119px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 1 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 2 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: මෙහි තේරුම සමහර සංවාද ඉංග්<200d>රීසියෙන් පෙනීමේ සැලකිය යුතු ඉඩක් ඇති බවයි. May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 66x153px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 66x153px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 3 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 4 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: ඔබට විකල්ප භාෂාව පිළිබඳ හොඳ අවබෝධයක් නොමැති නම්, එක්කෝ වෙනස් භාෂාවක් තෝරා ගැනීම හෝ ස්ථාපනය නැවැත්වීමට නිර්දේශ කරයි. May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 72x289px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 70x323px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Revalidated invalid lines from 0 to 4 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Top of first line y=0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: First line 0, y=0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Last line 4, y=627 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Delta height 51 ... May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: GtkTextLayout 0x560b7b142110: validating near anchor 0x7f28cd080e20 from 0px to 627px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: anchor 0x7f28cd080e20 is in line 0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: තේරූ භාෂාව සඳහා ස්ථාපකයේ පරිවර්තනය අසම්පූර්ණයි. May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 73x119px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 72x102px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 1 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 2 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: මෙහි තේරුම සමහර සංවාද ඉංග්<200d>රීසියෙන් පෙනීමේ සැලකිය යුතු ඉඩක් ඇති බවයි. May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 66x153px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 66x153px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 3 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 0x16px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: validating a subsequent line 4 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: line content: ඔබට විකල්ප භාෂාව පිළිබඳ හොඳ අවබෝධයක් නොමැති නම්, එක්කෝ වෙනස් භාෂාවක් තෝරා ගැනීම හෝ ස්ථාපනය නැවැත්වීමට නිර්දේශ කරයි. May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: was 70x323px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: now 72x289px May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Revalidated invalid lines from 0 to 4 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Top of first line y=0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: First line 0, y=0 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Last line 4, y=576 May 13 10:24:18 debconf: cdebconf_gtk (process:4590): Gtk - DEBUG: IA__gtk_text_layout_validate_yrange: Delta height -51 Obviously I can't read Sinhala, but "තේරූ භාෂාව සඳහා ස්ථාපකයේ පරිවර්තනය අසම්පූර්ණයි." presumably ought to be one size or the other, if everything else (e.g. font) is kept constant: it shouldn't flap between 73x119px and 72x102px on consecutive layout runs. I think the next step is to trace into how GTK is arriving at those sizes, and where the size flapping is taking place (probably in GTK, Pango or Harfbuzz). The given sizes also seem weird: the width is a lot less than I would have expected, as though the text is getting wrapped one character per line or something like that... perhaps if we managed to escape from this infinite loop, GTK would allocate more width for the GtkTextView and the text would get re-wrapped at a sensible width? Another possible route to look at might be to force the GtkTextView to fill the whole width of the window, so that a narrow layout is never considered? > ISTR you proposed then implemented changes to alleviate one of the > blockers for GTK3 in d-i (vte vs. libstdc++ if memory serves), but I > haven't managed to look at it during the bullseye cycle; we definitely > should look into gtk3-ifying (perhaps gtk4-ifying, time flies) d-i at > some point, but that's very likely bookworm material at this stage… The steps to use GTK 3 in d-i would be: - convert cdebconf-gtk-udeb from GTK 2 to GTK 3 - convert cdebconf-gtk-entropy from GTK 2 to GTK 3 - convert cdebconf-gtk-terminal from GTK 2 to GTK 3 and, simultaneously, from libvte9-udeb to libvte-2.91-0-udeb The big blocker for libvte-2.91-0-udeb used to be that it's written in C++, but I've switched it to be built with -static-libstdc++ so that we don't need a libstdc++6-udeb (its public API/ABI is GLib-flavoured C, only the internals are C++). The result is that libvte-2.91-0-udeb isn't much larger than libvte9-udeb. matchbox-keyboard-udeb also uses GTK 2 (#967624), but if it's a separate GUI program then it doesn't *necessarily* have to move to GTK 3 at the same time that cdebconf-gtk does. I'm also not sure whether it's actively used for anything? smcv
>From 5cb0a7ca277527a51c3449d1c61b232adc08058c Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Fri, 7 May 2021 09:39:04 +0100 Subject: [PATCH] d/rules: Build udeb with debug --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index 428e69767c..fe4cb92185 100755 --- a/debian/rules +++ b/debian/rules @@ -119,6 +119,8 @@ shared_configure_flags := $(configure_flags) \ --enable-introspection \ --enable-man shared_udeb_configure_flags := $(configure_flags) \ + CPPFLAGS="$(CPPFLAGS) -DDEBIAN_INSTALLER" \ + --enable-debug \ --disable-introspection \ --disable-xcomposite \ --disable-xdamage \ -- 2.31.1
>From 888c7dfbaafe7c5a7731afcb96ea5083a0550aa4 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Fri, 7 May 2021 09:38:54 +0100 Subject: [PATCH] gtkcontainer: Add extra debugging for #987587 --- gtk/gtkcontainer.c | 93 ++++++++++++++++++++++++++++++++++++++++++--- gtk/gtksizegroup.c | 61 +++++++++++++++++++++++++++-- gtk/gtktextlayout.c | 78 ++++++++++++++++++++++++++++++++++--- gtk/gtktextview.c | 88 ++++++++++++++++++++++++++++++++++++++---- 4 files changed, 299 insertions(+), 21 deletions(-) diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index c6cd16b273..3cecf2abba 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -1353,6 +1353,13 @@ gtk_container_idle_sizer (gpointer data) widget = slist->data; g_slist_free_1 (slist); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Dequeued %s %p, %u callbacks remaining", + G_STRFUNC, + G_OBJECT_TYPE_NAME (widget), + widget, + g_slist_length (container_resize_queue)); +#endif GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING); gtk_container_check_resize (GTK_CONTAINER (widget)); } @@ -1401,10 +1408,24 @@ _gtk_container_queue_resize (GtkContainer *container) gtk_container_idle_sizer, NULL, NULL); container_resize_queue = g_slist_prepend (container_resize_queue, resize_container); + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enqueued %s %p, %u callbacks remaining", + G_STRFUNC, + G_OBJECT_TYPE_NAME (widget), + widget, + g_slist_length (container_resize_queue)); +#endif } break; case GTK_RESIZE_IMMEDIATE: +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Resizing %s %p immediately", + G_STRFUNC, + G_OBJECT_TYPE_NAME (widget), + widget); +#endif gtk_container_check_resize (resize_container); break; @@ -1429,7 +1450,13 @@ gtk_container_check_resize (GtkContainer *container) { g_return_if_fail (GTK_IS_CONTAINER (container)); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enter: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (container), container); +#endif g_signal_emit (container, container_signals[CHECK_RESIZE], 0); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Leave: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (container), container); +#endif } static void @@ -1437,22 +1464,67 @@ gtk_container_real_check_resize (GtkContainer *container) { GtkWidget *widget = GTK_WIDGET (container); GtkRequisition requisition; - + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enter: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + gtk_widget_size_request (widget, &requisition); - + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p requested %dx%d px", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget, + requisition.width, requisition.height); + g_debug ("%s: %s %p currently %dx%d px at (%d,%d)", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget, + widget->allocation.width, widget->allocation.height, + widget->allocation.x, widget->allocation.y); +#endif + if (requisition.width > widget->allocation.width || requisition.height > widget->allocation.height) { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p needs more space!", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + if (GTK_IS_RESIZE_CONTAINER (container)) - gtk_widget_size_allocate (GTK_WIDGET (container), - >K_WIDGET (container)->allocation); + { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p is RESIZE_CONTAINER", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + gtk_widget_size_allocate (GTK_WIDGET (container), + >K_WIDGET (container)->allocation); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p allocated %dx%d px at (%d,%d)", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget, + widget->allocation.width, widget->allocation.height, + widget->allocation.x, widget->allocation.y); +#endif + } else - gtk_widget_queue_resize (widget); + { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p is not RESIZE_CONTAINER", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + gtk_widget_queue_resize (widget); + } } else { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p has enough space, resizing children...", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif gtk_container_resize_children (container); } + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Leave: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif } /* The container hasn't changed size but one of its children @@ -1474,8 +1546,19 @@ gtk_container_resize_children (GtkContainer *container) */ g_return_if_fail (GTK_IS_CONTAINER (container)); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enter: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (container), container); +#endif + widget = GTK_WIDGET (container); gtk_widget_size_allocate (widget, &widget->allocation); + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Leave: %s %p allocated %dx%d px at (%d,%d)", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget, + widget->allocation.width, widget->allocation.height, + widget->allocation.x, widget->allocation.y); +#endif } /** diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c index a6bd13b328..ad119c12cf 100644 --- a/gtk/gtksizegroup.c +++ b/gtk/gtksizegroup.c @@ -621,14 +621,32 @@ get_base_dimension (GtkWidget *widget, static void do_size_request (GtkWidget *widget) { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enter: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + if (GTK_WIDGET_REQUEST_NEEDED (widget)) { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: before: %s %p %dx%d px", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget, + widget->requisition.width, widget->requisition.height); +#endif gtk_widget_ensure_style (widget); GTK_PRIVATE_UNSET_FLAG (widget, GTK_REQUEST_NEEDED); g_signal_emit_by_name (widget, "size-request", &widget->requisition); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: after: %s %p %dx%d px", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget, + widget->requisition.width, widget->requisition.height); +#endif } + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Leave: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif } static gint @@ -752,17 +770,35 @@ static void get_fast_child_requisition (GtkWidget *widget, GtkRequisition *requisition) { - GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE); + GtkWidgetAuxInfo *aux_info; + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enter: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + + aux_info = _gtk_widget_get_aux_info (widget, FALSE); *requisition = widget->requisition; - + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %dx%d", G_STRFUNC, requisition->width, requisition->height); +#endif + if (aux_info) { if (aux_info->width > 0) requisition->width = aux_info->width; if (aux_info && aux_info->height > 0) requisition->height = aux_info->height; + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: After applying aux info: %dx%d", G_STRFUNC, requisition->width, requisition->height); +#endif } + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Leave: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif } /** @@ -808,15 +844,30 @@ _gtk_size_group_compute_requisition (GtkWidget *widget, gint width; gint height; +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enter: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + initialize_size_group_quarks (); if (get_size_groups (widget)) { /* Only do the full computation if we actually have size groups */ - + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p actually has size groups", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + width = compute_dimension (widget, GTK_SIZE_GROUP_HORIZONTAL); height = compute_dimension (widget, GTK_SIZE_GROUP_VERTICAL); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p -> %dx%d", + G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget, + width, height); +#endif + if (requisition) { requisition->width = width; @@ -830,6 +881,10 @@ _gtk_size_group_compute_requisition (GtkWidget *widget, if (requisition) get_fast_child_requisition (widget, requisition); } + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Leave: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif } /** diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 31139d739e..f1de686429 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -629,6 +629,11 @@ gtk_text_layout_emit_changed (GtkTextLayout *layout, gint old_height, gint new_height) { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p changed: y=%d, old_height=%d, new_height=%d", + G_STRFUNC, G_OBJECT_TYPE_NAME (layout), layout, + y, old_height, new_height); +#endif g_signal_emit (layout, signals[CHANGED], 0, y, old_height, new_height); } @@ -1027,6 +1032,12 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout, g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout)); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: %s %p: validating near anchor %p from %dpx to %dpx", + G_STRFUNC, G_OBJECT_TYPE_NAME (layout), layout, + anchor, y0, y1); +#endif + if (y0 > 0) y0 = 0; if (y1 < 0) @@ -1035,6 +1046,10 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout, /* Validate backwards from the anchor line to y0 */ line = _gtk_text_iter_get_text_line (anchor); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: anchor %p is in line %d", G_STRFUNC, anchor, + _gtk_text_line_get_number (line)); +#endif line = _gtk_text_line_previous (line); seen = 0; while (line && seen < -y0) @@ -1042,15 +1057,36 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout, GtkTextLineData *line_data = _gtk_text_line_get_data (line, layout); if (!line_data || !line_data->valid) { - gint old_height, new_height; + gint old_height, old_width, new_height, new_width; + GtkTextBTree *btree; + GtkTextIter line_iter; + GtkTextIter eol_iter; + gchar *content; old_height = line_data ? line_data->height : 0; - +#ifdef DEBIAN_INSTALLER + old_width = line_data ? line_data->width : 0; + + g_debug ("%s: validating a previous line %d", G_STRFUNC, + _gtk_text_line_get_number (line)); + btree = _gtk_text_buffer_get_btree (layout->buffer); + _gtk_text_btree_get_iter_at_line (btree, &line_iter, line, 0); + _gtk_text_btree_get_iter_at_line (btree, &eol_iter, line, 0); + gtk_text_iter_forward_line (&eol_iter); + content = _gtk_text_btree_get_text (&line_iter, &eol_iter, TRUE, TRUE); + g_debug ("%s: line content: %s", G_STRFUNC, content); + g_free (content); + g_debug ("%s: was %dx%dpx", G_STRFUNC, old_width, old_height); +#endif _gtk_text_btree_validate_line (_gtk_text_buffer_get_btree (layout->buffer), line, layout); line_data = _gtk_text_line_get_data (line, layout); new_height = line_data ? line_data->height : 0; +#ifdef DEBIAN_INSTALLER + new_width = line_data ? line_data->width : 0; + g_debug ("%s: now %dx%dpx", G_STRFUNC, new_width, new_height); +#endif delta_height += new_height - old_height; @@ -1075,14 +1111,34 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout, GtkTextLineData *line_data = _gtk_text_line_get_data (line, layout); if (!line_data || !line_data->valid) { - gint old_height, new_height; + gint old_height, old_width, new_height, new_width; + GtkTextBTree *btree; + GtkTextIter line_iter; + GtkTextIter eol_iter; + gchar *content; old_height = line_data ? line_data->height : 0; - +#ifdef DEBIAN_INSTALLER + old_width = line_data ? line_data->width : 0; + g_debug ("%s: validating a subsequent line %d", G_STRFUNC, + _gtk_text_line_get_number (line)); + btree = _gtk_text_buffer_get_btree (layout->buffer); + _gtk_text_btree_get_iter_at_line (btree, &line_iter, line, 0); + _gtk_text_btree_get_iter_at_line (btree, &eol_iter, line, 0); + gtk_text_iter_forward_line (&eol_iter); + content = _gtk_text_btree_get_text (&line_iter, &eol_iter, TRUE, TRUE); + g_debug ("%s: line content: %s", G_STRFUNC, content); + g_free (content); + g_debug ("%s: was %dx%dpx", G_STRFUNC, old_width, old_height); +#endif _gtk_text_btree_validate_line (_gtk_text_buffer_get_btree (layout->buffer), line, layout); line_data = _gtk_text_line_get_data (line, layout); new_height = line_data ? line_data->height : 0; +#ifdef DEBIAN_INSTALLER + new_width = line_data ? line_data->width : 0; + g_debug ("%s: now %dx%dpx", G_STRFUNC, new_width, new_height); +#endif delta_height += new_height - old_height; @@ -1106,11 +1162,23 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout, { gint line_top; +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Revalidated invalid lines from %d to %d", + G_STRFUNC, + _gtk_text_line_get_number (first_line), + _gtk_text_line_get_number (last_line)); +#endif + update_layout_size (layout); line_top = _gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer), first_line, layout); - +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Top of first line y=%d", G_STRFUNC, line_top); + g_debug ("%s: First line %d, y=%d", G_STRFUNC, _gtk_text_line_get_number (first_line), first_line_y); + g_debug ("%s: Last line %d, y=%d", G_STRFUNC, _gtk_text_line_get_number (last_line), last_line_y); + g_debug ("%s: Delta height %d", G_STRFUNC, delta_height); +#endif gtk_text_layout_emit_changed (layout, line_top, last_line_y - first_line_y - delta_height, diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index a258b11661..26156a0d49 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -3135,11 +3135,20 @@ gtk_text_view_size_request (GtkWidget *widget, text_view = GTK_TEXT_VIEW (widget); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Enter: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif + gtk_widget_style_get (widget, "interior-focus", &interior_focus, "focus-line-width", &focus_width, NULL); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: interior-focus=%d focus-line-width=%d", + G_STRFUNC, interior_focus, focus_width); +#endif + if (interior_focus) focus_edge_width = 0; else @@ -3147,6 +3156,11 @@ gtk_text_view_size_request (GtkWidget *widget, if (text_view->layout) { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: layout %dx%d", + G_STRFUNC, text_view->layout->width, text_view->layout->height); +#endif + text_view->text_window->requisition.width = text_view->layout->width; text_view->text_window->requisition.height = text_view->layout->height; } @@ -3160,21 +3174,56 @@ gtk_text_view_size_request (GtkWidget *widget, requisition->height = text_view->text_window->requisition.height + focus_edge_width * 2; if (text_view->left_window) - requisition->width += text_view->left_window->requisition.width; + { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: left window +%dx0", + G_STRFUNC, text_view->left_window->requisition.width); +#endif + + requisition->width += text_view->left_window->requisition.width; + } if (text_view->right_window) - requisition->width += text_view->right_window->requisition.width; + { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: right window +%dx0", + G_STRFUNC, text_view->right_window->requisition.width); +#endif + + requisition->width += text_view->right_window->requisition.width; + } if (text_view->top_window) - requisition->height += text_view->top_window->requisition.height; + { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: top window +0x%d", + G_STRFUNC, text_view->top_window->requisition.height); +#endif + + requisition->height += text_view->top_window->requisition.height; + } if (text_view->bottom_window) - requisition->height += text_view->bottom_window->requisition.height; + { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: bottom window +0x%d", + G_STRFUNC, text_view->bottom_window->requisition.height); +#endif + + requisition->height += text_view->bottom_window->requisition.height; + } +#ifdef DEBIAN_INSTALLER + g_debug ("%s: border width +%dx%d", + G_STRFUNC, + GTK_CONTAINER (text_view)->border_width * 2, + GTK_CONTAINER (text_view)->border_width * 2); +#endif requisition->width += GTK_CONTAINER (text_view)->border_width * 2; requisition->height += GTK_CONTAINER (text_view)->border_width * 2; tmp_list = text_view->children; + int i = 0; while (tmp_list != NULL) { GtkTextViewChild *child = tmp_list->data; @@ -3185,27 +3234,50 @@ gtk_text_view_size_request (GtkWidget *widget, GtkRequisition old_req; gtk_widget_get_child_requisition (child->widget, &old_req); - + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: child %d before: %dx%d", + G_STRFUNC, i, old_req.width, old_req.height); +#endif + gtk_widget_size_request (child->widget, &child_req); gtk_widget_get_child_requisition (child->widget, &child_req); +#ifdef DEBIAN_INSTALLER + g_debug ("%s: child %d after: %dx%d", + G_STRFUNC, i, child_req.width, child_req.height); +#endif + /* Invalidate layout lines if required */ if (text_view->layout && (old_req.width != child_req.width || old_req.height != child_req.height)) - gtk_text_child_anchor_queue_resize (child->anchor, - text_view->layout); + { +#ifdef DEBIAN_INSTALLER + g_debug ("%s: child %d queue resize", G_STRFUNC, i); +#endif + gtk_text_child_anchor_queue_resize (child->anchor, + text_view->layout); + } } else { GtkRequisition child_req; - + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: child %d size request but ignore?", G_STRFUNC, i); +#endif gtk_widget_size_request (child->widget, &child_req); } tmp_list = g_slist_next (tmp_list); + i += 1; } + +#ifdef DEBIAN_INSTALLER + g_debug ("%s: Leave: %s %p", G_STRFUNC, G_OBJECT_TYPE_NAME (widget), widget); +#endif } static void -- 2.31.1