Re: General clipboard issue on cygwin (mintty, putclip, getclip, /dev/clipboard)

Takashi Yano via Cygwin <[email protected]>
Newsgroups gmane.os.cygwin
Message-ID <[email protected]>
Hi Thomas,

On Wed, 25 Feb 2026 05:18:34 +0100
Thomas Wolff wrote:
> Am 24.02.2026 um 02:36 schrieb Takashi Yano:
> > Hi,
> >
> > I encountered a clipboard issue common to cygwin.
> >
> > Affected components:
> > /dev/clipboard, putclip/getclip, mintty
> >
> > The issue:
> > If the clipbard is opened by `OpenClipboard(NULL)`, occasionally
> > SetClipboardData() and GetClipboardData() fails with
> > ERROR_CLIPBOARD_NOT_OPEN.
> >
> > When UltraVNC Viewer (https://uvnc.com/) is opened, this issue
> > happens with a very high probability (> ~90%).
> >
> > $ echo AAAA > /dev/clipboard
> > echo: write error: Permission denied
> >
> > On mintty, text selection by mouse and clicking center button
> > fails at the first attempt.
> According to Windows docs, OpenClipboard(0) would make SetClipboardData 
> fail. There is no such statement about reading from the clipboard.
> Accordingly, mintty calls OpenClipbard(wnd) before writing to the 
> clipboard and (0) only before pasting. Also I'm not aware pasting ever 
> fails for me. But if there is a chance to fail, I'll add the (wnd) to 
> both other calls.

Thanks. That's fine.

> About the cygwin patch, could perhaps GetDesktopWindow help?

I guess, I confirmed GetDesktopWindow() normally works.
However, unfortunately, it does not work in ssh session
even though it returns non-zero HWND.

-- 
Takashi Yano <[email protected]>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.