From b56d2fd8f987501adc22f6a29bd0c5aef64ff477 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 15 Nov 2018 21:49:34 +0000 Subject: Fix [9b0f3ee54e]: Better highlight that winClipboard tests may fail if a VNC viewer is open while these tests are running --- tests/winClipboard.test | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/winClipboard.test b/tests/winClipboard.test index 2a7ad73..1d17b14 100644 --- a/tests/winClipboard.test +++ b/tests/winClipboard.test @@ -15,8 +15,10 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test -# Note that these tests may fail if another application is grabbing the -# clipboard (e.g. an X server) +########################################################################### +# Note that these tests may fail if another application is grabbing the # +# clipboard (e.g. an X server, or a VNC viewer - See ticket [9b0f3ee54e]) # +########################################################################### test winClipboard-1.1 {TkSelGetSelection} -constraints win -setup { clipboard clear -- cgit v0.12 From db2ee25c92c507efa66f4946aaa841e3045eaac2 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 16 Nov 2018 21:54:53 +0000 Subject: 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. --- win/tkWinClipboard.c | 9 +++++++-- 1 file 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; } -- cgit v0.12 From f372cc0fac89fc68a385e93b5db724674510b5f1 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 17 Nov 2018 08:04:24 +0000 Subject: Comment clipboard.test and winClipboard.test --- tests/clipboard.test | 5 +++++ tests/winClipboard.test | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/clipboard.test b/tests/clipboard.test index 7f72f17..9689942 100644 --- a/tests/clipboard.test +++ b/tests/clipboard.test @@ -11,6 +11,11 @@ # environment variable TK_ALT_DISPLAY is set to an alternate display. # +################################################################# +# Note that some of these tests may fail if another application # +# is grabbing the clipboard (e.g. an X server, or a VNC viewer) # +################################################################# + package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv diff --git a/tests/winClipboard.test b/tests/winClipboard.test index 1d17b14..2f72966 100644 --- a/tests/winClipboard.test +++ b/tests/winClipboard.test @@ -15,10 +15,10 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test -########################################################################### -# Note that these tests may fail if another application is grabbing the # -# clipboard (e.g. an X server, or a VNC viewer - See ticket [9b0f3ee54e]) # -########################################################################### +################################################################# +# Note that some of these tests may fail if another application # +# is grabbing the clipboard (e.g. an X server, or a VNC viewer) # +################################################################# test winClipboard-1.1 {TkSelGetSelection} -constraints win -setup { clipboard clear -- cgit v0.12