diff options
author | dgp <dgp@noemail.net> | 2008-10-28 17:44:38 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2008-10-28 17:44:38 (GMT) |
commit | a19ec9c7793cc0edb84fa80059625580c42efa79 (patch) | |
tree | 972e11ab081e24201e5cde984e8e84395f1efa60 /win/tkWinTest.c | |
parent | 4c2d5a19d30c0ba79c94a0c56e2810c52be43fb1 (diff) | |
download | tk-a19ec9c7793cc0edb84fa80059625580c42efa79.zip tk-a19ec9c7793cc0edb84fa80059625580c42efa79.tar.gz tk-a19ec9c7793cc0edb84fa80059625580c42efa79.tar.bz2 |
* win/tkWinTest.c: Revise [testclipboard] to form that
* tests/winClipboard.test: handles encodings. [Bug 2191960]
* tests/constraints.tcl: [tcltest::bytestring] no longer used.
FossilOrigin-Name: 3fbd73438f349d5692c29b86ea1a92080fc927c6
Diffstat (limited to 'win/tkWinTest.c')
-rw-r--r-- | win/tkWinTest.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 6de5563..18c72f8 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinTest.c,v 1.17 2008/04/27 22:39:17 dkf Exp $ + * RCS: @(#) $Id: tkWinTest.c,v 1.18 2008/10/28 17:44:38 dgp Exp $ */ #include "tkWinInt.h" @@ -34,6 +34,7 @@ static int TestgetwindowinfoObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp); +Tk_GetSelProc SetSelectionResult; /* @@ -176,12 +177,23 @@ AppendSystemError( */ static int +SetSelectionResult( + ClientData dummy, + Tcl_Interp *interp, + const char *selection) +{ + Tcl_AppendResult(interp, selection, NULL); + return TCL_OK; +} + +static int TestclipboardObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { + Tk_Window tkwin = (Tk_Window) clientData; HGLOBAL handle; char *data; int code = TCL_OK; @@ -190,30 +202,8 @@ TestclipboardObjCmd( Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } - if (OpenClipboard(NULL)) { - /* - * We could consider using CF_UNICODETEXT on NT, but then we would - * have to convert it from External. Instead we'll just take this and - * do "bytestring" at the Tcl level for Unicode inclusive text - */ - - handle = GetClipboardData(CF_TEXT); - if (handle != NULL) { - data = GlobalLock(handle); - Tcl_AppendResult(interp, data, NULL); - GlobalUnlock(handle); - } else { - Tcl_AppendResult(interp, "null clipboard handle", NULL); - code = TCL_ERROR; - } - CloseClipboard(); - return code; - } else { - Tcl_AppendResult(interp, "couldn't open clipboard: ", NULL); - AppendSystemError(interp, GetLastError()); - return TCL_ERROR; - } - return TCL_OK; + return TkSelGetSelection(interp, tkwin, Tk_InternAtom(tkwin, "CLIPBOARD"), + XA_STRING, SetSelectionResult, NULL); } /* |