summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx3
-rw-r--r--src/Fl_x.cxx14
2 files changed, 12 insertions, 5 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 53fb7fff1..fa0620fa6 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1,7 +1,7 @@
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2022 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -74,6 +74,7 @@ Fl_Callback_Reason Fl::callback_reason_ = FL_REASON_UNKNOWN;
unsigned char Fl::options_[] = { 0, 0 };
unsigned char Fl::options_read_ = 0;
+int Fl::selection_to_clipboard_ = 0;
Fl_Window *fl_xfocus = NULL; // which window X thinks has focus
Fl_Window *fl_xmousewin; // which window X thinks has FL_ENTER
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 2c2720033..14aacaa7b 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,7 +1,7 @@
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2022 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -807,13 +807,19 @@ static int get_xwinprop(Window wnd, Atom prop, long max_length,
////////////////////////////////////////////////////////////////
// Code for copying to clipboard and DnD out of the program:
+// See Fl::copy() for possible values of the destination (argument clipboard)
+// See also Fl::selection_to_clipboard()
void Fl_X11_Screen_Driver::copy(const char *stuff, int len, int clipboard, const char *type) {
if (!stuff || len<0) return;
+ // if selection_to_clipboard is enabled *and* destination is 0 (selection buffer),
+ // then copy to both (STR 3229)
+ if (clipboard == 0 && Fl::selection_to_clipboard())
+ clipboard = 2;
+
if (clipboard >= 2) {
- copy(stuff, len, 0, type);
- copy(stuff, len, 1, type);
- return;
+ copy(stuff, len, 1, type); // copy to clipboard first (this is a recursion!)
+ clipboard = 0; // ... and then to selection buffer: fall through
}
if (len+1 > fl_selection_buffer_length[clipboard]) {