public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* Fix to stop xwinclip from clobbering remote clipboard
@ 2003-12-23 18:26 Øyvind Harboe
  2003-12-23 19:02 ` Kensuke Matsuzaki
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Øyvind Harboe @ 2003-12-23 18:26 UTC (permalink / raw)
  To: cygwin-xfree

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.

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.


http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xwin/winclipboardxevents.c


Øyvind



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix to stop xwinclip from clobbering remote clipboard
  2003-12-23 18:26 Fix to stop xwinclip from clobbering remote clipboard Øyvind Harboe
@ 2003-12-23 19:02 ` Kensuke Matsuzaki
  2003-12-23 19:18 ` Harold L Hunt II
  2004-01-05 10:34 ` Hr. Daniel Mikkelsen
  2 siblings, 0 replies; 5+ messages in thread
From: Kensuke Matsuzaki @ 2003-12-23 19:02 UTC (permalink / raw)
  To: cygwin-xfree

Øyvind,

The reason why non-text clipboard contents is lost is not that.
To know windows clipboard change or not, you can use
SetClipboardViewer and WM_DRAWCLIPBOARD.

xwinclip clime CLIPBOARD ownership, but xwinclip can handle only XA_STRING,
UTF8_STRING and COMPOUND_TEXT.
xwinclip must hold all target to avoid clobbering X clipboard contents.

GNOME Clipboard Manager seems to do those well.
Perhaps their documents and code will help you.

By the way, latest code is here.
http://pdx.freedesktop.org/cgi-bin/viewcvs.cgi/xc/programs/Xserver/hw/xwin/winclipboardxevents.c?cvsroot=xorg&only_with_tag=CYGWIN&sortby=date

-- 
Kensuke Matsuzaki
mailto:zakki@peppermint.jp
http://peppermint.jp


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix to stop xwinclip from clobbering remote clipboard
  2003-12-23 18:26 Fix to stop xwinclip from clobbering remote clipboard Øyvind Harboe
  2003-12-23 19:02 ` Kensuke Matsuzaki
@ 2003-12-23 19:18 ` Harold L Hunt II
  2004-01-05 10:34 ` Hr. Daniel Mikkelsen
  2 siblings, 0 replies; 5+ messages in thread
From: Harold L Hunt II @ 2003-12-23 19:18 UTC (permalink / raw)
  To: cygwin-xfree

Ø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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix to stop xwinclip from clobbering remote clipboard
  2003-12-23 18:26 Fix to stop xwinclip from clobbering remote clipboard Øyvind Harboe
  2003-12-23 19:02 ` Kensuke Matsuzaki
  2003-12-23 19:18 ` Harold L Hunt II
@ 2004-01-05 10:34 ` Hr. Daniel Mikkelsen
  2004-01-05 19:20   ` Harold L Hunt II
  2 siblings, 1 reply; 5+ messages in thread
From: Hr. Daniel Mikkelsen @ 2004-01-05 10:34 UTC (permalink / raw)
  To: Øyvind Harboe; +Cc: cygwin-xfree

On Tue, 23 Dec 2003, Ø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.

Did you ever find out of that strange unicode-problem when copying from
OpenOffice? The "\x023" problem.

-- Daniel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix to stop xwinclip from clobbering remote clipboard
  2004-01-05 10:34 ` Hr. Daniel Mikkelsen
@ 2004-01-05 19:20   ` Harold L Hunt II
  0 siblings, 0 replies; 5+ messages in thread
From: Harold L Hunt II @ 2004-01-05 19:20 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: Øyvind Harboe

Daniel,

Hr. Daniel Mikkelsen wrote:
> On Tue, 23 Dec 2003, Ø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.
> 
> 
> Did you ever find out of that strange unicode-problem when copying from
> OpenOffice? The "\x023" problem.

If it was a problem due to the fact that the OpenOffice (X11, right) 
text got copied to Windows, then back to X11, then that should no longer 
be a problem in XFree86-xserv-4.3.0-31 since round-tripping has been 
eliminated.

Harold


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-05 19:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-23 18:26 Fix to stop xwinclip from clobbering remote clipboard Øyvind Harboe
2003-12-23 19:02 ` Kensuke Matsuzaki
2003-12-23 19:18 ` Harold L Hunt II
2004-01-05 10:34 ` Hr. Daniel Mikkelsen
2004-01-05 19:20   ` Harold L Hunt II

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).