public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* Is Cygwin X server causing ubuntu eclipse to copy to the clipboard on selection?
@ 2012-06-22 23:33 David Karr
  2012-06-25 13:22 ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: David Karr @ 2012-06-22 23:33 UTC (permalink / raw)
  To: cygwin-xfree

I run Eclipse on win7, and also Eclipse on Ubuntu, displaying the
window on my Win7 box, using Cygwin.

One annoyance I have with the latter is that when I select a region of
text, it appears to automatically copy that region to the clipboard,
instead of waiting for me to press Ctrl-C.

I asked about this on the eclipse forums, and they said Ubuntu Eclipse
doesn't do this, and it's likely being done by my X server.

I checked the Cygwin-X11 FAQ and the command-line options, and I don't
see anything that specifies this.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


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

* Re: Is Cygwin X server causing ubuntu eclipse to copy to the clipboard on selection?
  2012-06-22 23:33 Is Cygwin X server causing ubuntu eclipse to copy to the clipboard on selection? David Karr
@ 2012-06-25 13:22 ` Jon TURNEY
  2012-06-25 15:54   ` David Karr
  0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2012-06-25 13:22 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: davidmichaelkarr

On 23/06/2012 00:33, David Karr wrote:
> I run Eclipse on win7, and also Eclipse on Ubuntu, displaying the
> window on my Win7 box, using Cygwin.
> 
> One annoyance I have with the latter is that when I select a region of
> text, it appears to automatically copy that region to the clipboard,
> instead of waiting for me to press Ctrl-C.
> 
> I asked about this on the eclipse forums, and they said Ubuntu Eclipse
> doesn't do this, and it's likely being done by my X server.

Yes, the X server is copying the selected text to the Windows clipboard.

Let me try to explain why:

X supports an arbitrary number of 'selections', the two of interest here are
the PRIMARY selection (which conventionally contains some data which the user
has selected) and the CLIPBOARD selection (which conventionally contains some
data that the user has explicitly requested to be 'copied' to the clipboard)

The Cygwin X server monitors these selections for changes, and makes text in
the most recently changed one available for pasting from the Windows clipboard.

So, if you select some text in eclipse after copying some text to the
clipboard, you will get the selected text, not the copied text, when you paste
in Windows.

I can understand this behaviour is confusing to people who are expecting the X
clipboard to behave like the Windows one.

It has been suggested a few times that we should not monitor the PRIMARY
selection, but some very popular X applications (such as xterm and emacs) only
use the PRIMARY selection by default.  It's also been suggested that
monitoring the PRIMARY selection should be configurable somehow, but I'm not
sure that a global configuration option would lead to very useful behaviour.

As always, patches welcome :-)

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


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

* Re: Is Cygwin X server causing ubuntu eclipse to copy to the clipboard on selection?
  2012-06-25 13:22 ` Jon TURNEY
@ 2012-06-25 15:54   ` David Karr
  2012-06-28 14:49     ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: David Karr @ 2012-06-25 15:54 UTC (permalink / raw)
  To: cygwin-xfree

On Mon, Jun 25, 2012 at 6:22 AM, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
> On 23/06/2012 00:33, David Karr wrote:
>> I run Eclipse on win7, and also Eclipse on Ubuntu, displaying the
>> window on my Win7 box, using Cygwin.
>>
>> One annoyance I have with the latter is that when I select a region of
>> text, it appears to automatically copy that region to the clipboard,
>> instead of waiting for me to press Ctrl-C.
>>
>> I asked about this on the eclipse forums, and they said Ubuntu Eclipse
>> doesn't do this, and it's likely being done by my X server.
>
> Yes, the X server is copying the selected text to the Windows clipboard.
>
> Let me try to explain why:
>
> X supports an arbitrary number of 'selections', the two of interest here are
> the PRIMARY selection (which conventionally contains some data which the user
> has selected) and the CLIPBOARD selection (which conventionally contains some
> data that the user has explicitly requested to be 'copied' to the clipboard)
>
> The Cygwin X server monitors these selections for changes, and makes text in
> the most recently changed one available for pasting from the Windows clipboard.

It seems like you've just explained to me by using the word
"conventionally" that the behavior of the Cygwin X server doesn't
behave "conventionally".

> So, if you select some text in eclipse after copying some text to the
> clipboard, you will get the selected text, not the copied text, when you paste
> in Windows.
>
> I can understand this behaviour is confusing to people who are expecting the X
> clipboard to behave like the Windows one.
>
> It has been suggested a few times that we should not monitor the PRIMARY
> selection, but some very popular X applications (such as xterm and emacs) only
> use the PRIMARY selection by default.  It's also been suggested that
> monitoring the PRIMARY selection should be configurable somehow, but I'm not
> sure that a global configuration option would lead to very useful behaviour.

I just verified that I can easily configure Emacs to not copy to the
clipboard on selection, and to replace the selection on yank.  It's
unfortunate that I can't directly configure Eclipse to do this, but I
would be surprised if they would have thought to implement this, as
Eclipse normally works "the way you expect" on both Ubuntu and
Windows.  It's only when displaying the Ubuntu window on Windows
through Cygwin that it behaves "unconventionally".

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


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

* Re: Is Cygwin X server causing ubuntu eclipse to copy to the clipboard on selection?
  2012-06-25 15:54   ` David Karr
@ 2012-06-28 14:49     ` Jon TURNEY
  2012-06-28 16:10       ` David Karr
  0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2012-06-28 14:49 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: davidmichaelkarr

On 25/06/2012 16:53, David Karr wrote:
> On Mon, Jun 25, 2012 at 6:22 AM, Jon TURNEY wrote:
>> On 23/06/2012 00:33, David Karr wrote:
>>> I run Eclipse on win7, and also Eclipse on Ubuntu, displaying the
>>> window on my Win7 box, using Cygwin.
>>>
>>> One annoyance I have with the latter is that when I select a region of
>>> text, it appears to automatically copy that region to the clipboard,
>>> instead of waiting for me to press Ctrl-C.
>>>
>>> I asked about this on the eclipse forums, and they said Ubuntu Eclipse
>>> doesn't do this, and it's likely being done by my X server.
>>
>> Yes, the X server is copying the selected text to the Windows clipboard.
>>
>> Let me try to explain why:
>>
>> X supports an arbitrary number of 'selections', the two of interest here are
>> the PRIMARY selection (which conventionally contains some data which the user
>> has selected) and the CLIPBOARD selection (which conventionally contains some
>> data that the user has explicitly requested to be 'copied' to the clipboard)
>>
>> The Cygwin X server monitors these selections for changes, and makes text in
>> the most recently changed one available for pasting from the Windows clipboard.
> 
> It seems like you've just explained to me by using the word
> "conventionally" that the behaviour of the Cygwin X server doesn't
> behave "conventionally".

Sorry, no.

I am using "conventionally" here in the sense of "for an application which
conforms to the X 'Inter-Client Communication Conventions Manual' [1]"

The Cygwin X server (or rather, it's built-in clipboard client which
integrates with the native Windows clipboard) conforms to these conventions.
It would be a bug in that client if it was altering the X CLIPBOARD selection
when the PRIMARY selection is changed.

I don't think that is happening, but you don't have to take my word for the
contents of these selections, you can examine them for yourself using 'xsel
-p' and 'xsel -b'.

The question you are asking ("Is Cygwin X server causing ubuntu eclipse to
copy to the clipboard on selection?") doesn't distinguish between the Windows
clipboard and the X clipboard.  I assume that the problem you are reporting is
with pasting to a Windows application.

To reiterate, the clipboard integration client adopts a simple heuristic to
determine which of the PRIMARY or CLIPBOARD X selections to place in the
Windows clipboard: it uses the most recently changed one [2]

I agree it would be nice if this behaved more in line with user expectations
in this specific case.  Ideally this would be achieved by improving this
heuristic somehow, rather than adding another command line option.

So, again, this is acknowledged as something which could be improved, the
problem is understood, but "someone has to do it".

>> So, if you select some text in eclipse after copying some text to the
>> clipboard, you will get the selected text, not the copied text, when you paste
>> in Windows.
>>
>> I can understand this behaviour is confusing to people who are expecting the X
>> clipboard to behave like the Windows one.
>>
>> It has been suggested a few times that we should not monitor the PRIMARY
>> selection, but some very popular X applications (such as xterm and emacs) only
>> use the PRIMARY selection by default.  It's also been suggested that
>> monitoring the PRIMARY selection should be configurable somehow, but I'm not
>> sure that a global configuration option would lead to very useful behaviour.
> 
> I just verified that I can easily configure Emacs to not copy to the
> clipboard on selection, and to replace the selection on yank.  It's
> unfortunate that I can't directly configure Eclipse to do this, but I
> would be surprised if they would have thought to implement this, as
> Eclipse normally works "the way you expect" on both Ubuntu and
> Windows.  It's only when displaying the Ubuntu window on Windows
> through Cygwin that it behaves "unconventionally".

I'm not sure what you are suggesting here, but changing the default behaviour
of the Cygwin X server so it requires everyone who uses it to reconfigure
their emacs is not an acceptable solution.

[1] http://www.x.org/releases/current/doc/xorg-docs/icccm/icccm.html
[2] I slightly simplify here.  The XFIXES extension only allows monitoring for
changes of selection ownership, only the application owning a selection knows
when it changes.  This can cause other problems, see
https://bugs.freedesktop.org/show_bug.cgi?id=5735

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


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

* Re: Is Cygwin X server causing ubuntu eclipse to copy to the clipboard on selection?
  2012-06-28 14:49     ` Jon TURNEY
@ 2012-06-28 16:10       ` David Karr
  0 siblings, 0 replies; 5+ messages in thread
From: David Karr @ 2012-06-28 16:10 UTC (permalink / raw)
  To: cygwin-xfree

On Thu, Jun 28, 2012 at 7:49 AM, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
> On 25/06/2012 16:53, David Karr wrote:
>> I just verified that I can easily configure Emacs to not copy to the
>> clipboard on selection, and to replace the selection on yank.  It's
>> unfortunate that I can't directly configure Eclipse to do this, but I
>> would be surprised if they would have thought to implement this, as
>> Eclipse normally works "the way you expect" on both Ubuntu and
>> Windows.  It's only when displaying the Ubuntu window on Windows
>> through Cygwin that it behaves "unconventionally".
>
> I'm not sure what you are suggesting here, but changing the default behaviour
> of the Cygwin X server so it requires everyone who uses it to reconfigure
> their emacs is not an acceptable solution.

Certainly not.  It was just an observation.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


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

end of thread, other threads:[~2012-06-28 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-22 23:33 Is Cygwin X server causing ubuntu eclipse to copy to the clipboard on selection? David Karr
2012-06-25 13:22 ` Jon TURNEY
2012-06-25 15:54   ` David Karr
2012-06-28 14:49     ` Jon TURNEY
2012-06-28 16:10       ` David Karr

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).