On 5/28/24 23:30, Brian Larsen wrote:
I'm using FLTK from git/master and I'm using Ubuntu, which means X11.
For the clipboard, FLTK has a nice copy() function that takes a pointer toa string as the data to put into the clipboard. Perfect.
Is there a related function that takes a pointer to a string for the destinationto put the clipboard data into? It seems paste() doesn't offer that option,unless I misunderstand the docs. Is there a simple way to get the currentclipboard data into a string?
On 5/29/24 01:04, Brian Larsen wrote:
Thanks for that information. Because of the way I've chosen to do things that might not workfor me. The problem is I'm porting a working app that was text only and using ncurses. So it'sbeen (mostly) convenient to do all the key processing myself since that was already setup.Thankfully, FLTK allows using Fl::wait() inside a while(1) loop instead of having to useFl::run(). In my case when Ctrl+V is seen, I call a paste routine and was hoping to just pullthe text from the clipboard.
Fl_Text_Editor.cxx does this too; in response to a Ctrl+V
hotkey, it calls Fl::paste(<widget>,
1);
which sends an FL_PASTE event to <widget>, and
that widget's handle() method checks for
FL_PASTE and gets the actual text via Fl::event_text() /
Fl::event_length().
The 2nd numeric argument to Fl::paste() indicates which source
to paste from:
0 being the "selection buffer", or more commonly 1 being the
"clipboard" (as shown above).