Compare commits

...

3 Commits

Author SHA1 Message Date
Matthias Clasen
52ac8814cc textview: Don't leave embedded children behind
When scrolling embedded widgets out of view,
they sometimes get left behind because we don't
reallocated them. To avoid that, move _all_ children
out of view in size_allocate, and let the current
child allocation plumbing move the visible ones
back in place.
2021-11-05 18:54:06 -04:00
Matthias Clasen
1771a30269 Remove a confusing comment
It talks about propagating to unanchored children,
but then iterates over anchored_children. That does
not add up.
2021-11-05 15:37:52 -04:00
Matthias Clasen
b55c9b4499 gtk-demo: Avoid a missing icon
The hypertext demo was using an icon that we no longer
include in our embedded icon theme. Use a different one.
2021-11-05 15:26:27 -04:00
2 changed files with 127 additions and 120 deletions

View File

@@ -94,13 +94,12 @@ show_page (GtkTextView *text_view,
gtk_text_buffer_insert (buffer, &iter, " can easily be realized with ", -1);
insert_link (buffer, &iter, "tags", 2);
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
gtk_text_buffer_insert (buffer, &iter,
"Of course you can also embed Emoji 😋, "
"icons ", -1);
gtk_text_buffer_insert (buffer, &iter, "Of course you can also embed Emoji 😋, ", -1);
gtk_text_buffer_insert (buffer, &iter, "icons ", -1);
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (text_view)));
icon = gtk_icon_theme_lookup_icon (theme,
"microphone-sensitivity-high-symbolic",
"eye-not-looking-symbolic",
NULL,
16,
1,

View File

@@ -4409,6 +4409,8 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
{
const AnchoredChild *child = iter->data;
GtkTextIter child_loc;
GtkRequisition child_req;
GtkAllocation allocation;
/* We need to force-validate the regions containing children. */
gtk_text_buffer_get_iter_at_child_anchor (get_buffer (text_view),
@@ -4429,6 +4431,15 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
}
gtk_text_layout_validate_yrange (priv->layout, &child_loc, 0, 1);
gtk_widget_get_preferred_size (child->widget, &child_req, NULL);
allocation.x = - child_req.width;
allocation.y = - child_req.height;
allocation.width = child_req.width;
allocation.height = child_req.height;
gtk_widget_size_allocate (child->widget, &allocation, -1);
}
}
@@ -5910,9 +5921,6 @@ gtk_text_view_snapshot (GtkWidget *widget,
snapshot_text_view_child (widget, priv->bottom_child, snapshot);
snapshot_text_view_child (widget, priv->center_child, snapshot);
/* Propagate exposes to all unanchored children.
* Anchored children are handled in gtk_text_view_paint().
*/
for (iter = priv->anchored_children.head; iter; iter = iter->next)
{
const AnchoredChild *vc = iter->data;