Ticket #3371 (closed defect: fixed)
Bad interaction between Clipboard and TTS
| Reported by: | godiard | Owned by: | godiard |
|---|---|---|---|
| Priority: | Unspecified by Maintainer | Milestone: | 0.96 |
| Component: | sugar | Version: | Unspecified |
| Severity: | Unspecified | Keywords: | 12.1.0 |
| Cc: | garycmartin | Distribution/OS: | Unspecified |
| Bug Status: | Unconfirmed |
Description
Whit the new functionality of text to Speech, we found the following problem.
If a user is using Write, select a text and press Alt-Shift-S, the text is played, and no object is added to the clipboard. If the user copy a object, and later press Alt-Shift-S, a new object is added to the clipboard.
This is probably, because Write is using gtk_clipboard_set_with_owner(). See http://developer.gnome.org/gtk/2.24/gtk-Clipboards.html
When you set the contents of the clipboard, you can either supply the data directly (via functions like gtk_clipboard_set_text()), or you can supply a callback to be called at a later time when the data is needed (via gtk_clipboard_set_with_data() or gtk_clipboard_set_with_owner().) Providing a callback also avoids having to make copies of the data when it is not needed.
I propose doing a hash of the selected data, and use it to check if the data is already included in our clipboard_objects list.
This have another consequence, if you select a text and press many times "Ctrl-C", is only added one time. I think this is ok, but I don't know if there are one use case I am not thinking.
One last issue: If we copy text "A", later text "B", and later text "A" again, probably we should move "A" to the first place in the selection queue to allow to paste "A" and not "B".

