Am Mittwoch, 3. Januar 2007 15:01 schrieb Abdelrazak Younes: > Abdelrazak Younes wrote: > > The mixing comes from the fact that cap::copySelection() fills in > > theClipboard(), independantly of the caller.
That is alright. Why do you think this should be changed? > > This patch fixes this by > > properly filling in theSelection() or theClipboard() depending on the > > argument at LFUN_COPY time. It also fills in the X Selection at mouse > > release time instead of mouse press time which is obviously correct if > > we want to be able to use the X selection into other apps. > > > > I still have to fix LFUN_CUT and probably also special tabular mode but > > I want to be sure that that's what we want. > > I fixed that and I am almost sure that that's we want. I want to put > this in, objection? Yes :-( > Index: CutAndPaste.C > =================================================================== > --- CutAndPaste.C (revision 16460) > +++ CutAndPaste.C (working copy) > @@ -45,15 +45,12 @@ > > #include "support/lstrings.h" > > -#include "frontends/Clipboard.h" > - > #include <boost/tuple/tuple.hpp> > > > namespace lyx { > > using support::bformat; > -using frontend::Clipboard; > > using std::endl; > using std::for_each; > @@ -563,9 +560,6 @@ > > void copySelection(LCursor & cur) > { > - // stuff the selection onto the X clipboard, from an explicit copy request > - theClipboard().put(cur.selectionAsString(true)); > - > // this doesn't make sense, if there is no selection > if (!cur.selection()) > return; This should stay IMHO. An explicit copy request should _always_ copy to the LyX clipboard and the external one simultaniously, so it is best to stuff the external clipboard in the same function that fills the internal one. > Index: insets/insettabular.C > =================================================================== > --- insets/insettabular.C (revision 16460) > +++ insets/insettabular.C (working copy) > @@ -700,6 +700,14 @@ > break; > if (tablemode(cur)) { > finishUndo(); > + if (cmd.argument() == "selection") { > + // stuff the selection onto the X selection. > + theSelection().haveSelection(true); > + theSelection().put(cur.selectionAsString(true)); > + } > + else { > + theClipboard().put(cur.selectionAsString(true)); > + } > copySelection(cur); > } else > cell(cur.idx())->dispatch(cur, cmd); > @@ -1802,6 +1810,8 @@ Why did you introduce an argument to LFUN_COPY? LFUN_COPY should always fill the clipboard, never the X selection. The X selection should only be filled by the mouse. Therefore the changes above look wrong to me. > Index: mathed/InsetMathNest.C > =================================================================== > --- mathed/InsetMathNest.C (revision 16460) > +++ mathed/InsetMathNest.C (working copy) > @@ -51,6 +51,7 @@ > #include "support/lstrings.h" > > #include "frontends/Painter.h" > +#include "frontends/Clipboard.h" > #include "frontends/Selection.h" > > #include "funcrequest.h" > @@ -458,6 +459,16 @@ > break; > > case LFUN_COPY: > + if (!cur.selection()) > + break; > + if (cmd.argument() == "selection") { > + // stuff the selection onto the X selection. > + theSelection().haveSelection(true); > + theSelection().put(cur.selectionAsString(true)); > + } > + else { > + theClipboard().put(cur.selectionAsString(true)); > + } > copySelection(cur); > // FIXME UNICODE > cur.message(_("Copy")); wrong, see above > @@ -1218,6 +1229,8 @@ > //theSelection().put(cur.grabSelection()); > if (!cur.selection()) > cur.noUpdate(); > + > + lyx::dispatch(FuncRequest(LFUN_COPY, "selection")); > return; > } Now I see: You do want to use LFUN_COPY from within LyX, not from external requests. I don't like that, since the name is wrong for the selection (you can't copy anything explicitly to the selection, you can only fill it by selecting something), and you can do the same what you do now with LFUN_COPY with a simple call of theSelection()->put(). > Index: text3.C > =================================================================== > --- text3.C (revision 16475) > +++ text3.C (working copy) > @@ -769,11 +769,27 @@ > break; > > case LFUN_CUT: > + // release the Selection. > + theSelection().haveSelection(false); > + // stuff the selection onto the system Clipboard. > + theClipboard().put(cur.selectionAsString(true)); > cutSelection(cur, true, true); > cur.message(_("Cut")); > break; I believe that cutSelection does already what you now added. Almost all of the remaining stuff looks wrong, too. Can't you simply fill the selection at the right time without touching LFUN_COPY? Georg