Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wayland only] Copying/pasting pages does not work #529

Closed
mara004 opened this issue Sep 7, 2021 · 15 comments
Closed

[Wayland only] Copying/pasting pages does not work #529

mara004 opened this issue Sep 7, 2021 · 15 comments
Milestone

Comments

@mara004
Copy link
Contributor

mara004 commented Sep 7, 2021

Description

I cannot get the "Paste as odd/even" feature to work. When I cut pages and do "Paste as even pages" or "Paste as odd pages", it simply takes no effect - no pages are pasted.

To Reproduce

Steps to reproduce the behavior:

  1. Import one or more documents
  2. Mark a group of pages
  3. Cut the pages (Ctrl+X)
  4. Focus a page, open the context menu and do Paste Special -> Paste As Odd Pages (or Paste As Even Pages )

Unfortunately there is no logging output to see what happens internally.

Expected behavior

Pages should be pasted alternatingly, so that every other page is from the cut pages of the clipboard.

Input files

I used the standard PDFStitcher test file, but the issue can be reproduced with any other PDF or images.

System and Versions

  • Current PDF Arranger from git main (7e27da2), invoked with python3 -m pdfarranger
  • pikepdf 3.0.0 from pip (though I also experienced the issue with pikepdf 2)
  • KDE Neon User (based on Ubuntu Focal 20.04) with Plasma Wayland

This issue is a follow-up to #526, as suggested by @kbengs and @dreua (#526 (comment)).
I think @camlafit is affected too, maybe they can provide additional information.

@jeromerobert
Copy link
Member

I cannot reproduce it. My pikepdf version is 1.17.3 but pikepdf is not used at all here.

The code reponsible for this feature is:
https://github.com/pdfarranger/pdfarranger/blob/7e27da2/pdfarranger/pdfarranger.py#L1229-L1256
https://github.com/pdfarranger/pdfarranger/blob/7e27da2/pdfarranger/pdfarranger.py#L1156-L1181

Could you try to add some print() here to find what's going on. I would start by printing data in paste_pages_interleave.

@mara004

This comment has been minimized.

@mara004
Copy link
Contributor Author

mara004 commented Sep 7, 2021

Ah, I found something out: data is None, so it instantly returns. As it's related to clipboards, maybe it could be a Wayland-specific issue?

@mara004
Copy link
Contributor Author

mara004 commented Sep 7, 2021

Yep it's Wayland exclusive. I just ran GDK_BACKEND=x11 python3 -m pdfarranger and there it works.

@mara004 mara004 changed the title "Paste as odd/even" feature is defunct [Wayland only] "Paste as odd/even" feature is defunct Sep 7, 2021
@mara004 mara004 changed the title [Wayland only] "Paste as odd/even" feature is defunct [Wayland only] "Paste as odd/even" feature not working Sep 7, 2021
@jeromerobert
Copy link
Member

@jeromerobert
Copy link
Member

I would expect all clipboard based feature to be broken, not only paste as odd/even.

@mara004
Copy link
Contributor Author

mara004 commented Sep 7, 2021

I would expect all clipboard based feature to be broken, not only paste as odd/even.

Yeah, paste odd/even was just the only one I tried.
So I think we can only wait until the issue is addressed upstream, and recommend Wayland users to run pdfarranger as XWayland instance for a workaround.
By the way: since it's upstream you can remove the milestone.

@mara004
Copy link
Contributor Author

mara004 commented Sep 7, 2021

@camlafit Are you using Wayland, too?

@dreua
Copy link
Member

dreua commented Sep 7, 2021

Every now and then I give Wayland a try, a few days later stuff like this start biting me, I report a bug and go back to X11. I'm tempted to say it's not ready for production, but I probably shouldn't do that.

@mara004 just to make sure I get this right: Copy/Paste does not work at all, not even adding a PDF file from the file system (e.g. copy from nautilus)?
Could you try other Python+Gtk applications e.g. Meld or Zim whether their clipboards work on wayland?

@camlafit
Copy link

camlafit commented Sep 8, 2021

Hello

@mara004 I confirm this behavior. I use debian 11 with wayland and gnome-shell.

Move from nautilus to pdfarranger work but not copy/paste. To note copy/paste in nautilus works.
copy/pate text from gedit to meld works (and vice versa also)

@mara004
Copy link
Contributor Author

mara004 commented Sep 8, 2021

Every now and then I give Wayland a try, a few days later stuff like this start biting me, I report a bug and go back to
X11. I'm tempted to say it's not ready for production, but I probably shouldn't do that.

Plasma Wayland itself is quite stable, and I actually prefer it over Plasma X11 because there's no flickering. (And there are more advantages, like better HiDPI support.) However, indeed a lot of issues exist with specific apps that probably need to be fixed on a case-by-case basis. For me, the best solution currently is to use the Wayland session and resort to XWayland with apps that have issues.

just to make sure I get this right: Copy/Paste does not work at all, not even adding a PDF file from the file system
(e.g. copy from nautilus)?
Could you try other Python+Gtk applications e.g. Meld or Zim whether their clipboards work on wayland?

I can confirm the observations made by @camlafit:

  • Internal copy/paste in PDF Arranger does not work
  • Dragging and dropping a file from Dolphin does work, though
  • In Meld, copying/pasting text works correctly (system clipboard interaction)

I'd guess that it's a more difficult case for PDF Arranger since we're not just copying/pasting texts, but special objects in an internal clipboard.

@mara004 mara004 changed the title [Wayland only] "Paste as odd/even" feature not working [Wayland only] Copying/pasting pages does not work Sep 8, 2021
@mara004
Copy link
Contributor Author

mara004 commented Sep 8, 2021

By the way: When running pdfarranger from source with python3 -m pdfarranger on Wayland, the icon is missing. On XWayland/X11 the icon appears correctly, though. Should I open a separate bug report about this?

@jeromerobert
Copy link
Member

Should I open a separate bug report about this?

No. There are many things that do not work properly when pdfarranger is not installed with pip (translations, command line help, ...). I do not concider that as bugs, just something that developers should keep in mind.

@mara004
Copy link
Contributor Author

mara004 commented Sep 8, 2021

Ok, thanks you for clarifying this. I just asked because the KDE guys usually want separate bug reports for everything :)
Command-line help works for me, though.

@jeromerobert jeromerobert removed this from the 1.8.0 milestone Sep 8, 2021
@kbengs
Copy link
Member

kbengs commented Sep 9, 2021

It looks like wayland don't support "arbitrary named clipboards"
https://bugzilla.gnome.org/show_bug.cgi?id=770333

So _SELECTION_PDFARRANGER does not work. Normal clipboard works. So it would be possible to fix this issue by using normal clipboard (same way as Windows does). I guess we should do that.

kbengs added a commit to kbengs/pdfarranger that referenced this issue Sep 9, 2021
It is necessary because Wayland doesn't support arbitrary named clipboards.
Close pdfarranger#529
kbengs added a commit to kbengs/pdfarranger that referenced this issue Sep 11, 2021
It is necessary because Wayland doesn't support arbitrary named clipboards.
Close pdfarranger#529
@jeromerobert jeromerobert added this to the 1.8.0 milestone Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants