Pharo and X11 primary selection (aka middle mouse button paste)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Pharo and X11 primary selection (aka middle mouse button paste)

Pieter Nagel-3
Our team is very frustrated with figuring out how copy & paste is supposed
to work in Pharo 3 under X11.

Maybe there's something we misunderstand, or can configure?

We can't copy and paste text directly from other X11 apps into Pharo. We
need to first paste the text into text editors like GEdit or XEmacs, and
then we can copy and paste the text from there into Pharo.

I think this has something to do with X11's complicated model of primary
vs. clipboard selection. The primary selection is typically created by
just highlighting some text, and then (by common convention) can be pasted
from by just pressing the middle mouse button. The clipboard selection is
typically created by explicitly using Copy or Cut commands.

Strange thing is, if we start with text in (for example) Google Chrome,
then neither type of selection can be pasted into Pharo. If we start with
text in (for example) GEdit, then both types of selection can be pasted
into Pharo.

We're using Unity under Ubuntu 12.04, if that makes a difference.

Advice?

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: Pharo and X11 primary selection (aka middle mouse button paste)

Peter Uhnak
Hi,

try setting the encoding of pharo to unicode when launching from command line and see if that fixes your problem:
--textenc UTF-8

The default encoding is not unicode which messes pasting from some applications (e.g. Google Chrome 35+).
As far as middle mouse button pasting goes I do not believe Pharo supports it - at least I haven't found any code related to it (although I would love to have this functionality).

Peter

On Tue, Jan 20, 2015 at 2:58 PM, Pieter Nagel <[hidden email]> wrote:
Our team is very frustrated with figuring out how copy & paste is supposed
to work in Pharo 3 under X11.

Maybe there's something we misunderstand, or can configure?

We can't copy and paste text directly from other X11 apps into Pharo. We
need to first paste the text into text editors like GEdit or XEmacs, and
then we can copy and paste the text from there into Pharo.

I think this has something to do with X11's complicated model of primary
vs. clipboard selection. The primary selection is typically created by
just highlighting some text, and then (by common convention) can be pasted
from by just pressing the middle mouse button. The clipboard selection is
typically created by explicitly using Copy or Cut commands.

Strange thing is, if we start with text in (for example) Google Chrome,
then neither type of selection can be pasted into Pharo. If we start with
text in (for example) GEdit, then both types of selection can be pasted
into Pharo.

We're using Unity under Ubuntu 12.04, if that makes a difference.

Advice?

Thanks.



Reply | Threaded
Open this post in threaded view
|

Re: Pharo and X11 primary selection (aka middle mouse button paste)

Pieter Nagel-3
Hi,

Thanks very much - "--textenc UTF-8" works for us!

For the sake of others with the same issue reading this in the archives, I
just want to be pedantic and  point out that I doubt "--textenc UTF-8" is
some magic panacea that will work for all systems.

The issue seems to be that the encoding Pharo uses should match that of
the surrounding system, which, for us, happens to be UTF-8 but could be
different for others.

I was a bit sloppy when I spoke of "middle button paste". I don't mean
that the Pharo's paste command should be bound to the middle mouse button.
I meant that Pharo should be able to paste the type of X11 selection
(primary selection) that some other apps like terminals traditionally
paste when you press the middle button.

And that is still not implemented: I need to explicitly press "Copy" in
Chrome before it is pasted to Pharo, just highlighting the text does not
work.

> Hi,
>
> try setting the encoding of pharo to unicode when launching from command
> line and see if that fixes your problem:
> --textenc UTF-8
>
> The default encoding is not unicode which messes pasting from some
> applications (e.g. Google Chrome 35+).
> As far as middle mouse button pasting goes I do not believe Pharo supports
> it - at least I haven't found any code related to it (although I would
> love
> to have this functionality).
>
> Peter
>
> On Tue, Jan 20, 2015 at 2:58 PM, Pieter Nagel <[hidden email]> wrote:
>
>> Our team is very frustrated with figuring out how copy & paste is
>> supposed
>> to work in Pharo 3 under X11.
>>
>> Maybe there's something we misunderstand, or can configure?
>>
>> We can't copy and paste text directly from other X11 apps into Pharo. We
>> need to first paste the text into text editors like GEdit or XEmacs, and
>> then we can copy and paste the text from there into Pharo.
>>
>> I think this has something to do with X11's complicated model of primary
>> vs. clipboard selection. The primary selection is typically created by
>> just highlighting some text, and then (by common convention) can be
>> pasted
>> from by just pressing the middle mouse button. The clipboard selection
>> is
>> typically created by explicitly using Copy or Cut commands.
>>
>> Strange thing is, if we start with text in (for example) Google Chrome,
>> then neither type of selection can be pasted into Pharo. If we start
>> with
>> text in (for example) GEdit, then both types of selection can be pasted
>> into Pharo.
>>
>> We're using Unity under Ubuntu 12.04, if that makes a difference.
>>
>> Advice?
>>
>> Thanks.
>>
>>
>>
>



Reply | Threaded
Open this post in threaded view
|

Re: Pharo and X11 primary selection (aka middle mouse button paste)

Peter Uhnak
Hi,

there are several things at play here as far as I was able to find out.

I was researching this issue when I was frustrated with pasting from Chrome and was able to figure at out at least a temporarily solution.
I also opened an issue today, however I'm not familiar with VM so I cannot conclusively say what is correct.  https://pharo.fogbugz.com/f/cases/14759/Linux-X11-VM-default-encoding-should-be-unicode 

