summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-11-16 21:54:53 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-11-16 21:54:53 (GMT)
commitdb2ee25c92c507efa66f4946aaa841e3045eaac2 (patch)
tree473568ac49d0e77b2b61dc507ec33c4c6e9bdd91
parentb56d2fd8f987501adc22f6a29bd0c5aef64ff477 (diff)
downloadtk-db2ee25c92c507efa66f4946aaa841e3045eaac2.zip
tk-db2ee25c92c507efa66f4946aaa841e3045eaac2.tar.gz
tk-db2ee25c92c507efa66f4946aaa841e3045eaac2.tar.bz2
Make a difference in the error message between the case where the clipboard is not available (because some other application grabbed it), and the case where the clipboard content cannot be retrieved.
-rw-r--r--win/tkWinClipboard.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 03c0cde..877eed4 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -55,9 +55,14 @@ TkSelGetSelection(
Tcl_Encoding encoding;
int result, locale, noBackslash = 0;
+ if (!OpenClipboard(NULL)) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "clipboard cannot be opened, another application grabbed it"));
+ Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL);
+ return TCL_ERROR;
+ }
if ((selection != Tk_InternAtom(tkwin, "CLIPBOARD"))
- || (target != XA_STRING)
- || !OpenClipboard(NULL)) {
+ || (target != XA_STRING)) {
goto error;
}