summaryrefslogtreecommitdiffstats
path: root/win/tkWinTest.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2000-04-12 18:51:10 (GMT)
committerhobbs <hobbs@noemail.net>2000-04-12 18:51:10 (GMT)
commit97449be1c8401028fb796094f7c0e634affe7a9a (patch)
tree54b4b23879951a9bebe1b3feb46f3a2a684476b5 /win/tkWinTest.c
parent8e86359adcf669e33f772be047aac5fd311a3a78 (diff)
downloadtk-97449be1c8401028fb796094f7c0e634affe7a9a.zip
tk-97449be1c8401028fb796094f7c0e634affe7a9a.tar.gz
tk-97449be1c8401028fb796094f7c0e634affe7a9a.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 FossilOrigin-Name: 6afe91c34422fd4d580eb8122ad3815c4612f685
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;
}