Hi David,
thanks for looking into it! Unfortunately your patch does not work, though :-(
The immediate problem, that would probably fairly easy to solve is that the conversion to text does not work (p.e. xclipboard complains when I have it running in parallel.
The more fundamental problem is that the distinction between the "primary" selection and the "clipboard" selection is not clear.
I think, this needs some serious sorting out. A few-line bugfix might solve the immediate problem, but I think TeXmacs never really handled cut-and-paste conforming to any standard, so it somehow interacts slightly different with every program...
I'll look into it a bit deeper, but I have no idea whether I get anywhere before I run out of time...
Greetings,
Norbert
David Allouche wrote:
On Wed, Jan 21, 2009 at 20:02, Norbert Nemec <address@hidden> wrote:
Cut and paste certainly is confusing. I spent a few minutes sorting through
the current state of affairs, but I didn't get far.
For anyone who wants to look into it, a good starting point seems to be:
http://www.freedesktop.org/wiki/Specifications/ClipboardsWiki
I think this is the behavior TeXmacs should aim at as well. Does the current
code already try to implement this standard? In that case, it seems to be
buggy in some details, but it is hard to sort through the strange behavior
in various situations, interacting with various other clients...
Here is a tentative patch.
I could not test it because any attempt to run a from-source build of
texmacs gives me the "Fatal error: Tex seems not to be installed
properly in 'load_tex'". Of course, I have a texmacs package
installed, so I have all the runtime dependencies. Running Ubuntu
Intrepid.
At least, it compiles.
commit 95b67144572986655f73c05b57dcb1f932d033b7 Author: Norbert Nemec <address@hidden> Date: Thu Jan 22 00:37:59 2009 +0000 Correct conversion handling of X selecion. diff --git a/src/src/Plugins/X11/x_loop.cpp b/src/src/Plugins/X11/x_loop.cpp index 440dcfd..17919e3 100644 --- a/src/src/Plugins/X11/x_loop.cpp +++ b/src/src/Plugins/X11/x_loop.cpp @@ -275,26 +275,33 @@ x_gui_rep::process_event (x_window win, XEvent* ev) { } case SelectionRequest: { - bool flag=true; XSelectionRequestEvent& req= ev->xselectionrequest; - if (selection==NULL) flag=false; - if ((req.target!=AnyPropertyType) && (req.target!=XA_STRING)) flag=false; - if (flag) - XChangeProperty (dpy, req.requestor, req.property, XA_STRING, - 8, PropModeReplace, - (unsigned char*) selection, - strlen (selection)); XSelectionEvent sel; sel.type = SelectionNotify; - sel.serial = req.serial; - sel.send_event= true; - sel.display = dpy; sel.requestor = req.requestor; sel.selection = req.selection; sel.target = req.target; - sel.property = flag?req.property:None; sel.time = req.time; - XSendEvent (dpy, InputFocus, false, 0, (XEvent*) &sel); + Atom XA_TARGETS = XInternAtom(dpy, "TARGETS", False); + if (selection==NULL) + sel.property = None; + else if (req.target==XA_TARGETS) { + Atom targets[2]; + targets[0] = XA_TARGETS; + targets[1] = XA_STRING; + XChangeProperty (dpy, req.requestor, req.property, XA_ATOM, + 32, PropModeReplace, + (unsigned char*)&targets[0],2); + sel.property = req.property; + } else if ((req.target==AnyPropertyType) || (req.target==XA_STRING)) { + XChangeProperty (dpy, req.requestor, req.property, XA_STRING, + 8, PropModeReplace, + (unsigned char*) selection, + strlen (selection)); + sel.property = req.property; + } else + sel.property = None; + XSendEvent (dpy, sel.requestor, false, 0, (XEvent*) &sel); break; } case SelectionClear:
Archive powered by MHonArc 2.6.19.