summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2008-10-28 17:44:38 (GMT)
committerdgp@users.sourceforge.net <dgp>2008-10-28 17:44:38 (GMT)
commitc7565f4c9c7338553959eed560517f526d9c5aa6 (patch)
tree972e11ab081e24201e5cde984e8e84395f1efa60 /win
parentbcd21b27903a89a8120dcb6a39bd0bfa16927f33 (diff)
downloadtk-c7565f4c9c7338553959eed560517f526d9c5aa6.zip
tk-c7565f4c9c7338553959eed560517f526d9c5aa6.tar.gz
tk-c7565f4c9c7338553959eed560517f526d9c5aa6.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.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinTest.c40
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);
}
/*