GNU bug report logs - #71656
secondary selection and mouse-drag-secondary-pasting is broken in 29.3 under wayland

Previous Next

Package: emacs;

Reported by: John Heidemann <johnh <at> isi.edu>

Date: Wed, 19 Jun 2024 19:34:01 UTC

Severity: normal

To reply to this bug, email your comments to 71656 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#71656; Package emacs. (Wed, 19 Jun 2024 19:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Heidemann <johnh <at> isi.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 19 Jun 2024 19:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Heidemann <johnh <at> isi.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: secondary selection and mouse-drag-secondary-pasting is broken in
 29.3 under wayland
Date: Wed, 19 Jun 2024 12:33:04 -0700
Since Fedora 40 and emacs-29.3, mouse-drag-secondary-pasting has thrown
the error "Could not assert ownership over selection: SECONDARY".

This is in a default Fedora 40 install with the emacs-29.3-6.fc40.x86_64
package, running under Wayland.  I think F40 started using native
wayland and gtk, which perhaps lost support for secondary selections?


To reproduce:

start emacs -q

In *scratch* run:

(require 'mouse-copy)
(global-set-key [M-down-mouse-1] 'mouse-drag-secondary-pasting)

Then hold down meta and right click and drag over a word.

Expected behavior:

The text you drag over should be copied to the current location.

Actual behavior:
error "Could not assert ownership over selection: SECONDARY"
and no copying happens.


I was the original author of mouse-copy.el and I miss its easy
plan-9-like copy what I just moused over.

I'm happy to patch its code, but I'd like to know what changed so I can
know what I need to work around.


Thanks for any pointers,
   -John Heidemannp





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71656; Package emacs. (Thu, 20 Jun 2024 04:39:01 GMT) Full text and rfc822 format available.

Message #8 received at 71656 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: John Heidemann <johnh <at> isi.edu>, Po Lu <luangruo <at> yahoo.com>
Cc: 71656 <at> debbugs.gnu.org
Subject: Re: bug#71656: secondary selection and mouse-drag-secondary-pasting is
 broken in 29.3 under wayland
Date: Thu, 20 Jun 2024 07:36:34 +0300
> From: John Heidemann <johnh <at> isi.edu>
> Date: Wed, 19 Jun 2024 12:33:04 -0700
> 
> Since Fedora 40 and emacs-29.3, mouse-drag-secondary-pasting has thrown
> the error "Could not assert ownership over selection: SECONDARY".
> 
> This is in a default Fedora 40 install with the emacs-29.3-6.fc40.x86_64
> package, running under Wayland.  I think F40 started using native
> wayland and gtk, which perhaps lost support for secondary selections?
> 
> 
> To reproduce:
> 
> start emacs -q
> 
> In *scratch* run:
> 
> (require 'mouse-copy)
> (global-set-key [M-down-mouse-1] 'mouse-drag-secondary-pasting)
> 
> Then hold down meta and right click and drag over a word.
> 
> Expected behavior:
> 
> The text you drag over should be copied to the current location.
> 
> Actual behavior:
> error "Could not assert ownership over selection: SECONDARY"
> and no copying happens.
> 
> 
> I was the original author of mouse-copy.el and I miss its easy
> plan-9-like copy what I just moused over.
> 
> I'm happy to patch its code, but I'd like to know what changed so I can
> know what I need to work around.
> 
> 
> Thanks for any pointers,

Thanks.  Po Lu, can you please look into and fix this, or help John
fix it?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71656; Package emacs. (Thu, 20 Jun 2024 06:40:02 GMT) Full text and rfc822 format available.

Message #11 received at 71656 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71656 <at> debbugs.gnu.org, John Heidemann <johnh <at> isi.edu>
Subject: Re: bug#71656: secondary selection and mouse-drag-secondary-pasting
 is broken in 29.3 under wayland
Date: Thu, 20 Jun 2024 14:39:28 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: John Heidemann <johnh <at> isi.edu>
>> Date: Wed, 19 Jun 2024 12:33:04 -0700
>> 
>> Since Fedora 40 and emacs-29.3, mouse-drag-secondary-pasting has thrown
>> the error "Could not assert ownership over selection: SECONDARY".
>> 
>> This is in a default Fedora 40 install with the emacs-29.3-6.fc40.x86_64
>> package, running under Wayland.  I think F40 started using native
>> wayland and gtk, which perhaps lost support for secondary selections?
>> 
>> 
>> To reproduce:
>> 
>> start emacs -q
>> 
>> In *scratch* run:
>> 
>> (require 'mouse-copy)
>> (global-set-key [M-down-mouse-1] 'mouse-drag-secondary-pasting)
>> 
>> Then hold down meta and right click and drag over a word.
>> 
>> Expected behavior:
>> 
>> The text you drag over should be copied to the current location.
>> 
>> Actual behavior:
>> error "Could not assert ownership over selection: SECONDARY"
>> and no copying happens.
>> 
>> 
>> I was the original author of mouse-copy.el and I miss its easy
>> plan-9-like copy what I just moused over.
>> 
>> I'm happy to patch its code, but I'd like to know what changed so I can
>> know what I need to work around.
>> 
>> 
>> Thanks for any pointers,
>
> Thanks.  Po Lu, can you please look into and fix this, or help John
> fix it?

John, this error is signaled when the SECONDARY selection is not
implemented by your Wayland compositor.  I don't believe this is any
responsibility of ours, and hence your Lisp code should resort to a
different selection on PGTK systems.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71656; Package emacs. (Thu, 20 Jun 2024 20:17:02 GMT) Full text and rfc822 format available.

Message #14 received at 71656 <at> debbugs.gnu.org (full text, mbox):

From: John Heidemann <johnh <at> isi.edu>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 71656 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#71656: secondary selection and mouse-drag-secondary-pasting
 is broken in 29.3 under wayland
Date: Thu, 20 Jun 2024 13:16:01 -0700
On Thu, 20 Jun 2024 14:39:28 +0800, Po Lu wrote: 
>Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: John Heidemann <johnh <at> isi.edu>
>>> Date: Wed, 19 Jun 2024 12:33:04 -0700
>>> 
>>> Since Fedora 40 and emacs-29.3, mouse-drag-secondary-pasting has thrown
>>> the error "Could not assert ownership over selection: SECONDARY".
>>> 
>>> This is in a default Fedora 40 install with the emacs-29.3-6.fc40.x86_64
>>> package, running under Wayland.  I think F40 started using native
>>> wayland and gtk, which perhaps lost support for secondary selections?
>>> 
>>> 
>>> To reproduce:
>>> 
>>> start emacs -q
>>> 
>>> In *scratch* run:
>>> 
>>> (require 'mouse-copy)
>>> (global-set-key [M-down-mouse-1] 'mouse-drag-secondary-pasting)
>>> 
>>> Then hold down meta and right click and drag over a word.
>>> 
>>> Expected behavior:
>>> 
>>> The text you drag over should be copied to the current location.
>>> 
>>> Actual behavior:
>>> error "Could not assert ownership over selection: SECONDARY"
>>> and no copying happens.
>>> 
>>> 
>>> I was the original author of mouse-copy.el and I miss its easy
>>> plan-9-like copy what I just moused over.
>>> 
>>> I'm happy to patch its code, but I'd like to know what changed so I can
>>> know what I need to work around.
>>> 
>>> 
>>> Thanks for any pointers,
>>
>> Thanks.  Po Lu, can you please look into and fix this, or help John
>> fix it?
>
>John, this error is signaled when the SECONDARY selection is not
>implemented by your Wayland compositor.  I don't believe this is any
>responsibility of ours, and hence your Lisp code should resort to a
>different selection on PGTK systems.

Thank you.  It looks like large parts of mouse.el (all the functions
ending in -secondary) and select.el are X11-specific then and will not
work on Wayland.

It looks like there is already some work in select.el to make it ignore
primary/secondary/clipboard for windows.  Perhaps analogous code needs
to go in to Wayland, so that downstream code (such as mouse.el and
mouse-copy.el) would continue to work?

   -John




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71656; Package emacs. (Fri, 21 Jun 2024 01:35:01 GMT) Full text and rfc822 format available.

Message #17 received at 71656 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: John Heidemann <johnh <at> isi.edu>
Cc: 71656 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#71656: secondary selection and mouse-drag-secondary-pasting
 is broken in 29.3 under wayland
Date: Fri, 21 Jun 2024 09:34:35 +0800
John Heidemann <johnh <at> isi.edu> writes:

> Perhaps analogous code needs to go in to implementing that downstream
> code (such as mouse.el and mouse-copy.el) would continue to work?
>
>    -John

Patches welcome, as ever.  One difficulty I anticipate is that some GDK
backends and Wayland compositors do support SECONDARY, while one Emacs
session is capable of being connected to multiple displays providing
different repertories of selections, and even potentially implemented by
multiple GDK backends.  Another is that the existence of support for a
selection cannot be ascertained until an attempt is made to acquire
ownership of it.




This bug report was last modified 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.