Pat Gunn (dachte) wrote,
Pat Gunn

Firefox and Clipboard-clobbering

I often find that my PRIMARY clipboard (the one associated with mouse selections in the X Window System, not to be confused with the CLIPBOARD clipboard used for menu-driven cut'n'paste) gets stuck with something that I selected sometime back, even after I select something new to put into it.

Being aware of this has led me to become more observant; enough to finally fully understand the problem and culprit.

It's Firefox. The old text that gets stuck is usually still selected in some Firefox window somewhere, and even when I haven't done anything with Firefox for half an hour, it'll still wake up occasionally, notice that some text is selected in one of its windows, and reassociate that with the clipboard, which actually has the visual effect of deselecting the text in whatever other app (usually a terminal) I'm trying to cut'n'paste from. I can see that deselection happen if I'm careful.

I think I can understand why Firefox behaves wierdly here; it has its own widget library that are going through a platform later called NSPR (Netscape Portable Runtime), and that layer probably is not very X11-savvy; it's a platform abstraction library, and those have the job of hiding differences between operating systems. IIRC, Firefox doesn't use native X11 widgets; there's some weird Xlib stuff in NSPR that does portable widgets, and so there's a lot of room for non-ICCCM-compliant behaviour. Somebody might've thought having a thread that pokes around the windows for currently-selected text and periodically associates it with the PRIMARY clipboard would be an adequate solution.

Unfortunately, it's frustrating as hell. When I can't reliably use the clipboard on my system because firefox is running, it's a problem. If anyone knows whether this is an unfixable design flaw, a known problem, or something somehow specific to me (I do use a weird X environment and it's possible there are WMHints that should allow Firefox to be smarter that are not happening), I'd be grateful for some poking around. I don't see myself leaving Firefox over this; it remains my favourite browser, none of the alternatives really interest me, and my past personal involvement with the Mozilla project has bought my loyalty for the forseeable future. I'd still love not to see the problem anymore.

(Crossposted to G+)

Tags: tech

  • JS Ugliness

    I'm weirded out that standards for Javascript programming are so low. Having made a more-or-less a successful first project, where I really rushed…

  • Controversial Opinions in Programming

    I like that recently there's been a meme floating around, started by one good blog post that got a lot of airtime, of posting and then talking about…

  • Powershell and talking to running apps

    I am committed to Unix, but sometimes I worry that the development culture we have is leading us to fall behind on some important fronts. We have a…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded