Find out which gtk widget has the current selection

I have a set of widgets GtkEntry, some of which are editable and focusable, and some are not. I would like to know which of them currently have the selected text in order to implement the menu item "Edit-> Copy". Is there a way to do this differently than repeating all the widgets until gtk_editable_get_selection_boundsit returns true?

Currently, I will get around the problem by calling gtk_clipboard_get(GDK_SELECTION_PRIMARY), but from what the documents say, it is not portable (and will also select the text selected anywhere in the current display, and not just from my application).

+5
source share
1 answer

gtk_window_get_focus ()? , . , " ". . , .

, , , , . , gtk_editable_copy_clipboard(), (, ) . , , , gtk_editable_paste_clipboard().

+1

All Articles