This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix to stop xwinclip from clobbering remote clipboard


Ãyvind,

Ãyvind Harboe wrote:

I'm going out on a limb here, as my experience with xfree86 is extremely
limited. Perhaps there is an option to achieve what I'm suggesting here.

Oh well! :-)

xwinclip is clobbering the clipboard when I work w/e.g. OpenOffice:

- If I copy and paste a spreadsheet cell while xwinclip is running, only
the value is copied.
- If xwinclip is not running, I can copy and paste formulas without
problems.

Yes, that is a valid problem.


AFAICT, xwinclip clobbers the remote clipboard by doing a "conversion
round-trip": remote clipboard->windows clipboard->remote clipboard. Such
round trip conversions are inheritely lossy and should be avoided.

After examining the source code(see below), I've come up with the
following "scheme" for a fix:

- register a new dummy windows clipboard data type, e.g. named
"REMOTEDATA".
- whenever xwinclip updates the Windows clipboard, it also invokes
SetClipboardData(REMOTEDATA, dummyval).
- whenever xwinclip executes a paste from the Windows clipboard to e.g.
an OpenOffice spreadsheet not running under Windows, xwinclip first
checks if REMOTEDATA is present in the Windows clipboard. If the flag is
present, xwinclip effectively needs to do nothing because the remote
clipboard already contains the correct data.

No, that scheme does not work.


The problem is that we have to grab ownership of the X clipboard each time that either the X clipboard or the Windows clipboard changes. So, we can't even attempt your idea because it requires that the original provider of the X clipboard data still be around when the request comes to paste that data; by grabbing ownership of the clipboard we tell that X app to dump the data to us in a single format. This essentially means that OpenOffice no longer knows that it put in the clipboard; we have to tell it.

Your idea is part of what we will do when we use the XFIXES extension to monitor changes to the clipboard instead of stealing ownership of the clipboar each time another application changes it. I wrote the code a while back to work with the XFIXES extension but it was never completely finished. Maybe I will get to it soon.

Harold


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]