Path: gmdzi!unido!mcsun!uunet!elroy.jpl.nasa.gov!usc!apple!mips.mitek.com! hp835.mitek.com!tk From: t...@hp835.mitek.com (Tom Kimball) Newsgroups: comp.windows.open-look,comp.windows.x Subject: Programming XLIB clients to do OpenLook copy/paste. Summary: OpenLook does not send SelectionClear event. Message-ID: <1991Sep17.161527.17240@mips.mitek.com> Date: 17 Sep 91 16:15:27 GMT Sender: n...@mips.mitek.com (USENET Administrator) Organization: OpenConnect Systems Lines: 68 Does anyone know how to program XLIB applications to allow copy/paste functionaliy with OpenLook applications, specifically, Sun OpenWindows 2.0 applications such as SHELLTOOL? My situation is this: I have an application using raw XLIB calls that handles copy/paste well with other X applications such as XTERM. I would like to extend the copy/paste functionality to work with OpenLook programs such as the OpenWindows SHELLTOOL, CMDTOOL, and TEXTEDIT clients (which use the XVIEW toolkit). The major changes I have made to my XLIB program to add OpenLook copy/paste functionality so far are these: 1. Used the CLIPBOARD selection rather than the PRIMARY selection. 2. Added support for (target == XA_LENGTH) for SelectionRequest Events. Here is where the big problem occurs: My XLIB application is the owner of the CLIPBOARD selection. The SHELLTOOL user copies text into CLIPBOARD and thus SHELLTOOL wants to become the new owner. SHELLTOOL does not send my application a SelectionClear event, but instead seems to create a new CLIPBOARD atom and uses that. At this point things become strange. Other non-OpenLook applications such as XTERM that request the CLIPBOARD contents get it from my XLIB appliction. But, OpenWindows applications that paste the CLIPBOARD get the text from the SHELLTOOL that created a new CLIPBOARD. This problem is not specific to my application but I believe a general one. For those who want to duplicate this problem using only SHELLTOOL and XTERM here are instructions. -------------- 1. Put the following in your .Xdefaults file to allow XTERM to use the OpenWindows copy and paste keys to copy and paste text into the CLIPBOARD. *VT100.Translations: #override \ <Key>L6: select-end(CLIPBOARD)\n\ <Key>L8: insert-selection(CLIPBOARD) 2. Bring up SHELLTOOL (or other OpenLook application) and XTERM. 3. Go to XTERM. Hold down left mouse button and drag mouse over text. 4. Press L6 key to add selected text to CLIPBOARD. Release left mouse button. 5. If you like, you can now paste this text into SHELLTOOL or XTERM with the L8 key. 6. Repeat 3 and 4 for SHELLTOOL. 7. Now, if you go to XTERM and paste with the L8 button, you get the text selected in XTERM, not SHELLTOOL. If you go to SHELLTOOL and paste, however, you get the text selected in SHELLTOOL. i.e., there are now two CLIPBOARD selections. -------------- Does anyone know how to program an XLIB application to handle OpenLook copy/paste? In particular, what XLIB events does OpenLook generate instead of SelectionClear when it wants ownership of the CLIPBOARD? Thanks in advance for any replies. -- Tom Kimball t...@hp835.mitek.com OpenConnect Systems (214)308-0497 Carrollton, TX 75006
Path: gmdzi!unido!fauern!ira.uka.de!yale.edu!qt.cs.utexas.edu!cs.utexas.edu! swrinde!gatech!bloom-beacon!dont-send-mail-to-path-lines From: h...@luke.atdiv.lanl.GOV (Jeff Hill) Newsgroups: comp.windows.x Subject: Re: Programming XLIB clients to do OpenLook copy/paste. Message-ID: <9109182130.AA28839@luke.atdiv.lanl.gov> Date: 18 Sep 91 21:30:58 GMT Sender: dae...@athena.mit.edu (Mr Background) Organization: The Internet Lines: 40 > Does anyone know how to program XLIB applications to allow > copy/paste functionaliy with OpenLook applications, specifically, > Sun OpenWindows 2.0 applications such as SHELLTOOL? I am also having similar problems. Here is a copy of a message I sent out to xpert awhile back with no response. Jeff ------------ snip --------------- snip --------------------- To: xp...@expo.lcs.mit.edu Subject: does xview communicate with other types of X clients Cc: sun...@Lanl.GOV Status: RO I am writing a graphics editor which does not use the xview toolkit. This application allows cutting, copying, and pasting via the Xlib selection mechanism described in the ICCCM. I can currently supply the display list elements in the "PRIMARY" selection in either a binary or ASCII form to any client which requests the selection. Problems occur however when trying to interoperate with xview clients. xview clients appear to ask for conversion to other target types which are not described in the ICCCM. ie target atoms: `_SUN_SELN_FIRST' `_SUN_SELN_LAST' `_SUN_SELN_DO_FUNCTION' Does anyone know where the xview selection interface is documented? I tried O'Reilly book 7 chapter 18 and this seemed to be a xview programmer's reference and not the interclient communication xview reference which I am seeking. Has anyone writing a non xview client attempted to communicate with an xview client via the ICCCM selection mechanism? thanks in advance. Jeff
Path: gmdzi!unido!unidui!math.fu-berlin.de!ira.uka.de!yale.edu!qt.cs.utexas.edu! zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!convex! mips.mitek.com!hp835.mitek.com!tk From: t...@hp835.mitek.com (Tom Kimball) Newsgroups: comp.windows.open-look,comp.windows.x Subject: Re: Programming XLIB clients to do OpenLook copy/paste. Summary: Solution Message-ID: <1991Sep19.203521.13987@mips.mitek.com> Date: 19 Sep 91 20:35:21 GMT References: <1991Sep17.161527.17240@mips.mitek.com> Sender: n...@mips.mitek.com (USENET Administrator) Organization: OpenConnect Systems Lines: 81 In article <1991Sep17.161527.17...@mips.mitek.com> t...@hp835.mitek.com (Tom Kimball) writes: > >Does anyone know how to program XLIB applications to allow >copy/paste functionaliy with OpenLook applications, specifically, >Sun OpenWindows 2.0 applications such as SHELLTOOL? > Although I have not received any replies thus far (except me toos), I did figure this out myself with the help of the (very handy) xscope program. It would be nice to find this kind of thing documented somewhere, though. Does documentation for this even exist anywhere? When the OpenWindows client wants control of the CLIPBOARD that your client owns, instead of sending you a SelectionClear event it sends you a SelectionRequest event with the target atom "_SUN_SELN_YIELD". You are supposed to send it back a value of 1 (True?) and give up control of the CLIPBOARD. I presume that it is "asking permission" to receive control of the CLIPBOARD. If is does not receive a yes (1) reply (or any reply), it simply creates a new CLIPBOARD atom (forgot what the name is) and uses that. Don't know how other OpenWindows clients know to use the new CLIPBOARD instead of the real CLIPBOARD. All this seems like a clever system but of course does not follow the X standard and therefore blows away compatibility with most X clients. The name of the target atom "_SUN ..." makes me believe this convention is specific to OpenWindows or perhaps XVIEW rather than an OpenLook standard as I assumed earlier. Of course, the only way to get this to work with XTERM is to patch the XTERM source. For reference purposes, I have included below the diffs to the xselection.c program written by Richard Hesketh and available on uunet that will allow the program to work with OpenWindows clients. ------------------------------------------------------------ 385a386,424 > Atom XA_YIELD = > XInternAtom(dpy, "_SUN_SELN_YIELD", True); > > > if (ptr_event->xselectionrequest.target == XA_YIELD) { > unsigned long yield = 1; > > /* yield the selection to OpenWindows client */ > XSetSelectionOwner(ptr_event->xselectionrequest.display, > ptr_event->xselectionrequest.selection, None,CurrentTime); > > XChangeProperty(ptr_event->xselectionrequest.display, > ptr_event->xselectionrequest.requestor, > ptr_event->xselectionrequest.property, > ptr_event->xselectionrequest.target, > 32, PropModeReplace, &yield, > 1); > > req_event = &(ptr_event->xselectionrequest); > > notify_event.type = SelectionNotify; > notify_event.display = req_event->display; > notify_event.requestor = req_event->requestor; > notify_event.selection = req_event->selection; > notify_event.target = req_event->target; > notify_event.time = req_event->time; > > if (req_event->property == None) > notify_event.property = req_event->target; > else > notify_event.property = req_event->property; > > (void)XSendEvent(req_event->display, req_event->requestor, > False, 0, (XEvent *)¬ify_event); > XFlush(dpy); > XCloseDisplay(dpy); > exit(0); > } > -- Tom Kimball t...@hp835.mitek.com OpenConnect Systems (214)308-0497 Carrollton, TX 75006
Path: gmdzi!unido!unidui!math.fu-berlin.de!ira.uka.de!sol.ctr.columbia.edu! zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!cronkite.Central.Sun.COM! spdev!texsun!ukcsd.uk.sun.com!jeremy From: jer...@ukcsd.uk.sun.com (Jeremy Allison - Sun UK - Tech Support) Newsgroups: comp.windows.open-look,comp.windows.x Subject: Re: Programming XLIB clients to do OpenLook copy/paste. Message-ID: <8650@texsun.Central.Sun.COM> Date: 20 Sep 91 08:32:40 GMT References: <1991Sep17.161527.17240@mips.mitek.com> <1991Sep19.203521.13987@mips.mitek.com> Sender: n...@texsun.Central.Sun.COM Reply-To: Jeremy.Alli...@UK.Sun.COM Followup-To: comp.windows.open-look Organization: Sun Microsystems UK Answer Centre Lines: 42 In article <1991Sep19.203521.13...@mips.mitek.com>, t...@hp835.mitek.com (Tom Kimball) writes: |> In article <1991Sep17.161527.17...@mips.mitek.com> t...@hp835.mitek.com |> (Tom Kimball) writes: |> > |> >Does anyone know how to program XLIB applications to allow |> >copy/paste functionaliy with OpenLook applications, specifically, |> >Sun OpenWindows 2.0 applications such as SHELLTOOL? |> > |> .... .... code and non-standard method deleted .... |> Tom Kimball t...@hp835.mitek.com |> OpenConnect Systems (214)308-0497 |> Carrollton, TX 75006 I wanted to do the same thing to cut/paste between cmdtool/shelltool and emacs - but I didn't find this problem. I method I used was the standard ICCCM - just using the standard CLIPBOARD atom and putting the data on the window as a property. It worked just find doing copy/paste operations. I never even heard of this _SUN_SELN_YIELD atom. Also to do copy/paste between cmd/shelltools and xterms I just modify the VT100 widget translation table as shown. XTerm*VT100*Translations: #override\n\ Shift <KeyPress> Select:select-cursor-start() select-cursor-end(CLIPBOARD, CUT_BUFFER0, PRIMARY)\n\ ~Ctrl ~Meta <Btn1Down>: select-start() \n\ ~Ctrl ~Meta <Btn2Down>: start-extend()\n\ ~Ctrl ~Meta <Btn2Motion>: start-extend()\n\ ~Ctrl ~Meta <Btn2Up>: select-end(PRIMARY)\n\ ~Ctrl ~Meta <Btn3Down>: ignore()\n\ ~Ctrl ~Meta <Btn3Up>: insert-selection(CLIPBOARD,CUT_BUFFER0,PRIMARY)\n\ <Key>L8: insert-selection(CLIPBOARD,CUT_BUFFER0,PRIMARY)\n\ <Key>L6: select-extend() select-end(CLIPBOARD, CUT_BUFFER0, PRIMARY) Both of these work fine for me. ----------------------------------------------------------------- Jeremy Allison. Sun UK Hotline. ----------------------------------------------------------------- Sun don't speak for me - I don't speak for Sun. -----------------------------------------------------------------