From c9ab6b090e48fa0dc6e18194dc636fdd47de179b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 27 Aug 2020 10:24:45 +0000 Subject: Some internal master -> container renamings, nothing related to API --- macosx/tkMacOSXWm.c | 160 ++++++++++++++++++++++++------------------------ macosx/tkMacOSXWm.h | 7 ++- macosx/tkMacOSXXStubs.c | 2 +- macosx/ttkMacOSXTheme.c | 24 ++++---- 4 files changed, 97 insertions(+), 96 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index aebf82c..1dc79e4 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -320,7 +320,7 @@ static int WmWinAppearance(Tcl_Interp *interp, TkWindow *winPtr, static void ApplyWindowAttributeFlagChanges(TkWindow *winPtr, NSWindow *macWindow, UInt64 oldAttributes, int oldFlags, int create, int initial); -static void ApplyMasterOverrideChanges(TkWindow *winPtr, +static void ApplyContainerOverrideChanges(TkWindow *winPtr, NSWindow *macWindow); static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr); @@ -892,7 +892,7 @@ TkWmDeadWindow( } /* - *If the dead window is a transient, remove it from the master's list. + *If the dead window is a transient, remove it from the container's list. */ RemoveTransient(winPtr); @@ -912,11 +912,11 @@ TkWmDeadWindow( ckfree(wmPtr->leaderName); } if (wmPtr->icon != NULL) { - wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr; + wmPtr2 = ((TkWindow *)wmPtr->icon)->wmInfoPtr; wmPtr2->iconFor = NULL; } if (wmPtr->iconFor != NULL) { - wmPtr2 = ((TkWindow *) wmPtr->iconFor)->wmInfoPtr; + wmPtr2 = ((TkWindow *)wmPtr->iconFor)->wmInfoPtr; wmPtr2->icon = NULL; wmPtr2->hints.flags &= ~IconWindowHint; } @@ -943,9 +943,9 @@ TkWmDeadWindow( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr) { + if (containerPtr == winPtr) { wmPtr2 = winPtr2->wmInfoPtr; wmPtr2->master = NULL; } @@ -1831,20 +1831,20 @@ WmDeiconifyCmd( /* * If this window has a transient, the transient must also be deiconified if - * it was withdrawn by the master. + * it was withdrawn by the container. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; WmInfo *wmPtr2 = winPtr2->wmInfoPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr) { + if (containerPtr == winPtr) { if ((wmPtr2->hints.initial_state == WithdrawnState) && - ((transientPtr->flags & WITHDRAWN_BY_MASTER) != 0)) { + ((transientPtr->flags & WITHDRAWN_BY_CONTAINER) != 0)) { TkpWmSetState(winPtr2, NormalState); - transientPtr->flags &= ~WITHDRAWN_BY_MASTER; + transientPtr->flags &= ~WITHDRAWN_BY_CONTAINER; } } } @@ -2376,17 +2376,17 @@ WmIconifyCmd( /* * If this window has a transient the transient must be withdrawn when - * the master is iconified. + * the container is iconified. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr && + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); - transientPtr->flags |= WITHDRAWN_BY_MASTER; + transientPtr->flags |= WITHDRAWN_BY_CONTAINER; } } @@ -2697,7 +2697,7 @@ WmIconwindowCmd( if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->hints.flags &= ~IconWindowHint; if (wmPtr->icon != NULL) { - wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr; + wmPtr2 = ((TkWindow *)wmPtr->icon)->wmInfoPtr; wmPtr2->iconFor = NULL; wmPtr2->hints.initial_state = WithdrawnState; } @@ -2714,7 +2714,7 @@ WmIconwindowCmd( NULL); return TCL_ERROR; } - wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr; + wmPtr2 = ((TkWindow *)tkwin2)->wmInfoPtr; if (wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is already an icon for %s", @@ -2973,7 +2973,7 @@ WmOverrideredirectCmd( } atts.override_redirect = flag ? True : False; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); - ApplyMasterOverrideChanges(winPtr, win); + ApplyContainerOverrideChanges(winPtr, win); return TCL_OK; } @@ -3607,8 +3607,8 @@ WmTransientCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - Tk_Window master; - TkWindow *masterPtr, *w; + Tk_Window container; + TkWindow *containerPtr, *w; WmInfo *wmPtr2; Transient *transient; @@ -3626,18 +3626,18 @@ WmTransientCmd( if (*Tcl_GetString(objv[3]) == '\0') { RemoveTransient(winPtr); } else { - if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[3], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = (TkWindow*) master; - while (!Tk_TopWinHierarchy(masterPtr)) { + containerPtr = (TkWindow*) container; + while (!Tk_TopWinHierarchy(containerPtr)) { /* - * Ensure that the master window is actually a Tk toplevel. + * Ensure that the container window is actually a Tk toplevel. */ - masterPtr = masterPtr->parentPtr; + containerPtr = containerPtr->parentPtr; } - Tk_MakeWindowExist((Tk_Window)masterPtr); + Tk_MakeWindowExist((Tk_Window)containerPtr); if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3647,7 +3647,7 @@ WmTransientCmd( return TCL_ERROR; } - wmPtr2 = masterPtr->wmInfoPtr; + wmPtr2 = containerPtr->wmInfoPtr; /* * Under some circumstances, wmPtr2 is NULL here. @@ -3661,19 +3661,19 @@ WmTransientCmd( return TCL_ERROR; } - for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL; + for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL; w = (TkWindow *)w->wmInfoPtr->master) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "setting \"%s\" as master creates a transient/master cycle", - Tk_PathName(masterPtr))); + Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } } /* - * Add the transient to the master's list, if it not already there. + * Add the transient to the container's list, if it not already there. */ for (transient = wmPtr2->transientPtr; @@ -3688,19 +3688,19 @@ WmTransientCmd( } /* - * If the master is withdrawn or iconic then withdraw the transient. + * If the container is withdrawn or iconic then withdraw the transient. */ if ((wmPtr2->hints.initial_state == WithdrawnState || wmPtr2->hints.initial_state == IconicState) && wmPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr, WithdrawnState); - transient->flags |= WITHDRAWN_BY_MASTER; + transient->flags |= WITHDRAWN_BY_CONTAINER; } - wmPtr->master = (Tk_Window) masterPtr; + wmPtr->master = (Tk_Window) containerPtr; } - ApplyMasterOverrideChanges(winPtr, NULL); + ApplyContainerOverrideChanges(winPtr, NULL); return TCL_OK; } @@ -3709,15 +3709,15 @@ WmTransientCmd( * * RemoveTransient -- * - * Clears the transient's master record and removes the transient from the - * master's list. + * Clears the transient's container record and removes the transient from the + * container's list. * * Results: * None * * Side effects: - * References to a master are removed from the transient's wmInfo - * structure and references to the transient are removed from its master's + * References to a container are removed from the transient's wmInfo + * structure and references to the transient are removed from its container's * wmInfo. * *---------------------------------------------------------------------- @@ -3728,18 +3728,18 @@ RemoveTransient( TkWindow *winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; - TkWindow *masterPtr; + TkWindow *containerPtr; Transient *transPtr, *temp; if (wmPtr == NULL || wmPtr->master == NULL) { return; } - masterPtr = (TkWindow *)wmPtr->master; - wmPtr2 = masterPtr->wmInfoPtr; + containerPtr = (TkWindow *)wmPtr->master; + wmPtr2 = containerPtr->wmInfoPtr; if (wmPtr2 == NULL) { return; } - wmPtr->master = NULL; + wmPtr->master= NULL; transPtr = wmPtr2->transientPtr; while (transPtr != NULL) { if (transPtr->winPtr != winPtr) { @@ -3810,12 +3810,12 @@ WmWithdrawCmd( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); - if (masterPtr == winPtr && + if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); - transientPtr->flags |= WITHDRAWN_BY_MASTER; + transientPtr->flags |= WITHDRAWN_BY_CONTAINER; } } @@ -3872,7 +3872,7 @@ Tk_SetGrid( int widthInc, int heightInc)/* Pixel increments corresponding to a change * of one grid unit. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr; /* @@ -3966,7 +3966,7 @@ Tk_UnsetGrid( Tk_Window tkwin) /* Token for window that is currently * controlling gridding. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr; /* @@ -4073,7 +4073,7 @@ TopLevelReqProc( TCL_UNUSED(void *), /* Not used. */ Tk_Window tkwin) /* Information about window. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr; wmPtr = winPtr->wmInfoPtr; @@ -4506,7 +4506,7 @@ Tk_GetRootCoords( int *yPtr) /* Where to store y-displacement of (0,0). */ { int x, y; - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; /* * Search back through this window's parents all the way to a top-level @@ -4533,11 +4533,11 @@ Tk_GetRootCoords( /* * We do not require that the changes.x & changes.y for a - * non-Tk master window be kept up to date. So we first - * subtract off the possibly bogus values that have been - * added on at the top of this pass through the loop, and - * then call out to the getOffsetProc to give us the - * correct offset. + * non-Tk container window be kept up to date. So we + * first subtract off the possibly bogus values that have + * been added on at the top of this pass through the + * loop, and then call out to the getOffsetProc to give + * us the correct offset. */ x -= winPtr->changes.x + winPtr->changes.border_width; @@ -4670,7 +4670,7 @@ Tk_CoordsToWindow( } winPtr = nextPtr; } - if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) { + if (winPtr->mainPtr != ((TkWindow *)tkwin)->mainPtr) { return NULL; } return (Tk_Window) winPtr; @@ -4713,7 +4713,7 @@ Tk_TopCoordsToWindow( int x, y; /* Coordinates in winPtr. */ Window *children; /* Children of winPtr, or NULL. */ - winPtr = (TkWindow *) tkwin; + winPtr = (TkWindow *)tkwin; x = rootX; y = rootY; while (1) { @@ -4867,7 +4867,7 @@ Tk_GetVRootGeometry( int *heightPtr) { WmInfo *wmPtr; - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; /* * Find the top-level window for tkwin, and locate the window manager @@ -4918,7 +4918,7 @@ Tk_MoveToplevelWindow( Tk_Window tkwin, /* Window to move. */ int x, int y) /* New location for window (within parent). */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; WmInfo *wmPtr = winPtr->wmInfoPtr; if (!(winPtr->flags & TK_TOP_LEVEL)) { @@ -5356,10 +5356,10 @@ TkSetWMName( * TkGetTransientMaster -- * * If the passed window has the TRANSIENT_FOR property set this will - * return the master window. Otherwise it will return None. + * return the container window. Otherwise it will return None. * * Results: - * The master window or None. + * The container window or None. * * Side effects: * None. @@ -6005,7 +6005,7 @@ TkpMakeMenuWindow( * is always visible, e.g. as a floating * menu. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; if (transient) { winPtr->wmInfoPtr->macClass = kSimpleWindowClass; @@ -6159,7 +6159,7 @@ TkMacOSXMakeRealWindowExist( atts.override_redirect = True; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); - ApplyMasterOverrideChanges(winPtr, NULL); + ApplyContainerOverrideChanges(winPtr, NULL); } } @@ -6183,7 +6183,7 @@ TkMacOSXMakeRealWindowExist( void TkpRedrawWidget(Tk_Window tkwin) { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; NSWindow *w; Rect tkBounds; NSRect bounds; @@ -6734,7 +6734,7 @@ TkMacOSXApplyWindowAttributes( ApplyWindowAttributeFlagChanges(winPtr, macWindow, 0, 0, 0, 1); if (wmPtr->master != NULL || winPtr->atts.override_redirect) { - ApplyMasterOverrideChanges(winPtr, macWindow); + ApplyContainerOverrideChanges(winPtr, macWindow); } } @@ -6927,9 +6927,9 @@ ApplyWindowAttributeFlagChanges( /* *---------------------------------------------------------------------- * - * ApplyMasterOverrideChanges -- + * ApplyContainerOverrideChanges -- * - * This procedure applies changes to override_redirect or master. + * This procedure applies changes to override_redirect or container. * * Results: * None. @@ -6941,7 +6941,7 @@ ApplyWindowAttributeFlagChanges( */ static void -ApplyMasterOverrideChanges( +ApplyContainerOverrideChanges( TkWindow *winPtr, NSWindow *macWindow) { @@ -7026,23 +7026,23 @@ ApplyMasterOverrideChanges( wmPtr->flags &= ~WM_TOPMOST; } if (wmPtr->master != None) { - TkWindow *masterWinPtr = (TkWindow *) wmPtr->master; + TkWindow *containerWinPtr = (TkWindow *)wmPtr->master; - if (masterWinPtr && (masterWinPtr->window != None) - && TkMacOSXHostToplevelExists(masterWinPtr)) { - NSWindow *masterMacWin = TkMacOSXDrawableWindow( - masterWinPtr->window); + if (containerWinPtr && (containerWinPtr->window != None) + && TkMacOSXHostToplevelExists(containerWinPtr)) { + NSWindow *containerMacWin = TkMacOSXDrawableWindow( + containerWinPtr->window); /* * Try to add the transient window as a child window of the - * master. A child NSWindow retains its relative position with - * respect to the parent when the parent is moved. This is - * pointless if the parent is offscreen, and adding a child to - * an offscreen window causes the parent to be displayed as a - * zombie. So we only do this if the parent is visible. + * container. A child NSWindow retains its relative position + * with respect to the parent when the parent is moved. This + * is pointless if the parent is offscreen, and adding a child + * to an offscreen window causes the parent to be displayed as + * a zombie. So we only do this if the parent is visible. */ - if (masterMacWin && [masterMacWin isVisible] + if (containerMacWin && [containerMacWin isVisible] && (winPtr->flags & TK_MAPPED)) { /* * If the transient is already a child of some other window, @@ -7050,11 +7050,11 @@ ApplyMasterOverrideChanges( */ parentWindow = [macWindow parentWindow]; - if (parentWindow && parentWindow != masterMacWin) { + if (parentWindow && parentWindow != containerMacWin) { [parentWindow removeChildWindow:macWindow]; } - [masterMacWin addChildWindow:macWindow + [containerMacWin addChildWindow:macWindow ordered:NSWindowAbove]; } } diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h index 20bbb6d..6696b05 100644 --- a/macosx/tkMacOSXWm.h +++ b/macosx/tkMacOSXWm.h @@ -37,7 +37,7 @@ typedef struct ProtocolHandler { } ProtocolHandler; /* The following data structure is used in the TkWmInfo to maintain a list of all of the - * transient windows belonging to a given master. + * transient windows belonging to a given container. */ typedef struct Transient { @@ -46,6 +46,7 @@ typedef struct Transient { struct Transient *nextPtr; } Transient; +#define WITHDRAWN_BY_CONTAINER 0x1 #define WITHDRAWN_BY_MASTER 0x1 /* @@ -65,8 +66,8 @@ typedef struct TkWmInfo { Tk_Uid titleUid; /* Title to display in window caption. If NULL, * use name of widget. */ char *iconName; /* Name to display in icon. */ - Tk_Window master; /* Master window for TRANSIENT_FOR property, or - * None. */ + Tk_Window master; /* Container window for TRANSIENT_FOR property, + * or None. */ XWMHints hints; /* Various pieces of information for window * manager. */ char *leaderName; /* Path name of leader of window group diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index e685e9f..ccb3991 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -1005,7 +1005,7 @@ Tk_GetUserInactiveTime( uint64_t time; IOReturn result; - regEntry = IOServiceGetMatchingService(kIOMasterPortDefault, + regEntry = IOServiceGetMatchingService(0, IOServiceMatching("IOHIDSystem")); if (regEntry == 0) { diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 0259a55..37d3631 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -242,11 +242,11 @@ static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0}; * GetBackgroundColor -- * * Fills the array rgba with the color coordinates for a background color. - * Start with the background color of a window's geometry master, or the - * standard ttk window background if there is no master. If the contrast - * parameter is nonzero, modify this color to be darker, for the aqua - * appearance, or lighter for the DarkAqua appearance. This is primarily - * used by the Fill and Background elements. + * Start with the background color of a window's geometry container, or + * the standard ttk window background if there is no container. If the + * contrast parameter is nonzero, modify this color to be darker, for the + * aqua appearance, or lighter for the DarkAqua appearance. This is + * primarily used by the Fill and Background elements. */ static void GetBackgroundColor( @@ -255,18 +255,18 @@ static void GetBackgroundColor( int contrast, CGFloat *rgba) { - TkWindow *winPtr = (TkWindow *) tkwin; - TkWindow *masterPtr = (TkWindow *) TkGetGeomMaster(tkwin); + TkWindow *winPtr = (TkWindow *)tkwin; + TkWindow *containerPtr = (TkWindow *)TkGetGeomMaster(tkwin); - while (masterPtr && masterPtr->privatePtr) { - if (masterPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { + while (containerPtr && containerPtr->privatePtr) { + if (containerPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { break; } - masterPtr = (TkWindow *) TkGetGeomMaster(masterPtr); + containerPtr = (TkWindow *)TkGetGeomMaster(containerPtr); } - if (masterPtr && masterPtr->privatePtr) { + if (containerPtr && containerPtr->privatePtr) { for (int i = 0; i < 4; i++) { - rgba[i] = masterPtr->privatePtr->fillRGBA[i]; + rgba[i] = containerPtr->privatePtr->fillRGBA[i]; } } else { if ([NSApp macOSVersion] > 101300) { -- cgit v0.12