I realized after reading this issue https://github.com/astrand/xclip/issues/8 that using '-loops 1' wasn't actually guaranteed to paste a selection into a web browser. For example, on a terminal window, one paste was fine, but to paste into a Chrome window, it needed to be set to 2 to get one pasting, whereas in the terminal it would still paste 2, so the way the loop was being incremented wasn't right. Using a Chromium window in MATE actually took 3 loops for one paste.
After playing with the code a little bit, I noticed that even for selections that needed the 32-bit mode of XChangeProperty that uses targets, that there would be a final call to the XChangeProperty that uses the 8-bit mode, so I changed the code to pass a pointer to dloop to xcin() and increment it only after those XChangeProperty calls. Now if '-loops 1' is specified it will only paste the selection once for the terminal or a browser window regardless of how many XChangeProperty calls it actually calls.
I realized after reading this issue https://github.com/astrand/xclip/issues/8 that using '-loops 1' wasn't actually guaranteed to paste a selection into a web browser. For example, on a terminal window, one paste was fine, but to paste into a Chrome window, it needed to be set to 2 to get one pasting, whereas in the terminal it would still paste 2, so the way the loop was being incremented wasn't right. Using a Chromium window in MATE actually took 3 loops for one paste.
After playing with the code a little bit, I noticed that even for selections that needed the 32-bit mode of XChangeProperty that uses targets, that there would be a final call to the XChangeProperty that uses the 8-bit mode, so I changed the code to pass a pointer to dloop to xcin() and increment it only after those XChangeProperty calls. Now if '-loops 1' is specified it will only paste the selection once for the terminal or a browser window regardless of how many XChangeProperty calls it actually calls.