Well I played with some tag table calls and now things work correctly.
Previously I was using:
| gtk_text_view_new()
which creates a TextView and a buffer, then
| buf[i] = gtk_text_view_get_buffer()
to get the buffer object. Then for each new tag in each buffer:
| gtk_text_buffer_create_tag(buf[i],)
That was very inefficient, since I wanted each buffer to have
all the same tags. So I re-worked the code so it only created
the tags once in the first buffer and then I created subsequent
buffers using that tag set. Here are the basics of what I did:
| GtkTextTagTable *main_tag_table;
| tv[0] = gtk_text_view_new();
| buf[0] = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv[0]);
| main_tag_table = gtk_text_buffer_get_tag_table(buf[0]);
For subsequent buffers:
| buf[i] = gtk_text_buffer_new(main_tag_table);
| tv[i] = gtk_text_view_new_with_buffer(buf[i]);
Then create new tags only in the first buffer:
| gtk_text_buffer_create_tag(buf[0], ..., );
I still called:
| gtk_text_buffer_register_serialize_tagset()
and
| gtk_text_buffer_register_deserialize_tagset()
in each buffer.
So there's something about not sharing that tag table that makes
middle-button paste act strangely. Might have been a GTK bug,
or some part of my code (always more likely ☺). However, the
Primary clipboard after selecting text that is followed by an
image (in a TextView buffer, that is) still has all that unselected
image data. But somehow it doesn't get pasted by middle-button
click, so that's odd.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list