Re: textview buffers and primary clipboard issue
- From: Doug McCasland <dougm bravoecho net>
- To: GTK app devel <gtk-app-devel-list gnome org>
- Cc: bc40 suremail info
- Subject: Re: textview buffers and primary clipboard issue
- Date: Mon, 25 Feb 2019 13:10:02 -0800
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]