Re: textview buffers and primary clipboard issue

2019-02-25 Thread Doug McCasland
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

Re: textview buffers and primary clipboard issue

2019-02-21 Thread Doug McCasland


Some add'l info:

This is using GTK 3.24 in Lubuntu 18.10.

When I select with the mouse and use middle-click to paste in 
the *same* buffer -- with an image below the text, as described 
above -- it does work normally.  So in that case, even though 
the Primary clipboard incorrectly contains non-selected image 
data, TextView is not pasting all of what's on the Primary clipboard, 
apparently.  

--
Doug McCasland, San Francisco  
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list