diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-06 16:11:18 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-06 16:11:18 (GMT) |
commit | e04db4716d431f93bff03c37a5e5b21d264dc846 (patch) | |
tree | 6dc2dda265107b294bfb11465e94932bedccb37d /macosx | |
parent | 887b542d5ebff4576ba8b29c562853a003eaa65e (diff) | |
download | tk-e04db4716d431f93bff03c37a5e5b21d264dc846.zip tk-e04db4716d431f93bff03c37a5e5b21d264dc846.tar.gz tk-e04db4716d431f93bff03c37a5e5b21d264dc846.tar.bz2 |
Re-introduce TkMacOSXGetTkWindow() as macro
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXKeyEvent.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXMenus.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 1 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 42 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 16 |
5 files changed, 37 insertions, 36 deletions
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 78d2680..fdf4e66 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -50,8 +50,8 @@ static NSUInteger textInputModifiers; TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif NSWindow *w = [theEvent window]; - Tk_Window tkwin = Tk_MacOSXGetTkWindow(w); - TkWindow *winPtr = (TkWindow *)tkwin, *grabWinPtr, *focusWinPtr; + TkWindow *winPtr = TkMacOSXGetTkWindow(w), *grabWinPtr, *focusWinPtr; + Tk_Window tkwin = (Tk_Window)winPtr; NSEventType type = [theEvent type]; NSUInteger virtual = [theEvent keyCode]; NSUInteger modifiers = ([theEvent modifierFlags] & @@ -285,8 +285,8 @@ static NSUInteger textInputModifiers; int i, len, state; XEvent xEvent; NSString *str, *keystr, *lower; - Tk_Window tkwin = Tk_MacOSXGetTkWindow([self window]); - TkWindow *winPtr = (TkWindow *)tkwin; + TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); + Tk_Window tkwin = (Tk_Window)winPtr; Bool sendingIMEText = NO; str = ([aString isKindOfClass: [NSAttributedString class]]) ? @@ -392,7 +392,7 @@ static NSUInteger textInputModifiers; selectedRange: (NSRange)selRange replacementRange: (NSRange)repRange { - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow([self window]); + TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; NSString *temp; NSString *str; @@ -497,7 +497,7 @@ static NSUInteger textInputModifiers; } processingCompose = NO; if (aSelector == @selector (deleteBackward:)) { - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow([self window]); + TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL); } diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index 8833eb0..a1519f5 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -409,7 +409,7 @@ GenerateEditEvent( { XVirtualEvent event; int x, y; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow([NSApp keyWindow]); + TkWindow *winPtr = TkMacOSXGetTkWindow([NSApp keyWindow]); Tk_Window tkwin; if (!winPtr) { diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 091b795..2de3067 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -257,6 +257,7 @@ MODULE_SCOPE void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel, CGContextRef context); +#define TkMacOSXGetTkWindow(window) (TkWindow *)Tk_MacOSXGetTkWindow(window) #define TkMacOSXGetNSWindowForDrawable(drawable) ((NSWindow*)TkMacOSXDrawable(drawable)) #define TkMacOSXGetNSViewForDrawable(macWin) (NSView *)Tk_MacOSXGetNSViewForDrawable((Drawable)(macWin)) MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds); diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 68547e6..3d9120f 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -55,7 +55,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; BOOL activate = [[notification name] isEqualToString:NSWindowDidBecomeKeyNotification]; NSWindow *w = [notification object]; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr && Tk_IsMapped(winPtr)) { GenerateActivateEvents(winPtr, activate); @@ -70,7 +70,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; BOOL movedOnly = [[notification name] isEqualToString:NSWindowDidMoveNotification]; NSWindow *w = [notification object]; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; @@ -106,7 +106,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif NSWindow *w = [notification object]; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { winPtr->wmInfoPtr->hints.initial_state = @@ -179,10 +179,10 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif NSWindow *w = [notification object]; - Tk_Window tkwin = Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); - if (tkwin) { - Tk_UnmapWindow(tkwin); + if (winPtr) { + Tk_UnmapWindow((Tk_Window)winPtr); } } @@ -191,10 +191,10 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, w); #endif - Tk_Window tkwin = Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); - if (tkwin) { - TkGenWMDestroyEvent(tkwin); + if (winPtr) { + TkGenWMDestroyEvent((Tk_Window)winPtr); } /* @@ -202,14 +202,14 @@ extern NSString *NSWindowDidOrderOffScreenNotification; * can always return NO from -windowShouldClose: for a Tk window. */ - return (tkwin ? NO : YES); + return (winPtr ? NO : YES); } - (void) windowBecameVisible: (NSNotification *) notification { NSWindow *window = [notification object]; - Tk_Window tkwin = Tk_MacOSXGetTkWindow(window); - if (tkwin) { + TkWindow *winPtr = TkMacOSXGetTkWindow(window); + if (winPtr) { TKContentView *view = [window contentView]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { @@ -225,7 +225,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (void) windowMapped: (NSNotification *) notification { NSWindow *w = [notification object]; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} @@ -249,7 +249,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; { TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); NSWindow *w = [notification object]; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { //Tk_UnmapWindow((Tk_Window)winPtr); @@ -310,7 +310,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; */ for (NSWindow *win in [NSApp windows]) { - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(win); + TkWindow *winPtr = TkMacOSXGetTkWindow(win); if (!winPtr || !winPtr->wmInfoPtr) { continue; } @@ -933,7 +933,7 @@ ConfigureRestrictProc( (void)rect; #ifdef TK_MAC_DEBUG_DRAWING - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow([self window]); + TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); if (winPtr) { fprintf(stderr, "drawRect: drawing %s in %s\n", Tk_PathName(winPtr), NSStringFromRect(rect).UTF8String); @@ -966,7 +966,7 @@ ConfigureRestrictProc( { [super setFrameSize: newsize]; NSWindow *w = [self window]; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr = TkMacOSXGetTkWindow(w); Tk_Window tkwin = (Tk_Window)winPtr; if (![self inLiveResize] && @@ -1038,7 +1038,7 @@ ConfigureRestrictProc( unsigned long serial; int updatesNeeded; CGRect updateBounds; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow([self window]); + TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); ClientData oldArg; Tk_RestrictProc *oldProc; if (!winPtr) { @@ -1109,7 +1109,7 @@ static const char *const accentNames[] = { - (void) viewDidChangeEffectiveAppearance { - Tk_Window tkwin = Tk_MacOSXGetTkWindow([self window]); + Tk_Window tkwin = (Tk_Window)TkMacOSXGetTkWindow([self window]); if (!tkwin) { return; } @@ -1178,8 +1178,8 @@ static const char *const accentNames[] = { #endif XVirtualEvent event; int x, y; - Tk_Window tkwin = Tk_MacOSXGetTkWindow([self window]); - TkWindow *winPtr = (TkWindow *)tkwin; + TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); + Tk_Window tkwin = (Tk_Window)winPtr; (void)sender; if (!winPtr){ diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 7a2b7c4..fe33a0c 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -378,7 +378,7 @@ static void RemoveTransient(TkWindow *winPtr); - (void) tkLayoutChanged { - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(self); + TkWindow *winPtr = TkMacOSXGetTkWindow(self); if (winPtr) { NSRect frameRect; @@ -407,7 +407,7 @@ static void RemoveTransient(TkWindow *winPtr); #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101200) - (void)toggleTabBar:(id)sender { - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(self); + TkWindow *winPtr = TkMacOSXGetTkWindow(self); if (!winPtr) { return; } @@ -420,7 +420,7 @@ static void RemoveTransient(TkWindow *winPtr); toSize:(NSSize)frameSize { NSRect currentFrame = [sender frame]; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(sender); + TkWindow *winPtr = TkMacOSXGetTkWindow(sender); if (winPtr) { if (winPtr->wmInfoPtr->flags & WM_WIDTH_NOT_RESIZABLE) { frameSize.width = currentFrame.size.width; @@ -434,7 +434,7 @@ static void RemoveTransient(TkWindow *winPtr); - (BOOL) canBecomeKeyWindow { - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(self); + TkWindow *winPtr = TkMacOSXGetTkWindow(self); if (!winPtr || !winPtr->wmInfoPtr) { return NO; @@ -618,7 +618,7 @@ FrontWindowAtPoint( TkWindow *winPtr = NULL; for (NSWindow *w in windows) { - winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(w); + winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect windowFrame = [w frame]; @@ -1002,7 +1002,7 @@ TkWmDeadWindow( */ for (NSWindow *w in [NSApp orderedWindows]) { - TkWindow *winPtr2 = (TkWindow *)Tk_MacOSXGetTkWindow(w); + TkWindow *winPtr2 = TkMacOSXGetTkWindow(w); BOOL isOnScreen; if (!winPtr2 || !winPtr2->wmInfoPtr) { @@ -5490,7 +5490,7 @@ TkMacOSXZoomToplevel( short zoomPart) /* Either inZoomIn or inZoomOut */ { NSWindow *window = whichWindow; - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(window); + TkWindow *winPtr = TkMacOSXGetTkWindow(window); WmInfo *wmPtr; if (!winPtr || !winPtr->wmInfoPtr) { @@ -6480,7 +6480,7 @@ TkMacOSXWindowOffset( int *xOffset, int *yOffset) { - TkWindow *winPtr = (TkWindow *)Tk_MacOSXGetTkWindow(wRef); + TkWindow *winPtr = TkMacOSXGetTkWindow(wRef); if (winPtr && winPtr->wmInfoPtr) { *xOffset = winPtr->wmInfoPtr->xInParent; |