[comp.windows.x] Summary: paste & cut between xview and Xaw

brossard@SASUN1.EPFL.CH ("", Alain Brossard EPFL-SIC/SII) (11/01/90)

	Well I had prepared a nice and long description of the problem
and the different solutions I received but mailtool (OW-2.0) crashed
(again) and I lost all the replies and my own summary.  So to those
who have replied to me, you know who you are, thanks for the information...

	The problem was how to exchange information between xview
programs and Xaw programs (like xterm and xrn).  Xview uses keys
called (copy, paste and cut: L6, L8 & L10) to send and receive
selections from the clipboard.
	So one way to communicate is to use the program xclipboard,
use the mouse to paste text into the clipboard and then use the
paste key to paste the text in the xview program.
	Another way is to use appropriate bindings so that
Xaw programs behave the same way xview programs do or as
close as you want them to.

	Most of the usefull information on how to do this comes
from somebody at Sun whose name was lost in the (big) mailtool
crash.
	Below, you'll find bindings for the Text widget and for
the VT100 widget:

*Text.translations:     #override \n\
        <KeyPress>L6:   extend-start() extend-end(PRIMARY, CLIPBOARD, CUT_BUFFER0
)\n\
        <Key>L8:        insert-selection(CLIPBOARD) \n\
        <KeyPress>L10:  extend-start() extend-end(PRIMARY, CLIPBOARD, CUT_BUFFER0
)\n\
        <KeyRelease>L10:        kill-selection() \n\
        ~Ctrl ~Meta <Btn2Down>: extend-start() \n\
        ~Meta <Btn2Motion>: extend-adjust() \n\
        ~Ctrl ~Meta <Btn2Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\
        ~Ctrl ~Meta <Btn3Down>: no-op() \n\
        ~Ctrl ~Meta <Btn3Up>: insert-selection(PRIMARY, CUT_BUFFER0)

XTerm*VT100.Translations: #override \n\
        <Key>L6:        start-extend() select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0
)\n\
        <Key>L8:        insert-selection(CLIPBOARD) \n\
        <Key>L10:       start-extend() select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0
)\n\
        ~Ctrl ~Meta <Btn2Down>: start-extend() \n\
        ~Meta <Btn2Motion>: select-extend() \n\
        ~Ctrl ~Meta <Btn2Up>: select-end(PRIMARY, CUT_BUFFER0) \n\
        ~Ctrl ~Meta <Btn3Down>: ignore() \n\
        ~Ctrl ~Meta <Btn3Up>: insert-selection(PRIMARY, CUT_BUFFER0)

	One problem with those bindings is the use of start-extend (or
extend-start (!)) with buttons: it will modify the size of the selection
if you have moved the mouse since having made the selection.  But I haven't
any other binding which works...

	Another point that needs mentionning is the binding for L10 which
is in 2 parts for the Text widget.  If you put everything in the same
line, there is a bug which seems to "hang" the CLIPBOARD selection: this
selection stops working until you start (or restart) the xclipboard
program which seems to unfreeze the clipboard.  If you put the definition
in two lines like I did then it all works fine.  This time I was lucky
to stumble early on on why my bindings would never work, last time
I quit in disgust after a couple of hours ( I wasn't using xclipboard).


Alain Brossard, Ecole Polytechnique Federale de Lausanne,
	SIC/SII, EL-Ecublens, CH-1015 Lausanne, Suisse
brossard@sasun1.epfl.ch