summaryrefslogtreecommitdiffstats
path: root/win/tkWinTest.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-10-28 17:44:38 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-10-28 17:44:38 (GMT)
commitc6809cbce555f56fd88713fb23268419af120d54 (patch)
tree972e11ab081e24201e5cde984e8e84395f1efa60 /win/tkWinTest.c
parentb88117d1876391881d90f05ad4bfabf9b05ade97 (diff)
downloadtk-c6809cbce555f56fd88713fb23268419af120d54.zip
tk-c6809cbce555f56fd88713fb23268419af120d54.tar.gz
tk-c6809cbce555f56fd88713fb23268419af120d54.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/tkWinTest.c')
-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);
}
/*