Xclip does not end when tracing

I made the following comments:

$ xclip text.txt 

Execution stops immediately, it copies the contents of text.txt by default to XA_PRIMARY , which means that you can paste it through the middle mouse button or xclip -o .

When I want to see what xclip does, it no longer ends:

 $ xclip -verbose text.txt Connected to X server. Using UTF8_STRING. Reading text.txt... Waiting for selection requests, Control-C to quit Waiting for selection request number 1 

It does not end until I select something in my X11 system, for example, this very output that I inserted here. I would understand this if the behavior is limited to verbose . In the end, you want to sit down and see what happens.

I can reproduce the same behavior with strace , but only if fork parameter is provided

 $ strace -f xclip text.txt 

or when shelling from Ruby using a system execution command that should return a result, which is actually nothing.

 $ ruby -e "`xclip text.txt`" 

The hint strace gave is that it is polling in a file descriptor to wait for an event. This event is fired if I choose something. Is this behavior explicable? I have evidence that this is not reproducible in any system. Could this be due to ticket # 9 Do not close stdout when configuring the clipboard from stdin ?

I am running xclip version 0.12 on Ubuntu 13.04.

+7
linux unix ubuntu x11 xclip
source share
1 answer

XClip launches the child on startup without -verbose . The only difference from -verbose is that there is no forked child and the same original process handles ConvertSelection events.

Usually in the X Window toolkits, copy / paste is implemented using the X Selection :

Choices are global server resources called an atom that belong to a specific client. The number of choices is not limited by protocol; as many choices may exist. Selection designed to create the basis for building communication mechanisms between customers. The official definition is in glo X:

"... an indirect property with a dynamic type, that is, instead of having a property stored on the server, it is supported by some client (" owner "). The choice is global in nature and are considered to belong to the user (although they are supported by clients ), instead of being private to a specific window hierarchy or a specific set of clients. "

From an application point of view, selection provides a mechanism for transferring information between X clients. Since X is a network protocol, the existence of a separate channel for transferring data between different clients cannot be assumed to exist. Elections are intended only to transmit data that directly connects aspects of the user interface of the application, although this policy is not respected.

The contents of the selection are saved in the application itself and requested using the ConvertSelection event (β€œconvert” here, because there is a way for the client to set the specific type (or β€œtype” or format) of the selected data. The conversion, again, occurs in the application to which the selected buffer.

Because of this architecture, it is not possible to β€œcopy text to a buffer and exit system β€” because you are a system buffer. XClip simulates copy and exit by markup and demo.

+8
source share

All Articles