From: lee@sq.sq.com (Liam R. E. Quin)
Subject: Re: Cut/Paste in OWN and more
Organization: SoftQuad Inc., Toronto, Canada
Date: Sun, 22 Nov 92 05:21:19 GMT

ich@ccwf.cc.utexas.edu (Ing-Chin Hwang) writes:
>1. One of the most frequent window operations is select/copy in one
>xterm and paste to another window, be it another xterm or a DECterm
>from a remote VAX. 

>The X convention seems to be but1/drag is selection and but2 is
>paste. 

matt@centerline.com (Matt Landau) corrects Ing-Chin:
> Actually, there is no such thing as "the X convention" for copy and paste 
> operations.  There are at least three or four different conventions for 
> dealing with text operations, depending on the GUI style and toolkit you
> are using:
>   * The Athena widgets convention, which is also used by xterm, is
>     that left-drag selects a region and places it into the PRIMARY
>     selection, while middle click copies in the contents of the
>     PRIMARY selection (or CUT_BUFFER0, if the PRIMARY selection is
>     empty) in at the current text insertion point.

Yes.  You can change this with translations, as is one in the OpenWindows 3
app-defaults file for XTerm, to make the CUT and PASTE keyboard keys work.
 
>> [motif omitted...]

>   * OPEN LOOK does not use the PRIAMRY-based left/middle convention at all,
OpenWindows doesn't -- the OPEN LOOK UI doesn't specify how cut, copy and
paste should be implemented at that level of detail.

>     but uses an exclusively CLIPBOARD-based selection method
>     where positive action is required to copy the selected text to 
>     the CLIPBOARD selection (ususally this means pressing the Copy 
>     key), and selections are persistent until explicitly replaced by
>     a subsequent Copy operation.

Actually, this is misleading, Paul.  The XView, TNT and OLIT toolkits all
*do* manipulate the primary X selection, so that when yuc select text in
(say) cmdtool, you can paste it directly into xterm.  They do not, however,
give you a way of pasting the primary selection, I agree.

>   * Both OPEN LOOK and Motif (at least, as of Motif 1.2) also have
>     direct-manipulation drag-and-drop interfaces for text editing.

> Completely interoperability requires that an application understand, or
> be able to understand, ALL of these conventions.  It's not conceptually
> hard except for drag-and-drop (where the OPEN LOOK protocol is utterly
> Byzantine and the Motif protocol is undocumented, which is even worse
> than being Byzantine!), but it seems like very few application or GUI
> toolkit developers go to the trouble of getting all the corner cases 
> right.

The OpenWindows drag and drop and copy & paste protocols are documented in the
OpenWindows programmer's manuals.  I agree strongly that they are not as
simple as I would like.  I haink Byzantine is a little overstated, but only
because I've seen worse :-)

>> Often times before the paste, I need to click on the menu/title bar of the
>> another window to bring it up front.  This will then de-select the region
>> I just select.  What's the best way to solve this problem? 
> 
> Well, you could use a focus-follows-pointer focus model in your window
> manager, so that you wouldn't have to direct input to it explcitly, or
> you could abandon the use of the left/middle mouse style of copy and 
> paste and switch to using one of the persistent CLIPBOARD-based methods
> instead.  You claim later that you don't want to do this, but it might
> be your best option.

In fact there are easier ways, if, as I suspect, the poster is using
OpenWindows.

First, you can use the Front key (L5) or Alt-t to change which window is on
top.  You may need to have 
OpenWindows.KeyboardCommands:   Full
in your .Xdefaults file for Alt-t to do anything; it brings the window with
focus to the front.

Next, note that the window into which you paste does not have to be on top.

Finally, I append the section from the FAQ on the subject, since I stupidly
forgot to set the Expires: date when I posted it this month.

For my part, I generally use L6 (copy) and L8 (paste), or simply drag the
selected text from one window to another.  Note that you can use L5 while
you are dragging text!  This is very useful...



Subject: Key Bindings, Cut and Paste

@ How do I cut and paste between XTerm and OpenWindows programs?

    To go from XTerm to textedit (say):
    * Select the text you want to copy by dragging the SELECT mouse button
      in xterm
    * Press COPY in the XTerm (this key is L6, or Meta+c (the O'Reilly
      XView manual gets this wrong)
    * Move to the textedit window, and press PASTE (L8 or Meta+v)

    If this doesn't work, see Troubleshooting: Cut and Paste

   To go the other way, from textedit to XTerm:
    * Select the text in textedit.  No need to use COPY
    * Move to the XTerm window and press ADJUST (the middle mouse button).
    * You can also use the COPY/CUT and PASTE buttons.

@ COPY/PASTE is boring.	 What short-cuts are available?

    Quick Copy within textedit, mailtool, etc:
    * Click SELECT to get a text caret where you want the copied text to go
    * Press and HOLD DOWN the PASTE (or CUT) button
    * Select the text you want to copy/move.  You'll see that it's underlined
      or crossed out, as appropriate.  (In the jed demo it goes grey)
    * Let go of the PASTE (or CUT) button.
    * The text you underlined or crossed out appears at the insert caret.

    Drag and Drop to Move a Selection
    * Select the text you want to copy or move, by dragging or miltiple-
      clicking the SELECT or ADJUST mouse button
    * Put the mouse pointer anywhere within the selection
    * Press and HOLD DOWN down the SELECT mouse button, and move the mouse
      pointer a little to the right; you'll see the cursor changes to be the
      first 3 letters of the text (or some other icon).
    * Still holding SELECT down, move the mouse over the point where you want
      to drop the text
    * You may see the mouse pointer change to a rifle-sight or target, to show
      that it's OK to drop things here
    * Let go of SELECT, and the text is moved.	This works in text fields of
      dialogue boxes as well as in text subwindows.

    Drag and Drop to Copy a Selection
    * This is the same as using Drag and Drop to Move a Selection, except that
      you must hold the CONTROL key down as well as the SELECT mouse button.



Lee

-- 
lee@sq.com (Liam Quin) the barefoot programmer; SoftQuad Inc +1 416 239 4801
 OPEN LOOK UI FAQ; Metafont list; HexSweeper NeWS game; lq-text text retrieval
 `The priestes boy came, whyle the flesh was seething' [lq-text-request@sq.com
 1 Sam II:13/Miles Coverdale/1535