summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-26 14:32:43 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-26 14:32:43 (GMT)
commitf82df37a90029d95b86d6fad1d14ddb3323419dd (patch)
tree6386cbce29e1fb3a7c9d6b60c1e4e35533d26650
parent75d0d5da127d9d9b7fbc4b5989c6510eb950e402 (diff)
parent92dc17bde5685c5249794b0ef519d9597139c5f4 (diff)
downloadtk-f82df37a90029d95b86d6fad1d14ddb3323419dd.zip
tk-f82df37a90029d95b86d6fad1d14ddb3323419dd.tar.gz
tk-f82df37a90029d95b86d6fad1d14ddb3323419dd.tar.bz2
merge trunk
shorten command table, and make sure that tk.dll, when loaded in cygwin, doesn't use the win32 file dialogs
-rwxr-xr-xChangeLog16
-rw-r--r--generic/tkStubInit.c50
-rw-r--r--generic/tkWindow.c106
3 files changed, 99 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index 561a56c..cdfcd5b 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2012-04-26 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkStubInit.c (Tk_GetHINSTANCE): Ensure that this is defined
+ for OSX.
+
+2012-04-26 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tk.decls: [Bug 3508771]: Implement TkClipBox, Tk*Region and
+ * generic/tkInt.decls: Tk_GetHINSTANCE for Cygwin
+ * generic/tkPlatDecls.h:
+ * generic/tkintDecls.h:
+ * generic/tkStubInit.c:
+ * unix/tcl.m4: For Cygwin, install tk84.dll in <prefix>/bin, not <prefix>/lib
+ * unix/configure:
+ * unix/Makefile.in:
+
2012-04-22 Donal K. Fellows <dkf@users.sf.net>
* generic/tkBind.c (ExpandPercents): [Bug 3520202]: Ensure that the
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 89ae433..6b36f7b 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -48,20 +48,24 @@
#undef TkSetRegion
#undef TkUnionRectWithRegion
#undef TkSubtractRegion
-
-TkIntStubs tkIntStubs;
+#undef TkPutImage
#ifndef __WIN32__
-/* Make sure that extensions which call XParseColor through
- * the stub table, call TkParseColor in stead. See bug #3486474 */
-# define XParseColor TkParseColor
+/*
+ * Make sure that extensions which call XParseColor through the stub
+ * table, call TkParseColor instead. [Bug 3486474]
+ */
+# define XParseColor TkParseColor
+# ifndef __CYGWIN__
+# define Tk_AttachHWND 0
+# define Tk_GetHWND 0
+# define Tk_HWNDToWindow 0
+# define Tk_PointerEvent 0
+# define Tk_TranslateWinEvent 0
+# define Tk_GetHINSTANCE 0
+# endif
# if !defined(MAC_TCL) && !defined(MAC_OSX_TCL)
-# define Tk_AttachHWND 0
-# define Tk_GetHWND 0
-# define Tk_HWNDToWindow 0
-# define Tk_PointerEvent 0
-# define Tk_TranslateWinEvent 0
# define TkClipBox (void (*) _ANSI_ARGS_((TkRegion, XRectangle *))) XClipBox
# define TkCreateRegion (TkRegion (*) ()) XCreateRegion
# define TkDestroyRegion (void (*) _ANSI_ARGS_((TkRegion))) XDestroyRegion
@@ -71,26 +75,32 @@ TkIntStubs tkIntStubs;
# define TkUnionRectWithRegion (void (*) _ANSI_ARGS_((XRectangle *, TkRegion, TkRegion))) XUnionRectWithRegion
# define TkSubtractRegion (void (*) _ANSI_ARGS_((TkRegion, TkRegion, TkRegion))) XSubtractRegion
-#ifdef __CYGWIN__
-/* Trick, so we don't have to include <windows.h> here, which
- * - b.t.w. - lacks this function anyway */
-#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
+# ifdef __CYGWIN__
+# define Tk_GetHINSTANCE TkPlatGetHINSTANCE
+# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
+
+/*
+ * Trick, so we don't have to include <windows.h> here, which in any
+ * case lacks this function anyway.
+ */
+
int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
-#define Tk_GetHINSTANCE TkPlatGetHINSTANCE
+TkIntStubs tkIntStubs;
+
static void *Tk_GetHINSTANCE()
{
void *hInstance = NULL;
+
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
- (const char *)&tkIntStubs, &hInstance);
+ (const char *) &tkIntStubs, &hInstance);
return hInstance;
}
-#else
-# define Tk_GetHINSTANCE 0
-#endif
+# else /* !__CYGWIN__ */
+# define TkPutImage 0
+# endif /* __CYGWIN__ */
# endif /* !MAC_TCL && !MACC_OSX_TCL */
-
#endif /* !__WIN32__ */
/*
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index a04777f..98b89db 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -101,12 +101,12 @@ static CONST XSetWindowAttributes defAtts= {
#define ISSAFE 1
#define PASSMAINWINDOW 2
-#define WINMACONLY 4
+#define NOOBJPROC 4
+#define WINMACONLY 8
typedef struct {
CONST char *name; /* Name of command. */
- Tcl_CmdProc *cmdProc; /* Command's string-based procedure. */
- Tcl_ObjCmdProc *objProc; /* Command's object-based procedure. */
+ Tcl_ObjCmdProc *objProc; /* Command's object- (or string-) based procedure. */
int flags;
} TkCmd;
@@ -115,59 +115,59 @@ static CONST TkCmd commands[] = {
* Commands that are part of the intrinsics:
*/
- {"bell", NULL, Tk_BellObjCmd, PASSMAINWINDOW},
- {"bind", NULL, Tk_BindObjCmd, PASSMAINWINDOW|ISSAFE},
- {"bindtags", NULL, Tk_BindtagsObjCmd, PASSMAINWINDOW|ISSAFE},
- {"clipboard", NULL, Tk_ClipboardObjCmd, PASSMAINWINDOW},
- {"destroy", NULL, Tk_DestroyObjCmd, PASSMAINWINDOW|ISSAFE},
- {"event", NULL, Tk_EventObjCmd, PASSMAINWINDOW|ISSAFE},
- {"focus", NULL, Tk_FocusObjCmd, PASSMAINWINDOW|ISSAFE},
- {"font", NULL, Tk_FontObjCmd, PASSMAINWINDOW|ISSAFE},
- {"grab", NULL, Tk_GrabObjCmd, PASSMAINWINDOW},
- {"grid", NULL, Tk_GridObjCmd, PASSMAINWINDOW|ISSAFE},
- {"image", NULL, Tk_ImageObjCmd, PASSMAINWINDOW|ISSAFE},
- {"lower", NULL, Tk_LowerObjCmd, PASSMAINWINDOW|ISSAFE},
- {"option", NULL, Tk_OptionObjCmd, PASSMAINWINDOW|ISSAFE},
- {"pack", NULL, Tk_PackObjCmd, PASSMAINWINDOW|ISSAFE},
- {"place", NULL, Tk_PlaceObjCmd, ISSAFE},
- {"raise", NULL, Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE},
- {"selection", NULL, Tk_SelectionObjCmd, PASSMAINWINDOW},
- {"tk", NULL, Tk_TkObjCmd, PASSMAINWINDOW|ISSAFE},
- {"tkwait", NULL, Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"bell", Tk_BellObjCmd, PASSMAINWINDOW},
+ {"bind", Tk_BindObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"bindtags", Tk_BindtagsObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"clipboard", Tk_ClipboardObjCmd, PASSMAINWINDOW},
+ {"destroy", Tk_DestroyObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"event", Tk_EventObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"focus", Tk_FocusObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"font", Tk_FontObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"grab", Tk_GrabObjCmd, PASSMAINWINDOW},
+ {"grid", Tk_GridObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"image", Tk_ImageObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"lower", Tk_LowerObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"option", Tk_OptionObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"pack", Tk_PackObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"place", Tk_PlaceObjCmd, ISSAFE},
+ {"raise", Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"selection", Tk_SelectionObjCmd, PASSMAINWINDOW},
+ {"tk", Tk_TkObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE},
#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
- {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, PASSMAINWINDOW},
- {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd, WINMACONLY|PASSMAINWINDOW},
- {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, WINMACONLY|PASSMAINWINDOW},
- {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, WINMACONLY|PASSMAINWINDOW},
+ {"tk_chooseColor", Tk_ChooseColorObjCmd, PASSMAINWINDOW},
+ {"tk_chooseDirectory", Tk_ChooseDirectoryObjCmd, WINMACONLY|PASSMAINWINDOW},
+ {"tk_getOpenFile", Tk_GetOpenFileObjCmd, WINMACONLY|PASSMAINWINDOW},
+ {"tk_getSaveFile", Tk_GetSaveFileObjCmd, WINMACONLY|PASSMAINWINDOW},
#endif
#if defined(__WIN32__) || defined(MAC_OSX_TK)
- {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, PASSMAINWINDOW},
+ {"tk_messageBox", Tk_MessageBoxObjCmd, PASSMAINWINDOW},
#endif
- {"update", NULL, Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
- {"winfo", NULL, Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
- {"wm", NULL, Tk_WmObjCmd, PASSMAINWINDOW},
+ {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"wm", Tk_WmObjCmd, PASSMAINWINDOW},
/*
* Widget class commands.
*/
- {"button", NULL, Tk_ButtonObjCmd, ISSAFE},
- {"canvas", NULL, Tk_CanvasObjCmd, PASSMAINWINDOW|ISSAFE},
- {"checkbutton", NULL, Tk_CheckbuttonObjCmd, ISSAFE},
- {"entry", NULL, Tk_EntryObjCmd, ISSAFE},
- {"frame", NULL, Tk_FrameObjCmd, ISSAFE},
- {"label", NULL, Tk_LabelObjCmd, ISSAFE},
- {"labelframe", NULL, Tk_LabelframeObjCmd, ISSAFE},
- {"listbox", NULL, Tk_ListboxObjCmd, ISSAFE},
- {"menubutton", NULL, Tk_MenubuttonObjCmd, ISSAFE},
- {"message", NULL, Tk_MessageObjCmd, ISSAFE},
- {"panedwindow", NULL, Tk_PanedWindowObjCmd, ISSAFE},
- {"radiobutton", NULL, Tk_RadiobuttonObjCmd, ISSAFE},
- {"scale", NULL, Tk_ScaleObjCmd, ISSAFE},
- {"scrollbar", Tk_ScrollbarCmd, NULL, PASSMAINWINDOW|ISSAFE},
- {"spinbox", NULL, Tk_SpinboxObjCmd, ISSAFE},
- {"text", Tk_TextCmd, NULL, PASSMAINWINDOW|ISSAFE},
- {"toplevel", NULL, Tk_ToplevelObjCmd, 0},
+ {"button", Tk_ButtonObjCmd, ISSAFE},
+ {"canvas", Tk_CanvasObjCmd, PASSMAINWINDOW|ISSAFE},
+ {"checkbutton", Tk_CheckbuttonObjCmd, ISSAFE},
+ {"entry", Tk_EntryObjCmd, ISSAFE},
+ {"frame", Tk_FrameObjCmd, ISSAFE},
+ {"label", Tk_LabelObjCmd, ISSAFE},
+ {"labelframe", Tk_LabelframeObjCmd, ISSAFE},
+ {"listbox", Tk_ListboxObjCmd, ISSAFE},
+ {"menubutton", Tk_MenubuttonObjCmd, ISSAFE},
+ {"message", Tk_MessageObjCmd, ISSAFE},
+ {"panedwindow", Tk_PanedWindowObjCmd, ISSAFE},
+ {"radiobutton", Tk_RadiobuttonObjCmd, ISSAFE},
+ {"scale", Tk_ScaleObjCmd, ISSAFE},
+ {"scrollbar", (Tcl_ObjCmdProc *) Tk_ScrollbarCmd, NOOBJPROC|PASSMAINWINDOW|ISSAFE},
+ {"spinbox", Tk_SpinboxObjCmd, ISSAFE},
+ {"text", (Tcl_ObjCmdProc *) Tk_TextCmd, NOOBJPROC|PASSMAINWINDOW|ISSAFE},
+ {"toplevel", Tk_ToplevelObjCmd, 0},
/*
* Misc.
@@ -175,9 +175,9 @@ static CONST TkCmd commands[] = {
#if defined(MAC_TCL) || defined(MAC_OSX_TK)
{"::tk::unsupported::MacWindowStyle",
- NULL, TkUnsupported1ObjCmd, PASSMAINWINDOW|ISSAFE},
+ TkUnsupported1ObjCmd, PASSMAINWINDOW|ISSAFE},
#endif
- {(char *) NULL, (int (*) _ANSI_ARGS_((ClientData, Tcl_Interp *, int, CONST char **))) NULL, NULL, 0}
+ {NULL, NULL, 0}
};
/*
@@ -950,7 +950,7 @@ TkCreateMainWindow(interp, screenName, baseName)
isSafe = Tcl_IsSafe(interp);
for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
- if ((cmdPtr->cmdProc == NULL) && (cmdPtr->objProc == NULL)) {
+ if (cmdPtr->objProc == NULL) {
Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
#ifdef __WIN32__
@@ -963,9 +963,9 @@ TkCreateMainWindow(interp, screenName, baseName)
} else {
clientData = (ClientData) NULL;
}
- if (cmdPtr->cmdProc != NULL) {
- Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc,
- clientData, (void (*) _ANSI_ARGS_((ClientData))) NULL);
+ if (cmdPtr->flags & NOOBJPROC) {
+ Tcl_CreateCommand(interp, cmdPtr->name,
+ (Tcl_CmdProc *) cmdPtr->objProc, clientData, NULL);
} else {
Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc,
clientData, NULL);