From bc1b481b1b3661958beec5f99e123d503749accb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Aug 2020 13:36:55 +0000 Subject: Another simplification: Change TkMacOSXDrawableView() from a MODULE_SCOPE function to a macro. This saves an empty wrapper-function for TkMacOSXGetRootControl() --- macosx/tkMacOSXPrivate.h | 2 +- macosx/tkMacOSXSubwindows.c | 40 +++++++--------------------------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 1091d7c..c632986 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -271,7 +271,7 @@ MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr, MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr, int active); MODULE_SCOPE NSWindow* TkMacOSXDrawableWindow(Drawable drawable); -MODULE_SCOPE NSView* TkMacOSXDrawableView(MacDrawable *macWin); +#define TkMacOSXDrawableView(macWin) (NSView *)TkMacOSXGetRootControl((Drawable)(macWin)) MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds); MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable); MODULE_SCOPE void TkMacOSXInvalidateViewRegion(NSView *view, diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 64db1b1..dd00043 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -1154,14 +1154,15 @@ TkMacOSXGetDrawablePort( *---------------------------------------------------------------------- */ -NSView * -TkMacOSXDrawableView( - MacDrawable *macWin) +void * +TkMacOSXGetRootControl( + Drawable drawable) { - NSView *result = nil; + void *result = NULL; + MacDrawable *macWin = (MacDrawable *)drawable; if (!macWin) { - result = nil; + result = NULL; } else if (!macWin->toplevel) { result = macWin->view; } else if (!(macWin->toplevel->flags & TK_EMBEDDED)) { @@ -1170,7 +1171,7 @@ TkMacOSXDrawableView( TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr); if (contWinPtr) { - result = TkMacOSXDrawableView(contWinPtr->privatePtr); + result = TkMacOSXGetRootControl((Drawable)contWinPtr->privatePtr); } } return result; @@ -1179,33 +1180,6 @@ TkMacOSXDrawableView( /* *---------------------------------------------------------------------- * - * TkMacOSXGetRootControl -- - * - * This function returns the NSView for a given X drawable. - * - * Results: - * A NSView* . - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -void * -TkMacOSXGetRootControl( - Drawable drawable) -{ - /* - * will probably need to fix this up for embedding - */ - - return TkMacOSXDrawableView((MacDrawable *) drawable); -} - -/* - *---------------------------------------------------------------------- - * * TkMacOSXInvalClipRgns -- * * This function invalidates the clipping regions for a given window and -- cgit v0.12