What is the purpose of -loops? In trying to figure out how to fix -loops in bug #73, I'm coming to the conclusion that they will be complex and bring subtle errors in the future. Are they worth it?
Here is the comment I made in that bug report about what we can do to fix -loops for right now and questions we'll need to address in the future:
Certain programs send many more paste requests than they should. For example, middle-click pasting into this very message using Mozilla Firefox triggered 21 paste requests, the first sixteen of which are simply duplicate requests for TARGETS (the list of available targets). Since requests for special targets like TARGETS, TIMESTAMP, and MULTIPLE aren't genuine pastes, they should not increment dloops. This should be fairly easy for us to fix.
However, that still leaves five paste requests for that single middle click. The browser asks for five different targets: text/plain;charset=utf-8, UTF8_STRING, COMPOUND_TEXT, STRING, and text/x-moz-text-internal. Since xclip only holds one format, xclip should decline the other four of those requests and not increment dloops. (This is bug #94).
Once those two problems are solved, we should reevaluate whether the loops feature is still broken.
Once xclip has started sending the data, should it count as a "loop" even if the client reports an error? Generally, it seems like the answer should be "No", but then I don't actually understand the use case for -loops. Is security its purpose? If the -sensitive flag (#70, #85) will rely on dloops to function, the answer should be "Yes".
Do any applications presume they can request the clipboard a second time instead of caching the data?
Is loops even a useful concept once xclip can handle more than one target (bugs #32, #101)?
How are loops counted if we can handle MULTIPLE requests in a batch (bug #93)? Does each step count as a loop or do we only increment dloops once? What if some of the steps fail?
What is the purpose of -loops? In trying to figure out how to fix -loops in bug #73, I'm coming to the conclusion that they will be complex and bring subtle errors in the future. Are they worth it?
Here is the comment I made in that bug report about what we can do to fix -loops for right now and questions we'll need to address in the future:
Certain programs send many more paste requests than they should. For example, middle-click pasting into this very message using Mozilla Firefox triggered 21 paste requests, the first sixteen of which are simply duplicate requests for
TARGETS
(the list of available targets). Since requests for special targets likeTARGETS
,TIMESTAMP
, andMULTIPLE
aren't genuine pastes, they should not increment dloops. This should be fairly easy for us to fix.However, that still leaves five paste requests for that single middle click. The browser asks for five different targets:
text/plain;charset=utf-8
,UTF8_STRING
,COMPOUND_TEXT
,STRING
, andtext/x-moz-text-internal
. Since xclip only holds one format, xclip should decline the other four of those requests and not increment dloops. (This is bug #94).Once those two problems are solved, we should reevaluate whether the loops feature is still broken.
-sensitive
flag (#70, #85) will rely on dloops to function, the answer should be "Yes".MULTIPLE
requests in a batch (bug #93)? Does each step count as a loop or do we only increment dloops once? What if some of the steps fail?Originally posted by @hackerb9 in https://github.com/astrand/xclip/issues/73#issuecomment-722752868