diff options
author | das <das> | 2005-11-27 02:36:13 (GMT) |
---|---|---|
committer | das <das> | 2005-11-27 02:36:13 (GMT) |
commit | 3dadea6fa58518be89d8e48e340285cd5d916887 (patch) | |
tree | 98dfe1d79c84fe0819c1b167cb9764496c2c9a72 /generic/tkTest.c | |
parent | c0223b885cb724c64ed47ceefc90b7f883a6b4df (diff) | |
download | tk-3dadea6fa58518be89d8e48e340285cd5d916887.zip tk-3dadea6fa58518be89d8e48e340285cd5d916887.tar.gz tk-3dadea6fa58518be89d8e48e340285cd5d916887.tar.bz2 |
* unix/tcl.m4 (Darwin): add 64bit support, check for Tiger copyfile(),
add CFLAGS to SHLIB_LD to support passing -isysroot in env(CFLAGS) to
configure (flag can't be present twice, so can't be in both CFLAGS and
LDFLAGS during configure), don't use -prebind when deploying on 10.4,
define TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING (rdar://3171542).
(SC_ENABLE_LANGINFO, SC_TIME_HANDLER): add/fix caching, fix obsolete
autoconf macros. Sync with tcl/unix/tcl.m4.
* unix/configure.in: fix obsolete autoconf macros, sync gratuitous
formatting/ordering differences with tcl/unix/configure.in.
* unix/Makefile.in: add CFLAGS to wish/tktest link to make executable
linking the same as during configure (needed to avoid loosing any linker
relevant flags in CFLAGS, in particular flags that can't be in LDFLAGS).
Avoid concurrent linking of wish and compiling of tkTestInit.o during
parallel make, fix dependencies and flags for building tkMacOSXInit.o
(checkstubs, checkexports): dependency and Darwin fixes
(dist): add new macosx files.
* macosx/tkMacOSXEvent.c (TkMacOSXProcessEvent):
* macosx/tkMacOSXEvent.h:
* macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent):
* macosx/tkMacOSXCarbonEvents.c: install standard application event
handler, add & call functions to start and stop carbon even timer that
runs the tcl event loop periodically during a nested carbon event loop
in the toolbox (e.g. during menutracking) to ensure tcl timers etc
continue to fire, register app event handler for menu tracking and HI
command carbon events, move menu event handling to new handlers for
those carbon events, no longer register for/handle appleevent carbon
event (now dealt with by standard application event handler), event
debugging code dynamically acquires carbon event debugging functions to
allow use on Tiger where they are no longer exported from HIToolbox.
* macosx/tkMacOSXFont.c (TkMacOSXUseAntialiasedText):
* macosx/tkMacOSXKeyEvent.c (GetKeyboardLayout):
* macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
* macosx/tkMacOSXInit.c:
* macosx/tkMacOSXInt.h: abstract common code to dynamically acquire
address of a named symbol (from a loaded dynamic library) into new
function TkMacOSXGetNamedSymbol() and macro TkMacOSXInitNamedSymbol.
* macosx/tkMacOSXMenu.c (TkpNewMenu):
* macosx/tkMacOSXMenubutton.c (MenuButtonInitControl):
* macosx/tkMacOSXMenus.c (TkMacOSXHandleMenuSelect): switch to modern
utf8 aware menu manager API, remove obsolete code, add error handling.
* macosx/tkMacOSXMouseEvent.c: define OSX 10.3 or later only constants
if necessary to allow compilation on OSX 10.2
* macosx/tkMacOSXWm.c (UpdateSizeHints): remove code that is never
executed.
* xlib/xgc.c (XCreateGC): sync with core-8-4-branch change.
* generic/tk.h: add/correct location of version numbers in macosx files.
* generic/tkInt.h: clarify fat compile comment.
* macosx/Wish.pbproj/default.pbxuser (new file):
* macosx/Wish.pbproj/jingham.pbxuser:
* macosx/Wish.pbproj/project.pbxproj:
* macosx/Wish.xcode/default.pbxuser:
* macosx/Wish.xcode/project.pbxproj:
* macosx/Wish.xcodeproj/default.pbxuser (new file):
* macosx/Wish.xcodeproj/project.pbxproj (new file): new/updated projects
for Xcode 2.2 on 10.4, Xcode 1.5 on 10.3 & ProjectBuilder on 10.2, with
native tktest targets and support for universal (fat) compiles.
* macosx/Tk-Info.plist (removed):
* macosx/Wish-Info.plist (removed):
* macosx/buildTkConfig.tcl (removed): remove obsolete build files.
* macosx/README: clarification/cleanup, document new Xcode projects and
universal (fat) builds via CFLAGS (i.e. ppc and i386 at the same time).
* unix/Makefile.in:
* unix/aclocal.m4:
* unix/configure.in:
* macosx/configure.ac (new file): add support for inclusion of
unix/configure.in by macosx/configure.ac, allows generation of a config
headers enabled configure script in macosx (required by Xcode projects).
* macosx/GNUmakefile: rename from Makefile to avoid overwriting by
configure run in tk/macosx, add support for reusing configure cache,
build target fixes.
* generic/tk3d.h:
* generic/tkButton.h:
* generic/tkCanvas.c:
* generic/tkCanvas.h:
* generic/tkColor.h:
* generic/tkEntry.h:
* generic/tkFileFilter.h:
* generic/tkFont.c:
* generic/tkFont.h:
* generic/tkImage.c:
* generic/tkImgPhoto.c:
* generic/tkInt.h:
* generic/tkMenu.c:
* generic/tkMenu.h:
* generic/tkMenubutton.h:
* generic/tkScale.h:
* generic/tkScrollbar.h:
* generic/tkSelect.h:
* generic/tkStubInit.c:
* generic/tkStubLib.c:
* generic/tkText.h:
* generic/tkUndo.h:
* macosx/tkMacOSXButton.c:
* macosx/tkMacOSXDebug.c:
* macosx/tkMacOSXDebug.h:
* macosx/tkMacOSXDialog.c:
* macosx/tkMacOSXDraw.c:
* macosx/tkMacOSXEntry.c:
* macosx/tkMacOSXFont.c:
* macosx/tkMacOSXInt.h:
* macosx/tkMacOSXMenu.c:
* macosx/tkMacOSXMenubutton.c:
* macosx/tkMacOSXMouseEvent.c:
* macosx/tkMacOSXSend.c:
* macosx/tkMacOSXSubwindows.c:
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXXStubs.c:
* unix/tkUnixButton.c:
* unix/tkUnixMenu.c:
* xlib/xgc.c: ensure externally visible symbols not contained in stubs
table are declared as MODULE_SCOPE (or as static if not used outside of
own source file), #ifdef out a few Xlib and aqua functions that are
never called. These changes allow 'make checkstubs' to complete without
error on Darwin with gcc 4.
* macosx/tkMacOSXTest.c:
* macosx/tkMacOSXPort.h:
* win/tkWinTest.c:
* generic/tkInt.decls: add functions needed by tktest to internal stubs
table, correct signature of TkMacOSXHandleMenuSelect, add XSync to aqua
Xlib stubs.
* unix/tkUnixSend.c:
* generic/tkText.c:
* generic/tkTest.c: #ifdef unix only declarations.
(TestmetricsCmd): unify win and mac implementation.
(TestsendCmd): move to tkUnixSend.c to avoid access to global var.
(TesttextCmd): move to tkText.c to avoid having to put all the internal
text functions it uses into the stubs table.
* generic/tkTextDisp.c:
* macosx/tkMacOSXInit.c:
* macosx/tkMacOSXKeyEvent.c:
* macosx/tkMacOSXWindowEvent.c:
* macosx/tkMacOSXXStubs.c: fix gcc 4 warnings.
* macosx/tkMacOSXNotify.c:
* macosx/tkMacOSXScrlbr.c: sync with core-8-4-branch.
* generic/tkIntDecls.h:
* generic/tkIntPlatDecls.h:
* generic/tkIntXlibDecls.h:
* generic/tkStubInit.c:
* unix/configure:
* unix/tkConfig.h.in: regen.
Diffstat (limited to 'generic/tkTest.c')
-rw-r--r-- | generic/tkTest.c | 258 |
1 files changed, 25 insertions, 233 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c index f2b6700..1999117 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTest.c,v 1.28 2005/11/18 10:18:27 dkf Exp $ + * RCS: @(#) $Id: tkTest.c,v 1.29 2005/11/27 02:36:14 das Exp $ */ #include "tkInt.h" @@ -25,6 +25,7 @@ #endif #if defined(MAC_OSX_TK) +#include "tkMacOSXInt.h" #include "tkScrollbar.h" #endif @@ -173,8 +174,10 @@ static int TestfontObjCmd(ClientData dummy, Tcl_Obj *CONST objv[]); static int TestmakeexistCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); +#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) static int TestmenubarCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); +#endif #if defined(__WIN32__) || defined(MAC_OSX_TK) static int TestmetricsCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); @@ -197,10 +200,6 @@ static void CustomOptionFree(ClientData clientData, Tk_Window tkwin, char *internalPtr); static int TestpropCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); -static int TestsendCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); -static int TesttextCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) static int TestwrapperCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); @@ -216,8 +215,6 @@ static void TrivialEventProc(ClientData clientData, * External (platform specific) initialization routine: */ -extern int TkplatformtestInit(Tcl_Interp *interp); - #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) #define TkplatformtestInit(x) TCL_OK #endif @@ -277,7 +274,7 @@ Tktest_Init( (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateCommand(interp, "testprop", TestpropCmd, (ClientData) Tk_MainWindow(interp), NULL); - Tcl_CreateCommand(interp, "testtext", TesttextCmd, + Tcl_CreateCommand(interp, "testtext", TkpTesttextCmd, (ClientData) Tk_MainWindow(interp), NULL); #if defined(__WIN32__) || defined(MAC_OSX_TK) @@ -286,7 +283,7 @@ Tktest_Init( #else Tcl_CreateCommand(interp, "testmenubar", TestmenubarCmd, (ClientData) Tk_MainWindow(interp), NULL); - Tcl_CreateCommand(interp, "testsend", TestsendCmd, + Tcl_CreateCommand(interp, "testsend", TkpTestsendCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateCommand(interp, "testwrapper", TestwrapperCmd, (ClientData) Tk_MainWindow(interp), NULL); @@ -1835,6 +1832,7 @@ TestmakeexistCmd( */ /* ARGSUSED */ +#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) static int TestmenubarCmd( ClientData clientData, /* Main window for application. */ @@ -1884,6 +1882,7 @@ TestmenubarCmd( return TCL_ERROR; #endif } +#endif /* *---------------------------------------------------------------------- @@ -1902,7 +1901,7 @@ TestmenubarCmd( *---------------------------------------------------------------------- */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(MAC_OSX_TK) static int TestmetricsCmd( ClientData clientData, /* Main window for application. */ @@ -1911,38 +1910,17 @@ TestmetricsCmd( CONST char **argv) /* Argument strings. */ { char buf[TCL_INTEGER_SPACE]; + int val; +#ifdef __WIN32__ if (argc < 2) { Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0], " option ?arg ...?\"", NULL); return TCL_ERROR; } - - if (strcmp(argv[1], "cyvscroll") == 0) { - sprintf(buf, "%d", GetSystemMetrics(SM_CYVSCROLL)); - Tcl_AppendResult(interp, buf, NULL); - } else if (strcmp(argv[1], "cxhscroll") == 0) { - sprintf(buf, "%d", GetSystemMetrics(SM_CXHSCROLL)); - Tcl_AppendResult(interp, buf, NULL); - } else { - Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be cxhscroll or cyvscroll", NULL); - return TCL_ERROR; - } - return TCL_OK; -} -#endif -#if defined(MAC_OSX_TK) -static int -TestmetricsCmd( - ClientData clientData, /* Main window for application. */ - Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ -{ +#else Tk_Window tkwin = (Tk_Window) clientData; TkWindow *winPtr; - char buf[TCL_INTEGER_SPACE]; if (argc != 3) { Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0], @@ -1954,18 +1932,27 @@ TestmetricsCmd( if (winPtr == NULL) { return TCL_ERROR; } +#endif if (strcmp(argv[1], "cyvscroll") == 0) { - sprintf(buf, "%d", ((TkScrollbar *) winPtr->instanceData)->width); - Tcl_AppendResult(interp, buf, NULL); +#ifdef __WIN32__ + val = GetSystemMetrics(SM_CYVSCROLL); +#else + val = ((TkScrollbar *) winPtr->instanceData)->width; +#endif } else if (strcmp(argv[1], "cxhscroll") == 0) { - sprintf(buf, "%d", ((TkScrollbar *) winPtr->instanceData)->width); - Tcl_AppendResult(interp, buf, NULL); +#ifdef __WIN32__ + val = GetSystemMetrics(SM_CXHSCROLL); +#else + val = ((TkScrollbar *) winPtr->instanceData)->width; +#endif } else { Tcl_AppendResult(interp, "bad option \"", argv[1], "\": must be cxhscroll or cyvscroll", NULL); return TCL_ERROR; } + sprintf(buf, "%d", val); + Tcl_AppendResult(interp, buf, NULL); return TCL_OK; } #endif @@ -2047,201 +2034,6 @@ TestpropCmd( return TCL_OK; } -/* - *---------------------------------------------------------------------- - * - * TestsendCmd -- - * - * This function implements the "testsend" command. It provides a set of - * functions for testing the "send" command and support function in - * tkSend.c. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * Depends on option; see below. - * - *---------------------------------------------------------------------- - */ - - /* ARGSUSED */ -#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) -static int -TestsendCmd( - ClientData clientData, /* Main window for application. */ - Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ -{ - TkWindow *winPtr = (TkWindow *) clientData; - - if (argc < 2) { - Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0], - " option ?arg ...?\"", NULL); - return TCL_ERROR; - } - - if (strcmp(argv[1], "bogus") == 0) { - XChangeProperty(winPtr->dispPtr->display, - RootWindow(winPtr->dispPtr->display, 0), - winPtr->dispPtr->registryProperty, XA_INTEGER, 32, - PropModeReplace, - (unsigned char *) "This is bogus information", 6); - } else if (strcmp(argv[1], "prop") == 0) { - int result, actualFormat; - unsigned long length, bytesAfter; - Atom actualType, propName; - char *property, *p, *end; - Window w; - - if ((argc != 4) && (argc != 5)) { - Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0], - " prop window name ?value ?\"", NULL); - return TCL_ERROR; - } - if (strcmp(argv[2], "root") == 0) { - w = RootWindow(winPtr->dispPtr->display, 0); - } else if (strcmp(argv[2], "comm") == 0) { - w = Tk_WindowId(winPtr->dispPtr->commTkwin); - } else { - w = strtoul(argv[2], &end, 0); - } - propName = Tk_InternAtom((Tk_Window) winPtr, argv[3]); - if (argc == 4) { - property = NULL; - result = XGetWindowProperty(winPtr->dispPtr->display, - w, propName, 0, 100000, False, XA_STRING, - &actualType, &actualFormat, &length, - &bytesAfter, (unsigned char **) &property); - if ((result == Success) && (actualType != None) - && (actualFormat == 8) && (actualType == XA_STRING)) { - for (p = property; (p-property) < length; p++) { - if (*p == 0) { - *p = '\n'; - } - } - Tcl_SetResult(interp, property, TCL_VOLATILE); - } - if (property != NULL) { - XFree(property); - } - } else if (argv[4][0] == 0) { - XDeleteProperty(winPtr->dispPtr->display, w, propName); - } else { - Tcl_DString tmp; - - Tcl_DStringInit(&tmp); - for (p = Tcl_DStringAppend(&tmp, argv[4], - (int) strlen(argv[4])); *p != 0; p++) { - if (*p == '\n') { - *p = 0; - } - } - - XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING, - 8, PropModeReplace, (unsigned char*)Tcl_DStringValue(&tmp), - p-Tcl_DStringValue(&tmp)); - Tcl_DStringFree(&tmp); - } - } else if (strcmp(argv[1], "serial") == 0) { - char buf[TCL_INTEGER_SPACE]; - - sprintf(buf, "%d", tkSendSerial+1); - Tcl_SetResult(interp, buf, TCL_VOLATILE); - } else { - Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": must be bogus, prop, or serial", NULL); - return TCL_ERROR; - } - return TCL_OK; -} -#endif - -/* - *---------------------------------------------------------------------- - * - * TesttextCmd -- - * - * This function implements the "testtext" command. It provides a set of - * functions for testing text widgets and the associated functions in - * tkText*.c. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * Depends on option; see below. - * - *---------------------------------------------------------------------- - */ - -static int -TesttextCmd( - ClientData clientData, /* Main window for application. */ - Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ -{ - TkText *textPtr; - size_t len; - int lineIndex, byteIndex, byteOffset; - TkTextIndex index; - char buf[64]; - Tcl_CmdInfo info; - - if (argc < 3) { - return TCL_ERROR; - } - - if (Tcl_GetCommandInfo(interp, argv[1], &info) == 0) { - return TCL_ERROR; - } - if (info.isNativeObjectProc) { - textPtr = (TkText *) info.objClientData; - } else { - textPtr = (TkText *) info.clientData; - } - len = strlen(argv[2]); - if (strncmp(argv[2], "byteindex", len) == 0) { - if (argc != 5) { - return TCL_ERROR; - } - lineIndex = atoi(argv[3]) - 1; - byteIndex = atoi(argv[4]); - - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, lineIndex, - byteIndex, &index); - } else if (strncmp(argv[2], "forwbytes", len) == 0) { - if (argc != 5) { - return TCL_ERROR; - } - if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) { - return TCL_ERROR; - } - byteOffset = atoi(argv[4]); - TkTextIndexForwBytes(textPtr, &index, byteOffset, &index); - } else if (strncmp(argv[2], "backbytes", len) == 0) { - if (argc != 5) { - return TCL_ERROR; - } - if (TkTextGetIndex(interp, textPtr, argv[3], &index) != TCL_OK) { - return TCL_ERROR; - } - byteOffset = atoi(argv[4]); - TkTextIndexBackBytes(textPtr, &index, byteOffset, &index); - } else { - return TCL_ERROR; - } - - TkTextSetMark(textPtr, "insert", &index); - TkTextPrintIndex(textPtr, &index, buf); - sprintf(buf + strlen(buf), " %d", index.byteIndex); - Tcl_AppendResult(interp, buf, NULL); - - return TCL_OK; -} - #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* *---------------------------------------------------------------------- |