summaryrefslogtreecommitdiffstats
path: root/win/tkWinTest.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-04-12 18:51:11 (GMT)
committerhobbs <hobbs>2000-04-12 18:51:11 (GMT)
commit1c06a203ecbe741c83687742b659ab73514a0b00 (patch)
tree54b4b23879951a9bebe1b3feb46f3a2a684476b5 /win/tkWinTest.c
parentb78c23a7e207a18aa3049d06660f6ce12b2b0fbf (diff)
downloadtk-1c06a203ecbe741c83687742b659ab73514a0b00.zip
tk-1c06a203ecbe741c83687742b659ab73514a0b00.tar.gz
tk-1c06a203ecbe741c83687742b659ab73514a0b00.tar.bz2
* test/winClipboard.test:
* win/tkWinInt.h: * win/tkWinClipboard.c (UpdateClipboard): * win/tkWinX.c (GenerateXEvent): added updatingClipboard tsd and TkWinUpdatingClipboard accessor function to allow us to flag ourselves when we are the ones updating the clipboard. This corrected inability to create our own clipboard types within a Tk application. [Bug: 2338 4318] * win/tkWinTest.c (TestclipboardCmd): improved TestclipboardCmd with better error handling and obj'ification
Diffstat (limited to 'win/tkWinTest.c')
-rw-r--r--win/tkWinTest.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 00553eb..6f7ee7e 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -5,11 +5,12 @@
* the Windows platform.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright (c) 2000 by Scriptics Corporation.
*
* 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.2 1999/04/16 01:51:53 stanton Exp $
+ * RCS: @(#) $Id: tkWinTest.c,v 1.3 2000/04/12 18:51:11 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -21,8 +22,9 @@ HWND tkWinCurrentDialog;
*/
int TkplatformtestInit(Tcl_Interp *interp);
-static int TestclipboardCmd(ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv);
+static int TestclipboardObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
static int TestwineventCmd(ClientData clientData,
Tcl_Interp *interp, int argc, char **argv);
@@ -52,7 +54,7 @@ TkplatformtestInit(
* Add commands for platform specific tests on MacOS here.
*/
- Tcl_CreateCommand(interp, "testclipboard", TestclipboardCmd,
+ Tcl_CreateObjCommand(interp, "testclipboard", TestclipboardObjCmd,
(ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp, "testwinevent", TestwineventCmd,
(ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
@@ -63,7 +65,7 @@ TkplatformtestInit(
/*
*----------------------------------------------------------------------
*
- * TestclipboardCmd --
+ * TestclipboardObjCmd --
*
* This procedure implements the testclipboard command. It provides
* a way to determine the actual contents of the Windows clipboard.
@@ -78,24 +80,40 @@ TkplatformtestInit(
*/
static int
-TestclipboardCmd(clientData, interp, argc, argv)
+TestclipboardObjCmd(clientData, interp, objc, objv)
ClientData clientData; /* Main window for application. */
Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj *CONST objv[]; /* Argument values. */
{
TkWindow *winPtr = (TkWindow *) clientData;
HGLOBAL handle;
char *data;
+ if (objc != 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, (char *) 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, (char *) NULL);
GlobalUnlock(handle);
+ } else {
+ Tcl_AppendResult(interp, "null clipboard handle", (char *) NULL);
+ return TCL_ERROR;
}
CloseClipboard();
+ } else {
+ Tcl_AppendResult(interp, "couldn't open clipboard", (char *) NULL);
+ return TCL_ERROR;
}
return TCL_OK;
}