diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-02 13:28:19 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-02 13:28:19 (GMT) |
commit | d8bc430e7ea96f8e935ddcc710b9891d10eaf234 (patch) | |
tree | 920938575d791db0c845215e46b9fcfb562a811c /generic | |
parent | 861f2926fd2d6d1f1726e0ec37c1bd4e55c7a395 (diff) | |
parent | e91f3d0c6bcf6195288c6681ec3dccbcbb6e499c (diff) | |
download | tk-d8bc430e7ea96f8e935ddcc710b9891d10eaf234.zip tk-d8bc430e7ea96f8e935ddcc710b9891d10eaf234.tar.gz tk-d8bc430e7ea96f8e935ddcc710b9891d10eaf234.tar.bz2 |
Implement TIP #580: Export Tk_GetDoublePixelsFromObj and 5 more
Diffstat (limited to 'generic')
37 files changed, 173 insertions, 97 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index c756749..31e107d 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1069,6 +1069,28 @@ declare 273 { void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr) } +# TIP#580 +declare 274 { + int Tk_AlwaysShowSelection(Tk_Window tkwin) +} +declare 275 { + unsigned Tk_GetButtonMask(unsigned button) +} +declare 276 { + int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin, + Tcl_Obj *objPtr, double *doublePtr) +} +declare 277 { + Tcl_Obj *Tk_NewWindowObj(Tk_Window tkwin) +} +declare 278 { + void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName, + Tcl_Obj *detail) +} +declare 279 { + Tcl_Obj *Tk_FontGetDescription(Tk_Font tkfont) +} + # Define the platform specific public Tk interface. These functions are # only available on the designated platform. diff --git a/generic/tkBind.c b/generic/tkBind.c index c88c54b..66a7447 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -5003,7 +5003,7 @@ ParseEventDescription( "NON_BUTTON"); } #if SUPPORT_ADDITIONAL_MOTION_SYNTAX - patPtr->modMask |= TkGetButtonMask(button); + patPtr->modMask |= Tk_GetButtonMask(button); p = SkipFieldDelims(p); while (*p && *p != '>') { p = SkipFieldDelims(GetField(p, field, sizeof(field))); @@ -5013,7 +5013,7 @@ ParseEventDescription( patPtr, 0, Tcl_ObjPrintf("bad button number \"%s\"", field), "BUTTON"); } - patPtr->modMask |= TkGetButtonMask(button); + patPtr->modMask |= Tk_GetButtonMask(button); } patPtr->info = ButtonNumberFromState(patPtr->modMask); #endif @@ -5200,7 +5200,7 @@ GetPatternObj( while (mask & ALL_BUTTONS) { unsigned button = ButtonNumberFromState(mask); Tcl_AppendPrintfToObj(patternObj, "-%u", button); - mask &= ~TkGetButtonMask(button); + mask &= ~Tk_GetButtonMask(button); } break; } diff --git a/generic/tkBusy.c b/generic/tkBusy.c index f639b59..5925381 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -900,7 +900,7 @@ Tk_BusyObjCmd( if (pattern == NULL || Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) { Tcl_ListObjAppendElement(interp, objPtr, - TkNewWindowObj(busyPtr->tkRef)); + Tk_NewWindowObj(busyPtr->tkRef)); } } Tcl_SetObjResult(interp, objPtr); diff --git a/generic/tkButton.c b/generic/tkButton.c index 8056f31..69d4b12 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -760,7 +760,7 @@ ButtonCreate( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(butPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(butPtr->tkwin)); return TCL_OK; } diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 5d87539..c3e8a7f 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -799,7 +799,7 @@ Tk_CanvasObjCmd( goto error; } - Tcl_SetObjResult(interp, TkNewWindowObj(canvasPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(canvasPtr->tkwin)); return TCL_OK; error: @@ -5095,7 +5095,7 @@ CanvasBindProc( switch (eventPtr->type) { case ButtonPress: case ButtonRelease: - mask = TkGetButtonMask(eventPtr->xbutton.button); + mask = Tk_GetButtonMask(eventPtr->xbutton.button); /* * For button press events, repick the current item using the button diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 8753b2d..bb2fdd4 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -878,6 +878,21 @@ EXTERN void Tk_CreateOldImageType(const Tk_ImageType *typePtr); /* 273 */ EXTERN void Tk_CreateOldPhotoImageFormat( const Tk_PhotoImageFormat *formatPtr); +/* 274 */ +EXTERN int Tk_AlwaysShowSelection(Tk_Window tkwin); +/* 275 */ +EXTERN unsigned Tk_GetButtonMask(unsigned button); +/* 276 */ +EXTERN int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, + Tk_Window tkwin, Tcl_Obj *objPtr, + double *doublePtr); +/* 277 */ +EXTERN Tcl_Obj * Tk_NewWindowObj(Tk_Window tkwin); +/* 278 */ +EXTERN void Tk_SendVirtualEvent(Tk_Window tkwin, + const char *eventName, Tcl_Obj *detail); +/* 279 */ +EXTERN Tcl_Obj * Tk_FontGetDescription(Tk_Font tkfont); typedef struct { const struct TkPlatStubs *tkPlatStubs; @@ -1164,6 +1179,12 @@ typedef struct TkStubs { Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */ void (*tk_CreateOldImageType) (const Tk_ImageType *typePtr); /* 272 */ void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */ + int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */ + unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */ + int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */ + Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */ + void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */ + Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */ } TkStubs; extern const TkStubs *tkStubsPtr; @@ -1724,6 +1745,18 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_CreateOldImageType) /* 272 */ #define Tk_CreateOldPhotoImageFormat \ (tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */ +#define Tk_AlwaysShowSelection \ + (tkStubsPtr->tk_AlwaysShowSelection) /* 274 */ +#define Tk_GetButtonMask \ + (tkStubsPtr->tk_GetButtonMask) /* 275 */ +#define Tk_GetDoublePixelsFromObj \ + (tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */ +#define Tk_NewWindowObj \ + (tkStubsPtr->tk_NewWindowObj) /* 277 */ +#define Tk_SendVirtualEvent \ + (tkStubsPtr->tk_SendVirtualEvent) /* 278 */ +#define Tk_FontGetDescription \ + (tkStubsPtr->tk_FontGetDescription) /* 279 */ #endif /* defined(USE_TK_STUBS) */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index f8db7e5..fbb7e29 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -574,7 +574,7 @@ Tk_EntryObjCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin)); return TCL_OK; } @@ -1684,7 +1684,7 @@ DisplayEntry( * Hide the selection whenever we don't have the focus, unless we * always want to show selection. */ - if (TkpAlwaysShowSelection(entryPtr->tkwin)) { + if (Tk_AlwaysShowSelection(entryPtr->tkwin)) { showSelection = 1; } else { showSelection = (entryPtr->flags & GOT_FOCUS); @@ -2978,7 +2978,7 @@ EntryLostSelection( * This is controlled by ::tk::AlwaysShowSelection. */ - if (TkpAlwaysShowSelection(entryPtr->tkwin) + if (Tk_AlwaysShowSelection(entryPtr->tkwin) && (entryPtr->selectFirst != TCL_INDEX_NONE) && entryPtr->exportSelection && (!Tcl_IsSafe(entryPtr->interp))) { entryPtr->selectFirst = TCL_INDEX_NONE; @@ -3807,7 +3807,7 @@ Tk_SpinboxObjCmd( goto error; } - Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin)); return TCL_OK; error: diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 6422453..c94ad50 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -513,7 +513,7 @@ RefreshKeyboardMappingIfNeeded( /* *---------------------------------------------------------------------- * - * TkGetButtonMask -- + * Tk_GetButtonMask -- * * Return the proper Button${n}Mask for the button. * @@ -532,7 +532,7 @@ static const unsigned buttonMasks[] = { }; unsigned -TkGetButtonMask( +Tk_GetButtonMask( unsigned button) { return (button > Button9) ? 0 : buttonMasks[button]; diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 8066afd..f6afcd8 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -128,7 +128,7 @@ Tk_FocusObjCmd( Tk_Window focusWin = (Tk_Window) TkGetFocusWin(winPtr); if (focusWin != NULL) { - Tcl_SetObjResult(interp, TkNewWindowObj(focusWin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(focusWin)); } return TCL_OK; } @@ -179,7 +179,7 @@ Tk_FocusObjCmd( } newPtr = TkGetFocusWin(newPtr); if (newPtr != NULL) { - Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) newPtr)); + Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) newPtr)); } break; case 1: /* -force */ @@ -212,12 +212,12 @@ Tk_FocusObjCmd( for (tlFocusPtr = newPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL; tlFocusPtr = tlFocusPtr->nextPtr) { if (tlFocusPtr->topLevelPtr == topLevelPtr) { - Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) + Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) tlFocusPtr->focusWinPtr)); return TCL_OK; } } - Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) topLevelPtr)); + Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) topLevelPtr)); return TCL_OK; } break; diff --git a/generic/tkFont.c b/generic/tkFont.c index d132c0f..67d0b36 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -3576,6 +3576,57 @@ GetAttributeInfoObj( /* *--------------------------------------------------------------------------- * + * Tk_FontGetDescription -- + * + * Return information about the font description as a Tcl list. One + * possible result is "{{DejaVu Sans} -16 bold underline}". + * + * Results: + * The list of descriptions. + * + * Side effects: + * None. + * + *--------------------------------------------------------------------------- + */ + +Tcl_Obj * +Tk_FontGetDescription( + Tk_Font tkfont) /* Font whose description is desired. */ +{ + const TkFontAttributes *faPtr = GetFontAttributes(tkfont); + Tcl_Obj *resultPtr = Tcl_NewObj(); + const char *str; + + str = faPtr->family; + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, str ? -1 : 0)); + if (faPtr->size >= 0.0) { + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj((int)(faPtr->size + 0.5))); + } else { + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj(-(int)(-faPtr->size + 0.5))); + } + if (faPtr->weight != TK_FW_NORMAL) { + str = TkFindStateString(weightMap, faPtr->weight); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + } + if (faPtr->slant != TK_FS_ROMAN) { + str = TkFindStateString(slantMap, faPtr->slant); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + } + if (faPtr->underline) { + str = TkFindStateString(underlineMap, faPtr->underline); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + } + if (faPtr->overstrike) { + str = TkFindStateString(overstrikeMap, faPtr->overstrike); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + } + return resultPtr; +} + +/* + *--------------------------------------------------------------------------- + * * ParseFontNameObj -- * * Converts a object into a set of font attributes that can be used to diff --git a/generic/tkFrame.c b/generic/tkFrame.c index df370af..726594a 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -732,7 +732,7 @@ CreateFrame( if (type == TYPE_TOPLEVEL) { Tcl_DoWhenIdle(MapFrame, framePtr); } - Tcl_SetObjResult(interp, TkNewWindowObj(newWin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(newWin)); return TCL_OK; error: diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 3e4d9db..87bfdde 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -270,7 +270,7 @@ Tk_GrabObjCmd( } dispPtr = ((TkWindow *) tkwin)->dispPtr; if (dispPtr->eventualGrabWinPtr != NULL) { - Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) + Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) dispPtr->eventualGrabWinPtr)); } } else { @@ -279,7 +279,7 @@ Tk_GrabObjCmd( for (dispPtr = TkGetDisplayList(); dispPtr != NULL; dispPtr = dispPtr->nextPtr) { if (dispPtr->eventualGrabWinPtr != NULL) { - Tcl_ListObjAppendElement(NULL, resultObj, TkNewWindowObj( + Tcl_ListObjAppendElement(NULL, resultObj, Tk_NewWindowObj( (Tk_Window) dispPtr->eventualGrabWinPtr)); } } @@ -896,7 +896,7 @@ TkPointerEvent( } else { if (eventPtr->xbutton.button != AnyButton && ((eventPtr->xbutton.state & ALL_BUTTONS) - == TkGetButtonMask(eventPtr->xbutton.button))) { + == Tk_GetButtonMask(eventPtr->xbutton.button))) { ReleaseButtonGrab(dispPtr); /* Note 4. */ } } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 32246ae..6ad77dc 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -739,7 +739,7 @@ GridInfoCommand( infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + Tk_NewWindowObj(slavePtr->masterPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), Tcl_NewWideIntObj(slavePtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), @@ -1400,7 +1400,7 @@ GridSlavesCommand( slavePtr->row+slavePtr->numRows-1 < row)) { continue; } - Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(slavePtr->tkwin)); + Tcl_ListObjAppendElement(interp,res, Tk_NewWindowObj(slavePtr->tkwin)); } Tcl_SetObjResult(interp, res); return TCL_OK; @@ -2786,7 +2786,7 @@ Unlink( if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; - TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); + Tk_SendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); } } @@ -3529,7 +3529,7 @@ ConfigureSlaves( if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; - TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); + Tk_SendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); } return TCL_OK; diff --git a/generic/tkInt.h b/generic/tkInt.h index 89b0ff3..4785266 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1036,8 +1036,6 @@ typedef struct TkpClipMask { |Button6Mask|Button7Mask|Button8Mask|Button9Mask) -MODULE_SCOPE unsigned TkGetButtonMask(unsigned); - /* * Object types not declared in tkObj.c need to be mentioned here so they can * be properly registered with Tcl: @@ -1269,9 +1267,6 @@ MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData, MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, - Tk_Window tkwin, Tcl_Obj *objPtr, - double *doublePtr); MODULE_SCOPE int TkSetGeometryMaster(Tcl_Interp *interp, Tk_Window tkwin, const char *master); MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin, @@ -1317,7 +1312,6 @@ MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, int *pad1Ptr, int *pad2Ptr); MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr); MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr); -MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin); MODULE_SCOPE void TkpDrawCharsInContext(Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, int rangeStart, @@ -1339,7 +1333,6 @@ MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); -MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin); MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, @@ -1349,8 +1342,6 @@ MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, TkBusy busy); MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, int flags); -MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin, - const char *eventName, Tcl_Obj *detail); MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, const char *nsname, const char *name, ClientData clientData, const TkEnsemble *map); diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 6a90b3c..7bca20e 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -579,7 +579,7 @@ Tk_ListboxObjCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(listPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(listPtr->tkwin)); return TCL_OK; } @@ -3229,7 +3229,7 @@ static void GenerateListboxSelectEvent( Listbox *listPtr) /* Information about widget. */ { - TkSendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL); + Tk_SendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL); } /* diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 6ba569e..3b648ff 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -593,7 +593,7 @@ Tk_MenuObjCmd( } } - Tcl_SetObjResult(interp, TkNewWindowObj(menuPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(menuPtr->tkwin)); return TCL_OK; } diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 625766f..b12e0eb 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -318,7 +318,7 @@ Tk_MenubuttonObjCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(mbPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(mbPtr->tkwin)); return TCL_OK; } diff --git a/generic/tkMessage.c b/generic/tkMessage.c index f7d1a33..8bd8573 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -278,7 +278,7 @@ Tk_MessageObjCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(msgPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(msgPtr->tkwin)); return TCL_OK; } diff --git a/generic/tkObj.c b/generic/tkObj.c index 80338ee..7f3b7ff 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -1057,7 +1057,7 @@ FreeWindowInternalRep( /* *---------------------------------------------------------------------- * - * TkNewWindowObj -- + * Tk_NewWindowObj -- * * This function allocates a new Tcl_Obj that refers to a particular to a * particular Tk window. @@ -1072,7 +1072,7 @@ FreeWindowInternalRep( */ Tcl_Obj * -TkNewWindowObj( +Tk_NewWindowObj( Tk_Window tkwin) { Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); diff --git a/generic/tkPack.c b/generic/tkPack.c index 796530a..2fb3a25 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -358,7 +358,7 @@ Tk_PackObjCmd( infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + Tk_NewWindowObj(slavePtr->masterPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1), Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1), @@ -462,7 +462,7 @@ Tk_PackObjCmd( for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj(slavePtr->tkwin)); + Tk_NewWindowObj(slavePtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; @@ -1382,7 +1382,7 @@ Unlink( if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { TkFreeGeometryMaster(masterPtr->tkwin, "pack"); masterPtr->flags &= ~ALLOCED_MASTER; - TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); + Tk_SendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); } } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 05ddcca..d8e149b 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -507,7 +507,7 @@ Tk_PanedWindowObjCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(pwPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(pwPtr->tkwin)); return TCL_OK; } @@ -730,7 +730,7 @@ PanedWindowWidgetObjCmd( resultObj = Tcl_NewObj(); for (i = 0; i < pwPtr->numSlaves; i++) { Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj(pwPtr->slaves[i]->tkwin)); + Tk_NewWindowObj(pwPtr->slaves[i]->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 2b5ab2d..66c31d9 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -344,7 +344,7 @@ Tk_PlaceObjCmd( for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, listPtr, - TkNewWindowObj(slavePtr->tkwin)); + Tk_NewWindowObj(slavePtr->tkwin)); } Tcl_SetObjResult(interp, listPtr); } @@ -806,7 +806,7 @@ PlaceInfoCommand( if (slavePtr->masterPtr != NULL) { Tcl_AppendToObj(infoObj, "-in", -1); Tcl_ListObjAppendElement(NULL, infoObj, - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + Tk_NewWindowObj(slavePtr->masterPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", -1); } Tcl_AppendPrintfToObj(infoObj, diff --git a/generic/tkPointer.c b/generic/tkPointer.c index bb16463..aa739d4 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -255,7 +255,7 @@ Tk_UpdatePointer( */ for (b = Button1; b <= Button9; b++) { - mask = TkGetButtonMask(b); + mask = Tk_GetButtonMask(b); if (changes & mask) { if (state & mask) { type = ButtonPress; diff --git a/generic/tkScale.c b/generic/tkScale.c index d26f4e0..f1e2cec 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -357,7 +357,7 @@ Tk_ScaleObjCmd( scalePtr->flags &= ~INVOKE_COMMAND; - Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(scalePtr->tkwin)); return TCL_OK; } diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 600c7d7..0d31a80 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -196,7 +196,7 @@ Tk_ScrollbarObjCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(scrollPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(scrollPtr->tkwin)); return TCL_OK; } diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 58c54f5..a45aa4b 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -992,7 +992,7 @@ Tk_SelectionObjCmd( if ((infoPtr != NULL) && (infoPtr->owner != winPtr->dispPtr->clipWindow)) { - Tcl_SetObjResult(interp, TkNewWindowObj(infoPtr->owner)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(infoPtr->owner)); } return TCL_OK; } diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index fbd9295..a5d98ef 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -1319,6 +1319,12 @@ const TkStubs tkStubs = { Tk_Interp, /* 271 */ Tk_CreateOldImageType, /* 272 */ Tk_CreateOldPhotoImageFormat, /* 273 */ + Tk_AlwaysShowSelection, /* 274 */ + Tk_GetButtonMask, /* 275 */ + Tk_GetDoublePixelsFromObj, /* 276 */ + Tk_NewWindowObj, /* 277 */ + Tk_SendVirtualEvent, /* 278 */ + Tk_FontGetDescription, /* 279 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkText.c b/generic/tkText.c index d7d7102..0eb256f 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -670,7 +670,7 @@ CreateWidget( return TCL_ERROR; } - Tcl_SetObjResult(interp, TkNewWindowObj(textPtr->tkwin)); + Tcl_SetObjResult(interp, Tk_NewWindowObj(textPtr->tkwin)); return TCL_OK; } @@ -1753,7 +1753,7 @@ TextPeerCmd( while (tPtr != NULL) { if (tPtr != textPtr) { Tcl_ListObjAppendElement(NULL, peersObj, - TkNewWindowObj(tPtr->tkwin)); + Tk_NewWindowObj(tPtr->tkwin)); } tPtr = tPtr->next; } @@ -3557,7 +3557,7 @@ TkTextLostSelection( { TkText *textPtr = (TkText *)clientData; - if (TkpAlwaysShowSelection(textPtr->tkwin)) { + if (Tk_AlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) { @@ -3615,7 +3615,7 @@ TkTextSelectionEvent( * event generate $textWidget <<Selection>> */ - TkSendVirtualEvent(textPtr->tkwin, "Selection", NULL); + Tk_SendVirtualEvent(textPtr->tkwin, "Selection", NULL); } /* @@ -5490,7 +5490,7 @@ GenerateModifiedEvent( for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL; textPtr = textPtr->next) { Tk_MakeWindowExist(textPtr->tkwin); - TkSendVirtualEvent(textPtr->tkwin, "Modified", NULL); + Tk_SendVirtualEvent(textPtr->tkwin, "Modified", NULL); } } @@ -5520,7 +5520,7 @@ GenerateUndoStackEvent( for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL; textPtr = textPtr->next) { Tk_MakeWindowExist(textPtr->tkwin); - TkSendVirtualEvent(textPtr->tkwin, "UndoStack", NULL); + Tk_SendVirtualEvent(textPtr->tkwin, "UndoStack", NULL); } } diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 847a971..abcd3e3 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -3164,8 +3164,8 @@ GenerateWidgetViewSyncEvent( } else { textPtr->dInfoPtr->flags |= OUT_OF_SYNC; } - TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync", - Tcl_NewBooleanObj(NewSyncState)); + Tk_SendVirtualEvent(textPtr->tkwin, "WidgetViewSync", + Tcl_NewBooleanObj(NewSyncState)); } } diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 2050cc8..2bd321d 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1459,7 +1459,7 @@ TkTextBindProc( } else if (eventPtr->type == ButtonRelease) { unsigned long mask; - mask = TkGetButtonMask(eventPtr->xbutton.button); + mask = Tk_GetButtonMask(eventPtr->xbutton.button); if ((eventPtr->xbutton.state & ALL_BUTTONS) == mask) { textPtr->flags &= ~BUTTON_DOWN; repick = 1; diff --git a/generic/tkUtil.c b/generic/tkUtil.c index f7b839a..6ff1ee0 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1157,7 +1157,7 @@ TkMakeEnsemble( /* *---------------------------------------------------------------------- * - * TkSendVirtualEvent -- + * Tk_SendVirtualEvent -- * * Send a virtual event notification to the specified target window. * Equivalent to: @@ -1170,7 +1170,7 @@ TkMakeEnsemble( */ void -TkSendVirtualEvent( +Tk_SendVirtualEvent( Tk_Window target, const char *eventName, Tcl_Obj *detail) diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 288d9b7..45ca5e6 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -2692,7 +2692,7 @@ Tk_GetNumMainWindows(void) /* *---------------------------------------------------------------------- * - * TkpAlwaysShowSelection -- + * Tk_AlwaysShowSelection -- * * Indicates whether text/entry widgets should always display * their selection, regardless of window focus. @@ -2710,7 +2710,7 @@ Tk_GetNumMainWindows(void) */ int -TkpAlwaysShowSelection( +Tk_AlwaysShowSelection( Tk_Window tkwin) /* Window whose application is to be * checked. */ { diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index f14a2db..4a43253 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -124,28 +124,6 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) # undef SETFLAGS } -/* TtkSendVirtualEvent -- - * Send a virtual event notification to the specified target window. - * Equivalent to "event generate $tgtWindow <<$eventName>>" - * - * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent, - * so this routine does not reenter the interpreter. - */ -void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName) -{ - union {XEvent general; XVirtualEvent virt;} event; - - memset(&event, 0, sizeof(event)); - event.general.xany.type = VirtualEvent; - event.general.xany.serial = NextRequest(Tk_Display(tgtWin)); - event.general.xany.send_event = False; - event.general.xany.window = Tk_WindowId(tgtWin); - event.general.xany.display = Tk_Display(tgtWin); - event.virt.name = Tk_GetUid(eventName); - - Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); -} - /* TtkEnumerateOptions, TtkGetOptionValue -- * Common factors for data accessor commands. */ diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 2f02826..95125d3 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -631,7 +631,7 @@ static void SelectTab(Notebook *nb, TkSizeT index) NotebookPlaceSlave(nb, index); TtkRedisplayWidget(&nb->core); - TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); + Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL); } /* NextTab -- @@ -683,7 +683,7 @@ static void SelectNearestTab(Notebook *nb) Ttk_UnmapSlave(nb->notebook.mgr, currentIndex); } if (currentIndex != nextIndex) { - TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); + Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL); } nb->notebook.currentIndex = nextIndex; diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 734fc34..09b633b 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -486,7 +486,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr) if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { - TtkSendVirtualEvent(corePtr->tkwin, "EnteredChild"); + Tk_SendVirtualEvent(corePtr->tkwin, "EnteredChild", NULL); } } diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index aa89052..4ea4c17 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -2727,7 +2727,7 @@ static int TreeviewDeleteCommand( ckfree(items); if (selItemDeleted) { - TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect"); + Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL); } TtkRedisplayWidget(&tv->core); return TCL_OK; @@ -3006,7 +3006,7 @@ static int TreeviewSelectionCommand( } ckfree(items); - TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect"); + Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL); TtkRedisplayWidget(&tv->core); return TCL_OK; diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index 6837d89..2eeab4e 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -165,11 +165,6 @@ MODULE_SCOPE void Ttk_UntraceVariable(Ttk_TraceHandle *); MODULE_SCOPE int Ttk_FireTrace(Ttk_TraceHandle *); /* - * Virtual events: - */ -MODULE_SCOPE void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName); - -/* * Helper routines for data accessor commands: */ MODULE_SCOPE int TtkEnumerateOptions( |