diodon fails to remember calling window

Bug #1995826 reported by C. Jeffery Small
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Diodon
Confirmed
Undecided
Unassigned

Bug Description

Xubuntu 22.04.1
diodon 1.12.0-1 from the standard Ubuntu repository

I installed diodon to replace xfce4-clipman which has been seriously broken since thew upgrade to Xubuntu 22.04.1.

There are two issues:

1) A minor point, but there is a noticeable delay between making a menu selection and having it paste. This may or may not have something to do with the next more serious issue.

2) I have focus-follows-mouse enabled. When I pop-up the diodon menu using a keyboard shortcut, if the menu is completely within the target window frame, there is no problem. However, if the pop-up menu extends outside the window frame and overlaps another one, then if a menu selection is made that falls outside the target window, the other window becomes active and diodon pastes the selection into the wrong location.

To simulate this, open multiple adjacent terminals. In one terminal open the diodon pop-up so that it extends over an adjacent terminal. Select an entry where the cursor is above the adjacent terminal. While doing this, the target terminal remains active. However, when the diodon menu is dismissed the adjacent terminal immediately receives focus and the selection is pasted there rather than to the desired terminal.

Diodon needs to register which window is active when it is initiated and make sure that that window has focus when the paste occurs.

This problem did not occur with xfce4-clipman back under Xubuntu 20.04.

Revision history for this message
Oliver Sauder (sao) wrote :

Thanks for your report.

I have also checked the xfce4-clipman code how they simulate paste and they do it the same as in Diodon using the XTest library. There is a delay there before instant pasting (your first point) as pasting does not work under some circumstances when the paste executes too fast.

I briefly want to explain how the instant paste works and that might make the situation a bit clearer. So Diodon uses XTest so simulate pressing of Ctrl+V. It is like if just after you selected an item in the history you would straight away press Ctrl+V on your keyboard. It is not possible to simulate key presses to a certain window so it will simply be pasted to the window which has the focus.

Why it might have worked in xfce4-clipman is that they use a different delay. Thing is, though, if the delay in diodon is adjusted it might not work in other setups which have worked previously.

Also, Xorg is less and less relevant and in Wayland “Instant Paste” simply does not work anymore, as there is no such functionality to simulate key presses in a window not belonging to Diodon for security restrictions.

This said, I see three ways forward:

1. You disable automatically paste selected item in the Diodon preferences
2. You disable “focus-follows-mouse” option in XFCE
3. You try to play around the delay in https://github.com/diodon-dev/diodon/blob/589c190b5e616677585493a31c5fe115c0a17430/libdiodon/controller.vala#L296 How to build Diodon you can find in the README.md. If you find a delay which works in your setup, let me know.

Revision history for this message
C. Jeffery Small (loyhz2ay-jeff-h670zbts) wrote :

Oliver:

I uninstalled the Ubuntu diodon package, downloaded the source and built it from scratch. I logged out/in to make sure that the current build was being used. I have adjusted line 296:

Utility.perform_key_event(key, true, 0);

in various increments all the way down to zero. However, in no case can I get diodon to paste into the calling window under the above cases. Clipman currently builds a menu of selections, but it will only pasted the last selection (what is in the B2 paste buffer) rather than the selected items. Despite that, it never fails to paste to the proper window regardless of how far out of that window the mouse pointer is located. After the clipman paste, the focus does move to the window below the cursor, but that doesn't happen until the past is complete.

I haven't done any window manager programming so I'm not sure what xfce4-clipman is doing different from diodon, but there is something going on that is different. I will run further tests if there is something to try and I hope we can pin this down.

Thanks for the reply.

Regarding Wayland -- just another negative side effect of this "improved" code. :-(

Revision history for this message
Oliver Sauder (sao) wrote :

The code bit in xfce-clipman I assume is here https://github.com/xfce-mirror/xfce4-clipman-plugin/blob/e4c86a82a541f395dc7e4afc26d832803f4167a2/panel-plugin/menu.c#L210 where the automatic paste happens.

If you find a way to fix this in a good way, it would be great if you could open a PR.

Changed in diodon:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.