As far as middle mouse pasting goes there are two sides of it:
1. Does Pharo VM (C-side) support it?
2. Does Pharo (Smalltalk-side) support it?

I believe the answer to the first one is yes, the code does make mentions of primary selection, however the code is quite complex for me (my investigation was pretty much trial & error)...

However the answer to second one is probably not, at least I was not able to find any bindings between middle mouse button and pasting - but again, I'm not familiar with Pharo internals.
I could open an issue for this also, however considering the code is quite old (years) and nobody fixed it yet, nobody seems to be really bothered by it. I for example prefer ctrl+c clipboard selection over middle mouse primary selection, but if you have the knowledge to fix this (which I don't have), then feel free. :)

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Pharo and X11 primary selection (aka middle mouse button paste)

stepharo
Please add an issue.
We are concerned about shortcut management.
But the VM sometimes does not provide the correct information :(
We hope that the SDL layer will help us simplifying this problem.

> Hi,
>
> there are several things at play here as far as I was able to find out.
>
> I was researching this issue when I was frustrated with pasting from
> Chrome and was able to figure at out at least a temporarily solution.
> Here's my original post
> http://forum.world.st/Re-Copy-past-doesn-t-work-sometimes-in-Chrome-semifixed-td4784604.html
> I also opened an issue today, however I'm not familiar with VM so I
> cannot conclusively say what is correct.
> https://pharo.fogbugz.com/f/cases/14759/Linux-X11-VM-default-encoding-should-be-unicode 
>
>
> As far as middle mouse pasting goes there are two sides of it:
> 1. Does Pharo VM (C-side) support it?
> 2. Does Pharo (Smalltalk-side) support it?
>
> I believe the answer to the first one is yes, the code does make
> mentions of primary selection, however the code is quite complex for
> me (my investigation was pretty much trial & error)...
> https://github.com/pharo-project/pharo-vm/blob/master/platforms/unix/vm-display-X11/sqUnixX11.c
>
> However the answer to second one is probably not, at least I was not
> able to find any bindings between middle mouse button and pasting -
> but again, I'm not familiar with Pharo internals.
> I could open an issue for this also, however considering the code is
> quite old (years) and nobody fixed it yet, nobody seems to be really
> bothered by it. I for example prefer ctrl+c clipboard selection over
> middle mouse primary selection, but if you have the knowledge to fix
> this (which I don't have), then feel free. :)
>
> Peter


Reply | Threaded
Open this post in threaded view
|

Re: Pharo and X11 primary selection (aka middle mouse button paste)

stepharo
In reply to this post by Pieter Nagel-3
Hi pieter
> Hi,
>
> Thanks very much - "--textenc UTF-8" works for us!
>
> For the sake of others with the same issue reading this in the archives, I
> just want to be pedantic and  point out that I doubt "--textenc UTF-8" is
> some magic panacea that will work for all systems.
Obviously.
Pieter do you really think that we are satisfied with the situation?
No certainly not. Now do you imagine the huge todo we have?

If your team is using Pharo then it may be good to think that this is
also your system
and you can help you and us.

> The issue seems to be that the encoding Pharo uses should match that of
> the surrounding system, which, for us, happens to be UTF-8 but could be
> different for others.
Indeed.
> I was a bit sloppy when I spoke of "middle button paste". I don't mean
> that the Pharo's paste command should be bound to the middle mouse button.
> I meant that Pharo should be able to paste the type of X11 selection
> (primary selection) that some other apps like terminals traditionally
> paste when you press the middle button.
We started to add SDL and we should do a large pass on the events in the
future.
But time is scarced

>
> And that is still not implemented: I need to explicitly press "Copy" in
> Chrome before it is pasted to Pharo, just highlighting the text does not
> work.
>
>> Hi,
>>
>> try setting the encoding of pharo to unicode when launching from command
>> line and see if that fixes your problem:
>> --textenc UTF-8
>>
>> The default encoding is not unicode which messes pasting from some
>> applications (e.g. Google Chrome 35+).
>> As far as middle mouse button pasting goes I do not believe Pharo supports
>> it - at least I haven't found any code related to it (although I would
>> love
>> to have this functionality).
>>
>> Peter
>>
>> On Tue, Jan 20, 2015 at 2:58 PM, Pieter Nagel <[hidden email]> wrote:
>>
>>> Our team is very frustrated with figuring out how copy & paste is
>>> supposed
>>> to work in Pharo 3 under X11.
>>>
>>> Maybe there's something we misunderstand, or can configure?
>>>
>>> We can't copy and paste text directly from other X11 apps into Pharo. We
>>> need to first paste the text into text editors like GEdit or XEmacs, and
>>> then we can copy and paste the text from there into Pharo.
>>>
>>> I think this has something to do with X11's complicated model of primary
>>> vs. clipboard selection. The primary selection is typically created by
>>> just highlighting some text, and then (by common convention) can be
>>> pasted
>>> from by just pressing the middle mouse button. The clipboard selection
>>> is
>>> typically created by explicitly using Copy or Cut commands.
>>>
>>> Strange thing is, if we start with text in (for example) Google Chrome,
>>> then neither type of selection can be pasted into Pharo. If we start
>>> with
>>> text in (for example) GEdit, then both types of selection can be pasted
>>> into Pharo.
>>>
>>> We're using Unity under Ubuntu 12.04, if that makes a difference.
>>>
>>> Advice?
>>>
>>> Thanks.
>>>
>>>
>>>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Pharo and X11 primary selection (aka middle mouse button paste)

Peter Uhnak
In reply to this post by stepharo