From 52d40b405901136eea7509ab2f4ce8e1365d8894 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 26 Apr 2012 13:46:50 +0000 Subject: Ensure that Tk_GetHINSTANCE is defined on OSX. --- ChangeLog | 5 +++++ generic/tkStubInit.c | 45 +++++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 20 deletions(-) mode change 100755 => 100644 ChangeLog diff --git a/ChangeLog b/ChangeLog old mode 100755 new mode 100644 index d4d5c3e..cdfcd5b --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-04-26 Donal K. Fellows + + * generic/tkStubInit.c (Tk_GetHINSTANCE): Ensure that this is defined + for OSX. + 2012-04-26 Jan Nijtmans * generic/tk.decls: [Bug 3508771]: Implement TkClipBox, Tk*Region and diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 2a8fd07..6b36f7b 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -51,16 +51,19 @@ #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_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 TkClipBox (void (*) _ANSI_ARGS_((TkRegion, XRectangle *))) XClipBox @@ -72,30 +75,32 @@ # 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 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 here, which in any + * case lacks this function anyway. + */ + int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); TkIntStubs tkIntStubs; -#define Tk_GetHINSTANCE TkPlatGetHINSTANCE 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 /* __CYGWIN__ */ -# define Tk_GetHINSTANCE 0 -# define TkPutImage 0 -#endif /* __CYGWIN__ */ - +# else /* !__CYGWIN__ */ +# define TkPutImage 0 +# endif /* __CYGWIN__ */ # endif /* !MAC_TCL && !MACC_OSX_TCL */ - #endif /* !__WIN32__ */ /* -- cgit v0.12