Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-08-19 21:20:15

wrh1728
Member
Registered: 2020-12-15
Posts: 38

Selected text becoming unselected after a few seconds

I am running Xfce 4.16. When I select text in some window (browser, email client, terminal emulator - see below) with the mouse (keeping the left button pressed and dragging the pointer over the text to be selected)  things work as expected, in that the selected text is highlighted, copied to an internal buffer, and then I can paste the text so copied elsewhere by pressing the middle button in my mouse.

The problem that I am having is that, when using a terminal emulator (be it xfce4-terminal or xterm) the text that I select remains highlighted just  for a few seconds. The highlight then disappears on its own, without my having taken any action - even without moving the mouse. This usually takes six or seven seconds, occasionally taking as little as one second.

This whole thing seems to be circumscribed to the terminal emulators that I mentioned - for example, text selected in my browser or my email client will remain selected indefinitely, no matter how I move the mouse, until I press the left button in the mouse.

It's the first time I have noticed this when using Xfce - it never used to happen with previous versions of Xfce, and I am not even sure that it happened with my current Xfce 4.16 all along. It seems to be to do with Xfce itself, but that's just a guess.

If anybody has an idea as to what may be going on, and how to solve this problem - i.e. preventing text from getting unselected spontaneously - your feedback would be much welcome.

Offline

#2 2022-08-19 22:27:51

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,000

Re: Selected text becoming unselected after a few seconds

It really sounds like some other process is grabbing the highlight. Whats odd is that it works fine in non-terminal windows.

Here is a stackexchange answer that discuss how to create a small application to post back who has control of the clipboard. If you compile and run this, it might be able to identify what process is grabbing the highlight.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-08-19 23:21:29

wrh1728
Member
Registered: 2020-12-15
Posts: 38

Re: Selected text becoming unselected after a few seconds

Thanks. What you suggested did not provide anything immediately useful, but it made me notice something unexpected:

With ps I realized that, despite the fact that I had several xfce4-terminal instances running, I had only one xfce4-terminal process. When I killed it explicitly with kill <PID>, all of the xfce4-terminal instances got killed at the same time, including the one from which I issued the kill command.

Is this the way xfce4-terminal is supposed to work?

Offline

#4 2022-08-20 00:19:40

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,000

Re: Selected text becoming unselected after a few seconds

Yes - it has a server component that all other instances are children of. You can disable this functionality by using the "--disable-server" command line parameter.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2022-08-20 00:41:39

wrh1728
Member
Registered: 2020-12-15
Posts: 38

Re: Selected text becoming unselected after a few seconds

Thanks. Well, not exactly thrilled that such is the default behavior, but at least now I know. Anyway, this is not the root cause of the problem that I reported, for it is still there when I launch xfce4-terminal with --disable-server.

I launched two xfce4-terminal instances with --disable-server, and trying your first suggestion in one of them here's I what I got:

$ ps -fp "$(xdotool getwindowpid "$(./a.out)")"
UID        PID  PPID  C STIME TTY          TIME CMD
jca      13510 12908  0 18:26 pts/0    00:00:00 xfce4-terminal --disable-server

I repeated it a few seconds later and then I got this:

$ ps -fp "$(xdotool getwindowpid "$(./a.out)")"
window 174063696 has no pid associated with it.
error: list of process IDs must follow -p

Usage:
ps [options]

Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
for additional help text.

For more details see ps(1).

As I tried the same command several times in quick succession I would just get the "window 174063696..." output all the time. Then I did su and run the command again:

# ps -fp "$(xdotool getwindowpid "$(./a.out)")"
UID        PID  PPID  C STIME TTY          TIME CMD
jca      13330 12908  0 18:26 pts/0    00:00:00 xfce4-terminal --disable-server

I got this three times in a row. After that it was always

# ps -fp "$(xdotool getwindowpid "$(./a.out)")"
window 174063696 has no pid associated with it.
error: list of process IDs must follow -p

Usage:
ps [options]

Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
for additional help text.

For more details see ps(1).


What on earth is going on?

Offline

#6 2022-08-20 00:42:49

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 819

Re: Selected text becoming unselected after a few seconds

is it really unselected or is highlighting just taken away?  if you try to paste the buffered text, what happens?  BTW, if the process that had the text displayed which was highlighted, goes away, then it is lost.  so if X is doing the buffering, it discards the buffer if the connection to X is closed.  that or maybe the app that went away was doing the buffer (hence it is not there to deliver the buffer contents).  i would like to create a panel plugin that shows the highlighted text.  such thing may need to grab the buffer to see what's in it, which would unhighlight the selected text, if the 2nd of those methods is what is used.  i wonder if something could already be trying to do that.  i am running Xfce 4.14 (Xubuntu 20.04) so i can't see issues that show up in 4.16.

Offline

#7 2022-08-20 01:17:11

wrh1728
Member
Registered: 2020-12-15
Posts: 38

Re: Selected text becoming unselected after a few seconds

I was about to offer a detailed answer to your comments, when I found what the issue is, even if I don't understand exactly why it happens.

From a separate terminal emulator, I launched a gnuplot script that plots a bunch of data read from several different files. This script is running continuously. The thing is, these files are updated every few seconds, and the script rereads them every ten seconds. When it rereads them, it plots all the data again, in essence - I guess - recreating the window where the data points are plotted. I believe that this replotting action is what interferes with the text selection and highlighting.

That this is the cause of the problem that I am observing is a certainty, for the problem itself disappears when the script is not running. This also explains why the highlighting sometimes vanishes very quickly: that's when I happen to do the text selection immediately before the script rereads and replots the data files.

Now why on earth would gnuplot used this way interfere with the text selection and highlighting in xfce4-terminal an xterm, but not in the browser or email client applications? Do you think there is anything one could do to prevent this interference?

Offline

#8 2022-08-20 01:36:14

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 819

Re: Selected text becoming unselected after a few seconds

that kind of "interference" is typical of X clients.  there is no general solution without a major rewrite of some parts of X.  it would need to process windows

Offline

Board footer

Powered by FluxBB