summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.decls4
-rw-r--r--generic/tkInt.decls30
-rw-r--r--generic/tkIntPlatDecls.h60
-rw-r--r--generic/tkPlatDecls.h8
-rw-r--r--generic/tkUtil.c83
5 files changed, 133 insertions, 52 deletions
diff --git a/generic/tk.decls b/generic/tk.decls
index f08f2ef..50b2837 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -1127,10 +1127,10 @@ declare 6 aqua {
void TkMacOSXInvalClipRgns(Tk_Window tkwin)
}
declare 7 aqua {
- GWorldPtr TkMacOSXGetDrawablePort(Drawable drawable)
+ void *TkMacOSXGetDrawablePort(Drawable drawable)
}
declare 8 aqua {
- ControlRef TkMacOSXGetRootControl(Drawable drawable)
+ void *TkMacOSXGetRootControl(Drawable drawable)
}
declare 9 aqua {
void Tk_MacOSXSetupTkNotifier(void)
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index c6e4bc7..84e1bc3 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -834,22 +834,22 @@ declare 12 aqua {
#}
declare 14 aqua {
- int TkMacOSXDoHLEvent(EventRecord *theEvent)
+ int TkMacOSXDoHLEvent(void *theEvent)
}
# removed duplicate from tkPlat table(tk.decls)
#declare 15 aqua {
-# GWorldPtr TkMacOSXGetDrawablePort(Drawable drawable)
+# void *TkMacOSXGetDrawablePort(Drawable drawable)
#}
declare 16 aqua {
- Window TkMacOSXGetXWindow(WindowRef macWinPtr)
+ Window TkMacOSXGetXWindow(void *macWinPtr)
}
declare 17 aqua {
- int TkMacOSXGrowToplevel(WindowRef whichWindow, Point start)
+ int TkMacOSXGrowToplevel(void *whichWindow, XPoint start)
}
declare 18 aqua {
- void TkMacOSXHandleMenuSelect(MenuID theMenu, MenuItemIndex theItem,
+ void TkMacOSXHandleMenuSelect(short theMenu, unsigned short theItem,
int optionKeyPressed)
}
@@ -872,13 +872,13 @@ declare 23 aqua {
void TkMacOSXMakeRealWindowExist(TkWindow *winPtr)
}
declare 24 aqua {
- BitMapPtr TkMacOSXMakeStippleMap(Drawable d1, Drawable d2)
+ void * TkMacOSXMakeStippleMap(Drawable d1, Drawable d2)
}
declare 25 aqua {
void TkMacOSXMenuClick(void)
}
declare 26 aqua {
- void TkMacOSXRegisterOffScreenWindow(Window window, GWorldPtr portPtr)
+ void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr)
}
declare 27 aqua {
int TkMacOSXResizable(TkWindow *winPtr)
@@ -893,28 +893,28 @@ declare 30 aqua {
void TkMacOSXSetUpClippingRgn(Drawable drawable)
}
declare 31 aqua {
- void TkMacOSXSetUpGraphicsPort(GC gc, GWorldPtr destPort)
+ void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort)
}
declare 32 aqua {
void TkMacOSXUpdateClipRgn(TkWindow *winPtr)
}
declare 33 aqua {
- void TkMacOSXUnregisterMacWindow(WindowRef portPtr)
+ void TkMacOSXUnregisterMacWindow(void *portPtr)
}
declare 34 aqua {
int TkMacOSXUseMenuID(short macID)
}
declare 35 aqua {
- RgnHandle TkMacOSXVisableClipRgn(TkWindow *winPtr)
+ TkRegion TkMacOSXVisableClipRgn(TkWindow *winPtr)
}
declare 36 aqua {
- void TkMacOSXWinBounds(TkWindow *winPtr, Rect *geometry)
+ void TkMacOSXWinBounds(TkWindow *winPtr, void *geometry)
}
declare 37 aqua {
- void TkMacOSXWindowOffset(WindowRef wRef, int *xOffset, int *yOffset)
+ void TkMacOSXWindowOffset(void *wRef, int *xOffset, int *yOffset)
}
declare 38 aqua {
- int TkSetMacColor(unsigned long pixel, RGBColor *macColor)
+ int TkSetMacColor(unsigned long pixel, void *macColor)
}
declare 39 aqua {
void TkSetWMName(TkWindow *winPtr, Tk_Uid titleUid)
@@ -923,7 +923,7 @@ declare 40 aqua {
void TkSuspendClipboard(void)
}
declare 41 aqua {
- int TkMacOSXZoomToplevel(WindowPtr whichWindow, short zoomPart)
+ int TkMacOSXZoomToplevel(void *whichWindow, short zoomPart)
}
declare 42 aqua {
Tk_Window Tk_TopCoordsToWindow(Tk_Window tkwin, int rootX, int rootY,
@@ -939,7 +939,7 @@ declare 45 aqua {
void TkMacOSXPreprocessMenu(void)
}
declare 46 aqua {
- int TkpIsWindowFloating(WindowRef window)
+ int TkpIsWindowFloating(void *window)
}
declare 47 aqua {
Tk_Window TkMacOSXGetCapture(void)
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index d0753f1..5418473 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -337,25 +337,24 @@ EXTERN void TkMacOSXHandleTearoffMenu(void);
#ifndef TkMacOSXDoHLEvent_TCL_DECLARED
#define TkMacOSXDoHLEvent_TCL_DECLARED
/* 14 */
-EXTERN int TkMacOSXDoHLEvent(EventRecord *theEvent);
+EXTERN int TkMacOSXDoHLEvent(VOID *theEvent);
#endif
/* Slot 15 is reserved */
#ifndef TkMacOSXGetXWindow_TCL_DECLARED
#define TkMacOSXGetXWindow_TCL_DECLARED
/* 16 */
-EXTERN Window TkMacOSXGetXWindow(WindowRef macWinPtr);
+EXTERN Window TkMacOSXGetXWindow(VOID *macWinPtr);
#endif
#ifndef TkMacOSXGrowToplevel_TCL_DECLARED
#define TkMacOSXGrowToplevel_TCL_DECLARED
/* 17 */
-EXTERN int TkMacOSXGrowToplevel(WindowRef whichWindow,
- Point start);
+EXTERN int TkMacOSXGrowToplevel(VOID *whichWindow, XPoint start);
#endif
#ifndef TkMacOSXHandleMenuSelect_TCL_DECLARED
#define TkMacOSXHandleMenuSelect_TCL_DECLARED
/* 18 */
-EXTERN void TkMacOSXHandleMenuSelect(MenuID theMenu,
- MenuItemIndex theItem, int optionKeyPressed);
+EXTERN void TkMacOSXHandleMenuSelect(short theMenu,
+ unsigned short theItem, int optionKeyPressed);
#endif
/* Slot 19 is reserved */
/* Slot 20 is reserved */
@@ -379,7 +378,7 @@ EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr);
#ifndef TkMacOSXMakeStippleMap_TCL_DECLARED
#define TkMacOSXMakeStippleMap_TCL_DECLARED
/* 24 */
-EXTERN BitMapPtr TkMacOSXMakeStippleMap(Drawable d1, Drawable d2);
+EXTERN VOID * TkMacOSXMakeStippleMap(Drawable d1, Drawable d2);
#endif
#ifndef TkMacOSXMenuClick_TCL_DECLARED
#define TkMacOSXMenuClick_TCL_DECLARED
@@ -390,7 +389,7 @@ EXTERN void TkMacOSXMenuClick(void);
#define TkMacOSXRegisterOffScreenWindow_TCL_DECLARED
/* 26 */
EXTERN void TkMacOSXRegisterOffScreenWindow(Window window,
- GWorldPtr portPtr);
+ VOID *portPtr);
#endif
#ifndef TkMacOSXResizable_TCL_DECLARED
#define TkMacOSXResizable_TCL_DECLARED
@@ -415,7 +414,7 @@ EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable);
#ifndef TkMacOSXSetUpGraphicsPort_TCL_DECLARED
#define TkMacOSXSetUpGraphicsPort_TCL_DECLARED
/* 31 */
-EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, GWorldPtr destPort);
+EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, VOID *destPort);
#endif
#ifndef TkMacOSXUpdateClipRgn_TCL_DECLARED
#define TkMacOSXUpdateClipRgn_TCL_DECLARED
@@ -425,7 +424,7 @@ EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr);
#ifndef TkMacOSXUnregisterMacWindow_TCL_DECLARED
#define TkMacOSXUnregisterMacWindow_TCL_DECLARED
/* 33 */
-EXTERN void TkMacOSXUnregisterMacWindow(WindowRef portPtr);
+EXTERN void TkMacOSXUnregisterMacWindow(VOID *portPtr);
#endif
#ifndef TkMacOSXUseMenuID_TCL_DECLARED
#define TkMacOSXUseMenuID_TCL_DECLARED
@@ -435,24 +434,23 @@ EXTERN int TkMacOSXUseMenuID(short macID);
#ifndef TkMacOSXVisableClipRgn_TCL_DECLARED
#define TkMacOSXVisableClipRgn_TCL_DECLARED
/* 35 */
-EXTERN RgnHandle TkMacOSXVisableClipRgn(TkWindow *winPtr);
+EXTERN TkRegion TkMacOSXVisableClipRgn(TkWindow *winPtr);
#endif
#ifndef TkMacOSXWinBounds_TCL_DECLARED
#define TkMacOSXWinBounds_TCL_DECLARED
/* 36 */
-EXTERN void TkMacOSXWinBounds(TkWindow *winPtr, Rect *geometry);
+EXTERN void TkMacOSXWinBounds(TkWindow *winPtr, VOID *geometry);
#endif
#ifndef TkMacOSXWindowOffset_TCL_DECLARED
#define TkMacOSXWindowOffset_TCL_DECLARED
/* 37 */
-EXTERN void TkMacOSXWindowOffset(WindowRef wRef, int *xOffset,
+EXTERN void TkMacOSXWindowOffset(VOID *wRef, int *xOffset,
int *yOffset);
#endif
#ifndef TkSetMacColor_TCL_DECLARED
#define TkSetMacColor_TCL_DECLARED
/* 38 */
-EXTERN int TkSetMacColor(unsigned long pixel,
- RGBColor *macColor);
+EXTERN int TkSetMacColor(unsigned long pixel, VOID *macColor);
#endif
#ifndef TkSetWMName_TCL_DECLARED
#define TkSetWMName_TCL_DECLARED
@@ -467,7 +465,7 @@ EXTERN void TkSuspendClipboard(void);
#ifndef TkMacOSXZoomToplevel_TCL_DECLARED
#define TkMacOSXZoomToplevel_TCL_DECLARED
/* 41 */
-EXTERN int TkMacOSXZoomToplevel(WindowPtr whichWindow,
+EXTERN int TkMacOSXZoomToplevel(VOID *whichWindow,
short zoomPart);
#endif
#ifndef Tk_TopCoordsToWindow_TCL_DECLARED
@@ -494,7 +492,7 @@ EXTERN void TkMacOSXPreprocessMenu(void);
#ifndef TkpIsWindowFloating_TCL_DECLARED
#define TkpIsWindowFloating_TCL_DECLARED
/* 46 */
-EXTERN int TkpIsWindowFloating(WindowRef window);
+EXTERN int TkpIsWindowFloating(VOID *window);
#endif
#ifndef TkMacOSXGetCapture_TCL_DECLARED
#define TkMacOSXGetCapture_TCL_DECLARED
@@ -668,39 +666,39 @@ typedef struct TkIntPlatStubs {
void (*tkMacOSXInstallCursor) (int resizeOverride); /* 11 */
void (*tkMacOSXHandleTearoffMenu) (void); /* 12 */
VOID *reserved13;
- int (*tkMacOSXDoHLEvent) (EventRecord *theEvent); /* 14 */
+ int (*tkMacOSXDoHLEvent) (VOID *theEvent); /* 14 */
VOID *reserved15;
- Window (*tkMacOSXGetXWindow) (WindowRef macWinPtr); /* 16 */
- int (*tkMacOSXGrowToplevel) (WindowRef whichWindow, Point start); /* 17 */
- void (*tkMacOSXHandleMenuSelect) (MenuID theMenu, MenuItemIndex theItem, int optionKeyPressed); /* 18 */
+ Window (*tkMacOSXGetXWindow) (VOID *macWinPtr); /* 16 */
+ int (*tkMacOSXGrowToplevel) (VOID *whichWindow, XPoint start); /* 17 */
+ void (*tkMacOSXHandleMenuSelect) (short theMenu, unsigned short theItem, int optionKeyPressed); /* 18 */
VOID *reserved19;
VOID *reserved20;
void (*tkMacOSXInvalidateWindow) (MacDrawable *macWin, int flag); /* 21 */
int (*tkMacOSXIsCharacterMissing) (Tk_Font tkfont, unsigned int searchChar); /* 22 */
void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */
- BitMapPtr (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */
+ VOID * (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */
void (*tkMacOSXMenuClick) (void); /* 25 */
- void (*tkMacOSXRegisterOffScreenWindow) (Window window, GWorldPtr portPtr); /* 26 */
+ void (*tkMacOSXRegisterOffScreenWindow) (Window window, VOID *portPtr); /* 26 */
int (*tkMacOSXResizable) (TkWindow *winPtr); /* 27 */
void (*tkMacOSXSetHelpMenuItemCount) (void); /* 28 */
void (*tkMacOSXSetScrollbarGrow) (TkWindow *winPtr, int flag); /* 29 */
void (*tkMacOSXSetUpClippingRgn) (Drawable drawable); /* 30 */
- void (*tkMacOSXSetUpGraphicsPort) (GC gc, GWorldPtr destPort); /* 31 */
+ void (*tkMacOSXSetUpGraphicsPort) (GC gc, VOID *destPort); /* 31 */
void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */
- void (*tkMacOSXUnregisterMacWindow) (WindowRef portPtr); /* 33 */
+ void (*tkMacOSXUnregisterMacWindow) (VOID *portPtr); /* 33 */
int (*tkMacOSXUseMenuID) (short macID); /* 34 */
- RgnHandle (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
- void (*tkMacOSXWinBounds) (TkWindow *winPtr, Rect *geometry); /* 36 */
- void (*tkMacOSXWindowOffset) (WindowRef wRef, int *xOffset, int *yOffset); /* 37 */
- int (*tkSetMacColor) (unsigned long pixel, RGBColor *macColor); /* 38 */
+ TkRegion (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
+ void (*tkMacOSXWinBounds) (TkWindow *winPtr, VOID *geometry); /* 36 */
+ void (*tkMacOSXWindowOffset) (VOID *wRef, int *xOffset, int *yOffset); /* 37 */
+ int (*tkSetMacColor) (unsigned long pixel, VOID *macColor); /* 38 */
void (*tkSetWMName) (TkWindow *winPtr, Tk_Uid titleUid); /* 39 */
void (*tkSuspendClipboard) (void); /* 40 */
- int (*tkMacOSXZoomToplevel) (WindowPtr whichWindow, short zoomPart); /* 41 */
+ int (*tkMacOSXZoomToplevel) (VOID *whichWindow, short zoomPart); /* 41 */
Tk_Window (*tk_TopCoordsToWindow) (Tk_Window tkwin, int rootX, int rootY, int *newX, int *newY); /* 42 */
MacDrawable * (*tkMacOSXContainerId) (TkWindow *winPtr); /* 43 */
MacDrawable * (*tkMacOSXGetHostToplevel) (TkWindow *winPtr); /* 44 */
void (*tkMacOSXPreprocessMenu) (void); /* 45 */
- int (*tkpIsWindowFloating) (WindowRef window); /* 46 */
+ int (*tkpIsWindowFloating) (VOID *window); /* 46 */
Tk_Window (*tkMacOSXGetCapture) (void); /* 47 */
VOID *reserved48;
Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index 476fa4a..549ae30 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -108,12 +108,12 @@ EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin);
#ifndef TkMacOSXGetDrawablePort_TCL_DECLARED
#define TkMacOSXGetDrawablePort_TCL_DECLARED
/* 7 */
-EXTERN GWorldPtr TkMacOSXGetDrawablePort(Drawable drawable);
+EXTERN VOID * TkMacOSXGetDrawablePort(Drawable drawable);
#endif
#ifndef TkMacOSXGetRootControl_TCL_DECLARED
#define TkMacOSXGetRootControl_TCL_DECLARED
/* 8 */
-EXTERN ControlRef TkMacOSXGetRootControl(Drawable drawable);
+EXTERN VOID * TkMacOSXGetRootControl(Drawable drawable);
#endif
#ifndef Tk_MacOSXSetupTkNotifier_TCL_DECLARED
#define Tk_MacOSXSetupTkNotifier_TCL_DECLARED
@@ -147,8 +147,8 @@ typedef struct TkPlatStubs {
void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */
void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */
- GWorldPtr (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
- ControlRef (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
+ VOID * (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
+ VOID * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */
int (*tk_MacOSXIsAppInFront) (void); /* 10 */
#endif /* AQUA */
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index bfa5d5c..2a8240b 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -976,6 +976,89 @@ TkFindStateNumObj(
}
/*
+ * ----------------------------------------------------------------------
+ *
+ * TkBackgroundEvalObjv --
+ *
+ * Evaluate a command while ensuring that we do not affect the
+ * interpreters state. This is important when evaluating script
+ * during background tasks.
+ *
+ * Results:
+ * A standard Tcl result code.
+ *
+ * Side Effects:
+ * The interpreters variables and code may be modified by the script
+ * but the result will not be modified.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+int
+TkBackgroundEvalObjv(
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const *objv,
+ int flags)
+{
+ Tcl_DString errorInfo, errorCode;
+ Tcl_SavedResult state;
+ int n, r = TCL_OK;
+
+ Tcl_DStringInit(&errorInfo);
+ Tcl_DStringInit(&errorCode);
+
+ Tcl_Preserve(interp);
+
+ /*
+ * Record the state of the interpreter
+ */
+
+ Tcl_SaveResult(interp, &state);
+ Tcl_DStringAppend(&errorInfo,
+ Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY), -1);
+ Tcl_DStringAppend(&errorCode,
+ Tcl_GetVar(interp, "errorCode", TCL_GLOBAL_ONLY), -1);
+
+ /*
+ * Evaluate the command and handle any error.
+ */
+
+ for (n = 0; n < objc; ++n) {
+ Tcl_IncrRefCount(objv[n]);
+ }
+ r = Tcl_EvalObjv(interp, objc, objv, flags);
+ for (n = 0; n < objc; ++n) {
+ Tcl_DecrRefCount(objv[n]);
+ }
+ if (r == TCL_ERROR) {
+ Tcl_AddErrorInfo(interp, "\n (background event handler)");
+ Tcl_BackgroundError(interp);
+ }
+
+ Tcl_Release(interp);
+
+ /*
+ * Restore the state of the interpreter
+ */
+
+ Tcl_SetVar(interp, "errorInfo",
+ Tcl_DStringValue(&errorInfo), TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "errorCode",
+ Tcl_DStringValue(&errorCode), TCL_GLOBAL_ONLY);
+ Tcl_RestoreResult(interp, &state);
+
+ /*
+ * Clean up references.
+ */
+
+ Tcl_DStringFree(&errorInfo);
+ Tcl_DStringFree(&errorCode);
+
+ return r;
+}
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4