From 5f55e1cd63883c8d48a0e212e8910f6dfd536a50 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Thu, 7 Mar 2002 19:22:58 +0000 Subject: Back-ported cut & paste code from fltk2.0. This code splits the cut & paste into two buffers. The "SELECTION" is used for the currently highlighted text and for middle-mouse paste and (if possible) for handling drag & drop. The "CLIPBOARD" is for Ctrl+C and Ctrl+V style cut & paste. This matches how Motif, GTK, and KDE 3.0 work. But many older X applications (including KDE 2) can only see SELECTION, this results in cut & paste incompatability that is familiar to X users. However this now moves fltk over to the majority camp. On all systems this eliminates the annoying inability to select a region and replace it with Ctrl+V. On Mac and Win32 the SELECTION is local to the application, so middle-mouse paste only works between fields in the application. There may be tricks (special clipboard data types? use drag & drop?) to make it communicate, but unless there are standards it would be fltk-only. The file Fl_cutpaste.cxx has been deleted, so update the IDE files! The Win32 and Mac versions have NOT BEEN TESTED! I tried to be careful editing them but they may need some work. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1989 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_dnd_x.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/fl_dnd_x.cxx') diff --git a/src/fl_dnd_x.cxx b/src/fl_dnd_x.cxx index 9cc4f5b82..7766e7b16 100644 --- a/src/fl_dnd_x.cxx +++ b/src/fl_dnd_x.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_dnd_x.cxx,v 1.5.2.2 2002/02/26 05:25:11 easysw Exp $" +// "$Id: fl_dnd_x.cxx,v 1.5.2.3 2002/03/07 19:22:58 spitzak Exp $" // // Drag & Drop code for the Fast Light Tool Kit (FLTK). // @@ -40,6 +40,8 @@ extern Atom fl_XdndActionCopy; extern Atom fl_XdndFinished; //extern Atom fl_XdndProxy; +extern char fl_i_own_selection[2]; + extern void fl_sendClientMessage(Window window, Atom message, unsigned long d0, unsigned long d1=0, @@ -85,7 +87,7 @@ int Fl::dnd() { Window target_window = 0; Fl_Window* local_window = 0; int version = 4; int dest_x, dest_y; - XSetSelectionOwner(fl_display, fl_XdndSelection, source_window, fl_event_time); + XSetSelectionOwner(fl_display, fl_XdndSelection, fl_message_window, fl_event_time); while (Fl::pushed()) { @@ -132,8 +134,8 @@ int Fl::dnd() { } if (local_window) { - selection_owner(local_window); - if (local_handle(FL_DND_RELEASE, local_window)) paste(*belowmouse()); + fl_i_own_selection[0] = 1; + if (local_handle(FL_DND_RELEASE, local_window)) paste(*belowmouse(), 0); } else if (version) { fl_sendClientMessage(target_window, fl_XdndDrop, source_window, 0, fl_event_time); @@ -165,5 +167,5 @@ int Fl::dnd() { // -// End of "$Id: fl_dnd_x.cxx,v 1.5.2.2 2002/02/26 05:25:11 easysw Exp $". +// End of "$Id: fl_dnd_x.cxx,v 1.5.2.3 2002/03/07 19:22:58 spitzak Exp $". // -- cgit v1.2.3