mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Merge pull request #7141 from radarhere/grabclipboardwin32
This commit is contained in:
commit
3568df8af1
|
@ -437,8 +437,14 @@ PyImaging_GrabClipboardWin32(PyObject *self, PyObject *args) {
|
||||||
LPCSTR format_names[] = {"DIB", "DIB", "file", "png", NULL};
|
LPCSTR format_names[] = {"DIB", "DIB", "file", "png", NULL};
|
||||||
|
|
||||||
if (!OpenClipboard(NULL)) {
|
if (!OpenClipboard(NULL)) {
|
||||||
PyErr_SetString(PyExc_OSError, "failed to open clipboard");
|
// Maybe the clipboard is temporarily in use by another process.
|
||||||
return NULL;
|
// Wait and try again
|
||||||
|
Sleep(500);
|
||||||
|
|
||||||
|
if (!OpenClipboard(NULL)) {
|
||||||
|
PyErr_SetString(PyExc_OSError, "failed to open clipboard");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find best format as set by clipboard owner
|
// find best format as set by clipboard owner
|
||||||
|
|
Loading…
Reference in New Issue
Block a user