summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-29 08:22:32 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-29 08:22:32 (GMT)
commit83dd76da7170a8bb9c59b60508c5df606204709c (patch)
tree80e0b58dcbf82e4938b45f818c125a17099d7fc2 /generic
parent6543fa41fa55392ee287df3d24888f2662bb7b8d (diff)
parent64ac9dba8558f572db2bd2d6f908134796bf92c3 (diff)
downloadtk-83dd76da7170a8bb9c59b60508c5df606204709c.zip
tk-83dd76da7170a8bb9c59b60508c5df606204709c.tar.gz
tk-83dd76da7170a8bb9c59b60508c5df606204709c.tar.bz2
merge trunk
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.decls23
-rw-r--r--generic/tkBind.c26
-rw-r--r--generic/tkFocus.c8
-rw-r--r--generic/tkInt.decls16
-rw-r--r--generic/tkIntDecls.h200
-rw-r--r--generic/tkMenuDraw.c28
-rw-r--r--generic/tkPlatDecls.h94
-rw-r--r--generic/tkStubInit.c157
-rw-r--r--generic/tkWindow.c145
9 files changed, 286 insertions, 411 deletions
diff --git a/generic/tk.decls b/generic/tk.decls
index 2671421..897d84a 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -1087,7 +1087,28 @@ interface tkPlat
################################
# Unix specific functions
-# (none)
+#
+
+declare 0 unix {
+ Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd)
+}
+declare 1 unix {
+ void *Tk_GetHINSTANCE(void)
+}
+declare 2 unix {
+ void *Tk_GetHWND(Window window)
+}
+declare 3 unix {
+ Tk_Window Tk_HWNDToWindow(void *hwnd)
+}
+declare 4 unix {
+ void Tk_PointerEvent(void *hwnd, int x, int y)
+}
+declare 5 unix {
+ int Tk_TranslateWinEvent(void *hwnd,
+ unsigned int message, int wParam, int lParam, int *result)
+}
+
################################
# Windows specific functions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 6841f1e..e58ad4d 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -2028,7 +2028,7 @@ ExpandPercents(
string = numStorage;
goto doString;
case 'k':
- if (flags & KEY) {
+ if ((flags & KEY) && (eventPtr->type != MouseWheelEvent)) {
number = eventPtr->xkey.keycode;
goto doNumber;
}
@@ -2168,7 +2168,7 @@ ExpandPercents(
* This is used only by the MouseWheel event.
*/
- if (flags & KEY) {
+ if ((flags & KEY) && (eventPtr->type == MouseWheelEvent)) {
number = eventPtr->xkey.keycode;
goto doNumber;
}
@@ -2177,7 +2177,7 @@ ExpandPercents(
number = (int) eventPtr->xany.send_event;
goto doNumber;
case 'K':
- if (flags & KEY) {
+ if ((flags & KEY) && (eventPtr->type != MouseWheelEvent)) {
const char *name = TkKeysymToString(keySym);
if (name != NULL) {
@@ -2186,7 +2186,7 @@ ExpandPercents(
}
goto doString;
case 'N':
- if (flags & KEY) {
+ if ((flags & KEY) && (eventPtr->type != MouseWheelEvent)) {
number = (int) keySym;
goto doNumber;
}
@@ -2226,33 +2226,19 @@ ExpandPercents(
}
case 'X':
if (flags & KEY_BUTTON_MOTION_CROSSING) {
- Tk_Window tkwin;
- int x, y;
- int width, height;
number = eventPtr->xkey.x_root;
- tkwin = Tk_IdToWindow(eventPtr->xany.display,
+ Tk_IdToWindow(eventPtr->xany.display,
eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= x;
- }
goto doNumber;
}
goto doString;
case 'Y':
if (flags & KEY_BUTTON_MOTION_CROSSING) {
- Tk_Window tkwin;
- int x, y;
- int width, height;
number = eventPtr->xkey.y_root;
- tkwin = Tk_IdToWindow(eventPtr->xany.display,
+ Tk_IdToWindow(eventPtr->xany.display,
eventPtr->xany.window);
- if (tkwin != NULL) {
- Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height);
- number -= y;
- }
goto doNumber;
}
goto doString;
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 5f68d8b..2f50009 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -715,7 +715,7 @@ TkFocusKeyEvent(
{
DisplayFocusInfo *displayFocusPtr;
TkWindow *focusWinPtr;
- int focusX, focusY, vRootX, vRootY, vRootWidth, vRootHeight;
+ int focusX, focusY;
displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr);
focusWinPtr = displayFocusPtr->focusWinPtr;
@@ -748,11 +748,9 @@ TkFocusKeyEvent(
eventPtr->xkey.x = -1;
eventPtr->xkey.y = -1;
} else {
- Tk_GetVRootGeometry((Tk_Window) focusWinPtr, &vRootX, &vRootY,
- &vRootWidth, &vRootHeight);
Tk_GetRootCoords((Tk_Window) focusWinPtr, &focusX, &focusY);
- eventPtr->xkey.x = eventPtr->xkey.x_root - vRootX - focusX;
- eventPtr->xkey.y = eventPtr->xkey.y_root - vRootY - focusY;
+ eventPtr->xkey.x = eventPtr->xkey.x_root - focusX;
+ eventPtr->xkey.y = eventPtr->xkey.y_root - focusY;
}
eventPtr->xkey.window = focusWinPtr->window;
return focusWinPtr;
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 2f58dde..7a69e50 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -398,26 +398,26 @@ declare 111 {
declare 112 {
void TkpMenuThreadInit(void)
}
-declare 113 {aqua win} {
+declare 113 {
void TkClipBox(TkRegion rgn, XRectangle *rect_return)
}
-declare 114 {aqua win} {
+declare 114 {
TkRegion TkCreateRegion(void)
}
-declare 115 {aqua win} {
+declare 115 {
void TkDestroyRegion(TkRegion rgn)
}
-declare 116 {aqua win} {
+declare 116 {
void TkIntersectRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
}
-declare 117 {aqua win} {
+declare 117 {
int TkRectInRegion(TkRegion rgn, int x, int y, unsigned int width,
unsigned int height)
}
-declare 118 {aqua win} {
+declare 118 {
void TkSetRegion(Display *display, GC gc, TkRegion rgn)
}
-declare 119 {aqua win} {
+declare 119 {
void TkUnionRectWithRegion(XRectangle *rect,
TkRegion src, TkRegion dr_return)
}
@@ -463,7 +463,7 @@ declare 143 {
declare 144 {
void TkGCCleanup(TkDisplay *dispPtr)
}
-declare 145 {win aqua} {
+declare 145 {
void TkSubtractRegion(TkRegion sra, TkRegion srcb, TkRegion dr_return)
}
declare 146 {
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index cfa87da..d50f07c 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -329,68 +329,23 @@ EXTERN Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin,
const char *dbName, const char *className);
/* 112 */
EXTERN void TkpMenuThreadInit(void);
-#ifdef __WIN32__ /* WIN */
-/* 113 */
-EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 113 */
EXTERN void TkClipBox(TkRegion rgn, XRectangle *rect_return);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 114 */
-EXTERN TkRegion TkCreateRegion(void);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 114 */
EXTERN TkRegion TkCreateRegion(void);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 115 */
-EXTERN void TkDestroyRegion(TkRegion rgn);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 115 */
EXTERN void TkDestroyRegion(TkRegion rgn);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
/* 116 */
EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb,
TkRegion dr_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-/* 116 */
-EXTERN void TkIntersectRegion(TkRegion sra, TkRegion srcb,
- TkRegion dr_return);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 117 */
-EXTERN int TkRectInRegion(TkRegion rgn, int x, int y,
- unsigned int width, unsigned int height);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 117 */
EXTERN int TkRectInRegion(TkRegion rgn, int x, int y,
unsigned int width, unsigned int height);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 118 */
-EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 118 */
EXTERN void TkSetRegion(Display *display, GC gc, TkRegion rgn);
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-/* 119 */
-EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
- TkRegion dr_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
/* 119 */
EXTERN void TkUnionRectWithRegion(XRectangle *rect, TkRegion src,
TkRegion dr_return);
-#endif /* AQUA */
/* Slot 120 is reserved */
#ifdef MAC_OSX_TK /* AQUA */
/* 121 */
@@ -440,16 +395,9 @@ EXTERN void TkFocusFree(TkMainInfo *mainPtr);
EXTERN void TkClipCleanup(TkDisplay *dispPtr);
/* 144 */
EXTERN void TkGCCleanup(TkDisplay *dispPtr);
-#ifdef __WIN32__ /* WIN */
/* 145 */
EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb,
TkRegion dr_return);
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-/* 145 */
-EXTERN void TkSubtractRegion(TkRegion sra, TkRegion srcb,
- TkRegion dr_return);
-#endif /* AQUA */
/* 146 */
EXTERN void TkStylePkgInit(TkMainInfo *mainPtr);
/* 147 */
@@ -716,76 +664,13 @@ typedef struct TkIntStubs {
void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */
Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */
void (*tkpMenuThreadInit) (void); /* 112 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved113)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved113)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved114)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkRegion (*tkCreateRegion) (void); /* 114 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved114)(void); /* Dummy entry for stubs table backwards compatibility */
- TkRegion (*tkCreateRegion) (void); /* 114 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved115)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkDestroyRegion) (TkRegion rgn); /* 115 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved115)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkDestroyRegion) (TkRegion rgn); /* 115 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved116)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved116)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved117)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved117)(void); /* Dummy entry for stubs table backwards compatibility */
int (*tkRectInRegion) (TkRegion rgn, int x, int y, unsigned int width, unsigned int height); /* 117 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved118)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved118)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkSetRegion) (Display *display, GC gc, TkRegion rgn); /* 118 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved119)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved119)(void); /* Dummy entry for stubs table backwards compatibility */
void (*tkUnionRectWithRegion) (XRectangle *rect, TkRegion src, TkRegion dr_return); /* 119 */
-#endif /* AQUA */
void (*reserved120)(void);
#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
void (*reserved121)(void);
@@ -838,16 +723,7 @@ typedef struct TkIntStubs {
void (*tkFocusFree) (TkMainInfo *mainPtr); /* 142 */
void (*tkClipCleanup) (TkDisplay *dispPtr); /* 143 */
void (*tkGCCleanup) (TkDisplay *dispPtr); /* 144 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved145)(void);
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved145)(void); /* Dummy entry for stubs table backwards compatibility */
- void (*tkSubtractRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 145 */
-#endif /* AQUA */
void (*tkStylePkgInit) (TkMainInfo *mainPtr); /* 146 */
void (*tkStylePkgFree) (TkMainInfo *mainPtr); /* 147 */
Tk_Window (*tkToplevelWindowForCommand) (Tcl_Interp *interp, const char *cmdName); /* 148 */
@@ -1124,62 +1000,20 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkpGetSystemDefault) /* 111 */
#define TkpMenuThreadInit \
(tkIntStubsPtr->tkpMenuThreadInit) /* 112 */
-#ifdef __WIN32__ /* WIN */
-#define TkClipBox \
- (tkIntStubsPtr->tkClipBox) /* 113 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkClipBox \
(tkIntStubsPtr->tkClipBox) /* 113 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkCreateRegion \
- (tkIntStubsPtr->tkCreateRegion) /* 114 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkCreateRegion \
(tkIntStubsPtr->tkCreateRegion) /* 114 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
#define TkDestroyRegion \
(tkIntStubsPtr->tkDestroyRegion) /* 115 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-#define TkDestroyRegion \
- (tkIntStubsPtr->tkDestroyRegion) /* 115 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkIntersectRegion \
- (tkIntStubsPtr->tkIntersectRegion) /* 116 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkIntersectRegion \
(tkIntStubsPtr->tkIntersectRegion) /* 116 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
#define TkRectInRegion \
(tkIntStubsPtr->tkRectInRegion) /* 117 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
-#define TkRectInRegion \
- (tkIntStubsPtr->tkRectInRegion) /* 117 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkSetRegion \
- (tkIntStubsPtr->tkSetRegion) /* 118 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkSetRegion \
(tkIntStubsPtr->tkSetRegion) /* 118 */
-#endif /* AQUA */
-#ifdef __WIN32__ /* WIN */
-#define TkUnionRectWithRegion \
- (tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkUnionRectWithRegion \
(tkIntStubsPtr->tkUnionRectWithRegion) /* 119 */
-#endif /* AQUA */
/* Slot 120 is reserved */
#ifdef MAC_OSX_TK /* AQUA */
#define TkpCreateNativeBitmap \
@@ -1224,14 +1058,8 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkClipCleanup) /* 143 */
#define TkGCCleanup \
(tkIntStubsPtr->tkGCCleanup) /* 144 */
-#ifdef __WIN32__ /* WIN */
-#define TkSubtractRegion \
- (tkIntStubsPtr->tkSubtractRegion) /* 145 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
#define TkSubtractRegion \
(tkIntStubsPtr->tkSubtractRegion) /* 145 */
-#endif /* AQUA */
#define TkStylePkgInit \
(tkIntStubsPtr->tkStylePkgInit) /* 146 */
#define TkStylePkgFree \
@@ -1317,5 +1145,33 @@ extern const TkIntStubs *tkIntStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+/*
+ * On X11, these macros are just wrappers for the equivalent X Region calls.
+ */
+#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
+
+#undef TkClipBox
+#undef TkCreateRegion
+#undef TkDestroyRegion
+#undef TkIntersectRegion
+#undef TkRectInRegion
+#undef TkSetRegion
+#undef TkSubtractRegion
+#undef TkUnionRectWithRegion
+
+#define TkClipBox(rgn, rect) XClipBox((Region) rgn, rect)
+#define TkCreateRegion() (TkRegion) XCreateRegion()
+#define TkDestroyRegion(rgn) XDestroyRegion((Region) rgn)
+#define TkIntersectRegion(a, b, r) XIntersectRegion((Region) a, \
+ (Region) b, (Region) r)
+#define TkRectInRegion(r, x, y, w, h) XRectInRegion((Region) r, x, y, w, h)
+#define TkSetRegion(d, gc, rgn) XSetRegion(d, gc, (Region) rgn)
+#define TkSubtractRegion(a, b, r) XSubtractRegion((Region) a, \
+ (Region) b, (Region) r)
+#define TkUnionRectWithRegion(rect, src, ret) XUnionRectWithRegion(rect, \
+ (Region) src, (Region) ret)
+
+#endif /* UNIX */
+
#endif /* _TKINTDECLS */
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 119b4bf..4cd9b02 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -844,7 +844,7 @@ TkPostTearoffMenu(
* posting */
{
int vRootX, vRootY, vRootWidth, vRootHeight;
- int tmp, result;
+ int result;
TkActivateMenuEntry(menuPtr, -1);
TkRecomputeMenu(menuPtr);
@@ -877,31 +877,21 @@ TkPostTearoffMenu(
* 2. The menu may not have been mapped yet, so its current size might be
* the default 1x1. To compute how much space it needs, use its
* requested size, not its actual size.
- *
- * Note that this code assumes square screen regions and all positive
- * coordinates. This does not work on a Mac with multiple monitors. But
- * then again, Tk has other problems with this.
*/
Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY,
&vRootWidth, &vRootHeight);
- x += vRootX;
- y += vRootY;
- tmp = WidthOfScreen(Tk_Screen(menuPtr->tkwin))
- - Tk_ReqWidth(menuPtr->tkwin);
- if (x > tmp) {
- x = tmp;
+ if (x > vRootX + vRootWidth) {
+ x = vRootX + vRootWidth;
}
- if (x < 0) {
- x = 0;
+ if (x < vRootX) {
+ x = vRootX;
}
- tmp = HeightOfScreen(Tk_Screen(menuPtr->tkwin))
- - Tk_ReqHeight(menuPtr->tkwin);
- if (y > tmp) {
- y = tmp;
+ if (y > vRootY + vRootHeight) {
+ y = vRootY + vRootHeight;
}
- if (y < 0) {
- y = 0;
+ if (y < vRootY) {
+ y = vRootY;
}
Tk_MoveToplevelWindow(menuPtr->tkwin, x, y);
if (!Tk_IsMapped(menuPtr->tkwin)) {
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index 49274d4..74f4ccd 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -33,6 +33,22 @@ extern "C" {
* Exported function declarations:
*/
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+/* 0 */
+EXTERN Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd);
+/* 1 */
+EXTERN void * Tk_GetHINSTANCE(void);
+/* 2 */
+EXTERN void * Tk_GetHWND(Window window);
+/* 3 */
+EXTERN Tk_Window Tk_HWNDToWindow(void *hwnd);
+/* 4 */
+EXTERN void Tk_PointerEvent(void *hwnd, int x, int y);
+/* 5 */
+EXTERN int Tk_TranslateWinEvent(void *hwnd,
+ unsigned int message, int wParam, int lParam,
+ int *result);
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
/* 0 */
EXTERN Window Tk_AttachHWND(Tk_Window tkwin, HWND hwnd);
@@ -51,23 +67,19 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message,
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
-EXTERN void Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
+EXTERN Window Tk_AttachHWND(Tk_Window tkwin, void *hwnd);
/* 1 */
-EXTERN void Tk_MacOSXTurnOffMenus(void);
+EXTERN void * Tk_GetHINSTANCE(void);
/* 2 */
-EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt);
+EXTERN void * Tk_GetHWND(Window window);
/* 3 */
-EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp);
+EXTERN Tk_Window Tk_HWNDToWindow(void *hwnd);
/* 4 */
-EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp);
+EXTERN void Tk_PointerEvent(void *hwnd, int x, int y);
/* 5 */
-EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
- int width, int height, int flags);
+EXTERN int Tk_TranslateWinEvent(void *hwnd,
+ unsigned int message, int wParam, int lParam,
+ int *result);
/* 6 */
EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin);
/* 7 */
@@ -84,6 +96,14 @@ typedef struct TkPlatStubs {
int magic;
const struct TkPlatStubHooks *hooks;
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+ Window (*tk_AttachHWND) (Tk_Window tkwin, void *hwnd); /* 0 */
+ void * (*tk_GetHINSTANCE) (void); /* 1 */
+ void * (*tk_GetHWND) (Window window); /* 2 */
+ Tk_Window (*tk_HWNDToWindow) (void *hwnd); /* 3 */
+ void (*tk_PointerEvent) (void *hwnd, int x, int y); /* 4 */
+ int (*tk_TranslateWinEvent) (void *hwnd, unsigned int message, int wParam, int lParam, int *result); /* 5 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
Window (*tk_AttachHWND) (Tk_Window tkwin, HWND hwnd); /* 0 */
HINSTANCE (*tk_GetHINSTANCE) (void); /* 1 */
@@ -93,12 +113,12 @@ typedef struct TkPlatStubs {
int (*tk_TranslateWinEvent) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- void (*tk_MacOSXSetEmbedHandler) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 0 */
- void (*tk_MacOSXTurnOffMenus) (void); /* 1 */
- void (*tk_MacOSXTkOwnsCursor) (int tkOwnsIt); /* 2 */
- void (*tkMacOSXInitMenus) (Tcl_Interp *interp); /* 3 */
- void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */
- void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
+ Window (*tk_AttachHWND) (Tk_Window tkwin, void *hwnd); /* 0 */
+ void * (*tk_GetHINSTANCE) (void); /* 1 */
+ void * (*tk_GetHWND) (Window window); /* 2 */
+ Tk_Window (*tk_HWNDToWindow) (void *hwnd); /* 3 */
+ void (*tk_PointerEvent) (void *hwnd, int x, int y); /* 4 */
+ int (*tk_TranslateWinEvent) (void *hwnd, unsigned int message, int wParam, int lParam, int *result); /* 5 */
void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */
void * (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
@@ -121,6 +141,20 @@ extern const TkPlatStubs *tkPlatStubsPtr;
* Inline function declarations:
*/
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+#define Tk_AttachHWND \
+ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */
+#define Tk_GetHINSTANCE \
+ (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */
+#define Tk_GetHWND \
+ (tkPlatStubsPtr->tk_GetHWND) /* 2 */
+#define Tk_HWNDToWindow \
+ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */
+#define Tk_PointerEvent \
+ (tkPlatStubsPtr->tk_PointerEvent) /* 4 */
+#define Tk_TranslateWinEvent \
+ (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
#define Tk_AttachHWND \
(tkPlatStubsPtr->tk_AttachHWND) /* 0 */
@@ -136,18 +170,18 @@ extern const TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-#define Tk_MacOSXSetEmbedHandler \
- (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */
-#define Tk_MacOSXTurnOffMenus \
- (tkPlatStubsPtr->tk_MacOSXTurnOffMenus) /* 1 */
-#define Tk_MacOSXTkOwnsCursor \
- (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor) /* 2 */
-#define TkMacOSXInitMenus \
- (tkPlatStubsPtr->tkMacOSXInitMenus) /* 3 */
-#define TkMacOSXInitAppleEvents \
- (tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */
-#define TkGenWMConfigureEvent \
- (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 5 */
+#define Tk_AttachHWND \
+ (tkPlatStubsPtr->tk_AttachHWND) /* 0 */
+#define Tk_GetHINSTANCE \
+ (tkPlatStubsPtr->tk_GetHINSTANCE) /* 1 */
+#define Tk_GetHWND \
+ (tkPlatStubsPtr->tk_GetHWND) /* 2 */
+#define Tk_HWNDToWindow \
+ (tkPlatStubsPtr->tk_HWNDToWindow) /* 3 */
+#define Tk_PointerEvent \
+ (tkPlatStubsPtr->tk_PointerEvent) /* 4 */
+#define Tk_TranslateWinEvent \
+ (tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#define TkMacOSXInvalClipRgns \
(tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */
#define TkMacOSXGetDrawablePort \
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index c62d143..fe04206 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -36,7 +36,7 @@
* below should be made in the generic/tk.decls script.
*/
-MODULE_SCOPE const TkStubs tkStubs;
+static const TkIntStubs tkIntStubs;
/*
* Remove macro that might interfere with the definition below.
@@ -44,11 +44,66 @@ MODULE_SCOPE const TkStubs tkStubs;
#undef Tk_MainEx
+#undef TkClipBox
+#undef TkCreateRegion
+#undef TkDestroyRegion
+#undef TkIntersectRegion
+#undef TkRectInRegion
+#undef TkSetRegion
+#undef TkUnionRectWithRegion
+#undef TkSubtractRegion
+#undef TkPutImage
+
#ifndef __WIN32__
-/* Make sure that extensions which call XParseColor through
- * the stub table, call TkParseColor in stead. See bug #3486474 */
-# define XParseColor TkParseColor
-#endif
+/*
+ * Make sure that extensions which call XParseColor through the stub
+ * table, call TkParseColor instead. [Bug 3486474]
+ */
+# define XParseColor TkParseColor
+
+# ifndef __CYGWIN__
+# define Tk_AttachHWND 0
+# define Tk_GetHWND 0
+# define Tk_HWNDToWindow 0
+# define Tk_PointerEvent 0
+# define Tk_TranslateWinEvent 0
+# define Tk_GetHINSTANCE 0
+# endif
+# if !defined(MAC_TCL) && !defined(MAC_OSX_TCL)
+# define TkClipBox (void (*) (TkRegion, XRectangle *)) XClipBox
+# define TkCreateRegion (TkRegion (*) ()) XCreateRegion
+# define TkDestroyRegion (void (*) (TkRegion)) XDestroyRegion
+# define TkIntersectRegion (void (*) (TkRegion, TkRegion, TkRegion)) XIntersectRegion
+# define TkRectInRegion (int (*) (TkRegion, int, int, unsigned int, unsigned int)) XRectInRegion
+# define TkSetRegion (void (*) (Display *, GC, TkRegion)) XSetRegion
+# define TkUnionRectWithRegion (void (*) (XRectangle *, TkRegion, TkRegion)) XUnionRectWithRegion
+# define TkSubtractRegion (void (*) (TkRegion, TkRegion, TkRegion)) XSubtractRegion
+
+# ifdef __CYGWIN__
+# define Tk_GetHINSTANCE TkPlatGetHINSTANCE
+# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004
+
+/*
+ * Trick, so we don't have to include <windows.h> here, which in any
+ * case lacks this function anyway.
+ */
+
+int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
+
+static void *Tk_GetHINSTANCE()
+{
+ void *hInstance = NULL;
+
+ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ (const char *) &tkIntStubs, &hInstance);
+ return hInstance;
+}
+
+# else /* !__CYGWIN__ */
+# define TkPutImage 0
+# endif /* __CYGWIN__ */
+# endif /* !MAC_TCL && !MACC_OSX_TCL */
+#endif /* !__WIN32__ */
/* !BEGIN!: Do not edit below this line. */
@@ -168,76 +223,13 @@ static const TkIntStubs tkIntStubs = {
TkpGetSubFonts, /* 110 */
TkpGetSystemDefault, /* 111 */
TkpMenuThreadInit, /* 112 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 113 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkClipBox, /* 113 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 113 */ /* Dummy entry for stubs table backwards compatibility */
- TkClipBox, /* 113 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 114 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- TkCreateRegion, /* 114 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 114 */ /* Dummy entry for stubs table backwards compatibility */
TkCreateRegion, /* 114 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 115 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- TkDestroyRegion, /* 115 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 115 */ /* Dummy entry for stubs table backwards compatibility */
TkDestroyRegion, /* 115 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 116 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkIntersectRegion, /* 116 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 116 */ /* Dummy entry for stubs table backwards compatibility */
- TkIntersectRegion, /* 116 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 117 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- TkRectInRegion, /* 117 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 117 */ /* Dummy entry for stubs table backwards compatibility */
TkRectInRegion, /* 117 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 118 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
TkSetRegion, /* 118 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 118 */ /* Dummy entry for stubs table backwards compatibility */
- TkSetRegion, /* 118 */
-#endif /* AQUA */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 119 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- TkUnionRectWithRegion, /* 119 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 119 */ /* Dummy entry for stubs table backwards compatibility */
TkUnionRectWithRegion, /* 119 */
-#endif /* AQUA */
0, /* 120 */
#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
0, /* 121 */
@@ -290,16 +282,7 @@ static const TkIntStubs tkIntStubs = {
TkFocusFree, /* 142 */
TkClipCleanup, /* 143 */
TkGCCleanup, /* 144 */
-#if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 145 */
-#endif /* X11 */
-#ifdef __WIN32__ /* WIN */
- TkSubtractRegion, /* 145 */
-#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 145 */ /* Dummy entry for stubs table backwards compatibility */
TkSubtractRegion, /* 145 */
-#endif /* AQUA */
TkStylePkgInit, /* 146 */
TkStylePkgFree, /* 147 */
TkToplevelWindowForCommand, /* 148 */
@@ -668,6 +651,14 @@ static const TkIntXlibStubs tkIntXlibStubs = {
static const TkPlatStubs tkPlatStubs = {
TCL_STUB_MAGIC,
0,
+#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
+ Tk_AttachHWND, /* 0 */
+ Tk_GetHINSTANCE, /* 1 */
+ Tk_GetHWND, /* 2 */
+ Tk_HWNDToWindow, /* 3 */
+ Tk_PointerEvent, /* 4 */
+ Tk_TranslateWinEvent, /* 5 */
+#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
Tk_AttachHWND, /* 0 */
Tk_GetHINSTANCE, /* 1 */
@@ -677,12 +668,12 @@ static const TkPlatStubs tkPlatStubs = {
Tk_TranslateWinEvent, /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- Tk_MacOSXSetEmbedHandler, /* 0 */
- Tk_MacOSXTurnOffMenus, /* 1 */
- Tk_MacOSXTkOwnsCursor, /* 2 */
- TkMacOSXInitMenus, /* 3 */
- TkMacOSXInitAppleEvents, /* 4 */
- TkGenWMConfigureEvent, /* 5 */
+ Tk_AttachHWND, /* 0 */
+ Tk_GetHINSTANCE, /* 1 */
+ Tk_GetHWND, /* 2 */
+ Tk_HWNDToWindow, /* 3 */
+ Tk_PointerEvent, /* 4 */
+ Tk_TranslateWinEvent, /* 5 */
TkMacOSXInvalClipRgns, /* 6 */
TkMacOSXGetDrawablePort, /* 7 */
TkMacOSXGetRootControl, /* 8 */
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 7102b1a..40cf462 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -63,14 +63,14 @@ TCL_DECLARE_MUTEX(windowMutex)
* on internal windows: these events are generated internally.
*/
-static XWindowChanges defChanges = {
+static const XWindowChanges defChanges = {
0, 0, 1, 1, 0, 0, Above
};
#define ALL_EVENTS_MASK \
KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask| \
EnterWindowMask|LeaveWindowMask|PointerMotionMask|ExposureMask| \
VisibilityChangeMask|PropertyChangeMask|ColormapChangeMask
-static XSetWindowAttributes defAtts= {
+static const XSetWindowAttributes defAtts= {
None, /* background_pixmap */
0, /* background_pixel */
CopyFromParent, /* border_pixmap */
@@ -92,18 +92,17 @@ static XSetWindowAttributes defAtts= {
* The following structure defines all of the commands supported by Tk, and
* the C functions that execute them.
*/
+
+#define ISSAFE 1
+#define PASSMAINWINDOW 2
+
typedef int (TkInitProc)(Tcl_Interp *interp, ClientData clientData);
typedef struct {
const char *name; /* Name of command. */
Tcl_CmdProc *cmdProc; /* Command's string-based function. */
Tcl_ObjCmdProc *objProc; /* Command's object-based function. */
TkInitProc *initProc; /* Command's initialization function */
- int isSafe; /* If !0, this command will be exposed in a
- * safe interpreter. Otherwise it will be
- * hidden in a safe interpreter. */
- int passMainWindow; /* 0 means provide NULL clientData to command
- * function; 1 means pass main window as
- * clientData to command function. */
+ int flags;
} TkCmd;
static const TkCmd commands[] = {
@@ -111,72 +110,72 @@ static const TkCmd commands[] = {
* Commands that are part of the intrinsics:
*/
- {"bell", NULL, Tk_BellObjCmd, NULL, 0, 1},
- {"bind", NULL, Tk_BindObjCmd, NULL, 1, 1},
- {"bindtags", NULL, Tk_BindtagsObjCmd, NULL, 1, 1},
- {"clipboard", NULL, Tk_ClipboardObjCmd, NULL, 0, 1},
- {"destroy", NULL, Tk_DestroyObjCmd, NULL, 1, 1},
- {"event", NULL, Tk_EventObjCmd, NULL, 1, 1},
- {"focus", NULL, Tk_FocusObjCmd, NULL, 1, 1},
- {"font", NULL, Tk_FontObjCmd, NULL, 1, 1},
- {"grab", NULL, Tk_GrabObjCmd, NULL, 0, 1},
- {"grid", NULL, Tk_GridObjCmd, NULL, 1, 1},
- {"image", NULL, Tk_ImageObjCmd, NULL, 1, 1},
- {"lower", NULL, Tk_LowerObjCmd, NULL, 1, 1},
- {"option", NULL, Tk_OptionObjCmd, NULL, 1, 1},
- {"pack", NULL, Tk_PackObjCmd, NULL, 1, 1},
- {"place", NULL, Tk_PlaceObjCmd, NULL, 1, 1},
- {"raise", NULL, Tk_RaiseObjCmd, NULL, 1, 1},
- {"selection", NULL, Tk_SelectionObjCmd, NULL, 0, 1},
- {"tk", NULL, NULL, TkInitTkCmd, 1, 1},
- {"tkwait", NULL, Tk_TkwaitObjCmd, NULL, 1, 1},
- {"update", NULL, Tk_UpdateObjCmd, NULL, 1, 1},
- {"winfo", NULL, Tk_WinfoObjCmd, NULL, 1, 1},
- {"wm", NULL, Tk_WmObjCmd, NULL, 0, 1},
+ {"bell", NULL, Tk_BellObjCmd, NULL, PASSMAINWINDOW},
+ {"bind", NULL, Tk_BindObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"bindtags", NULL, Tk_BindtagsObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"clipboard", NULL, Tk_ClipboardObjCmd, NULL, PASSMAINWINDOW},
+ {"destroy", NULL, Tk_DestroyObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"event", NULL, Tk_EventObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"focus", NULL, Tk_FocusObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"font", NULL, Tk_FontObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"grab", NULL, Tk_GrabObjCmd, NULL, PASSMAINWINDOW},
+ {"grid", NULL, Tk_GridObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"image", NULL, Tk_ImageObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"lower", NULL, Tk_LowerObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"option", NULL, Tk_OptionObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"pack", NULL, Tk_PackObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"place", NULL, Tk_PlaceObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"raise", NULL, Tk_RaiseObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"selection", NULL, Tk_SelectionObjCmd, NULL, PASSMAINWINDOW},
+ {"tk", NULL, NULL, TkInitTkCmd, PASSMAINWINDOW|ISSAFE},
+ {"tkwait", NULL, Tk_TkwaitObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"update", NULL, Tk_UpdateObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"winfo", NULL, Tk_WinfoObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"wm", NULL, Tk_WmObjCmd, NULL, PASSMAINWINDOW},
/*
* Default widget class commands.
*/
- {"button", NULL, Tk_ButtonObjCmd, NULL, 1, 0},
- {"canvas", NULL, Tk_CanvasObjCmd, NULL, 1, 1},
- {"checkbutton", NULL, Tk_CheckbuttonObjCmd, NULL, 1, 0},
- {"entry", NULL, Tk_EntryObjCmd, NULL, 1, 0},
- {"frame", NULL, Tk_FrameObjCmd, NULL, 1, 0},
- {"label", NULL, Tk_LabelObjCmd, NULL, 1, 0},
- {"labelframe", NULL, Tk_LabelframeObjCmd, NULL, 1, 0},
- {"listbox", NULL, Tk_ListboxObjCmd, NULL, 1, 0},
- {"menubutton", NULL, Tk_MenubuttonObjCmd, NULL, 1, 0},
- {"message", NULL, Tk_MessageObjCmd, NULL, 1, 0},
- {"panedwindow", NULL, Tk_PanedWindowObjCmd, NULL, 1, 0},
- {"radiobutton", NULL, Tk_RadiobuttonObjCmd, NULL, 1, 0},
- {"scale", NULL, Tk_ScaleObjCmd, NULL, 1, 0},
- {"scrollbar", Tk_ScrollbarCmd,NULL, NULL, 1, 1},
- {"spinbox", NULL, Tk_SpinboxObjCmd, NULL, 1, 0},
- {"text", NULL, Tk_TextObjCmd, NULL, 1, 1},
- {"toplevel", NULL, Tk_ToplevelObjCmd, NULL, 0, 0},
+ {"button", NULL, Tk_ButtonObjCmd, NULL, ISSAFE},
+ {"canvas", NULL, Tk_CanvasObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"checkbutton", NULL, Tk_CheckbuttonObjCmd, NULL, ISSAFE},
+ {"entry", NULL, Tk_EntryObjCmd, NULL, ISSAFE},
+ {"frame", NULL, Tk_FrameObjCmd, NULL, ISSAFE},
+ {"label", NULL, Tk_LabelObjCmd, NULL, ISSAFE},
+ {"labelframe", NULL, Tk_LabelframeObjCmd, NULL, ISSAFE},
+ {"listbox", NULL, Tk_ListboxObjCmd, NULL, ISSAFE},
+ {"menubutton", NULL, Tk_MenubuttonObjCmd, NULL, ISSAFE},
+ {"message", NULL, Tk_MessageObjCmd, NULL, ISSAFE},
+ {"panedwindow", NULL, Tk_PanedWindowObjCmd, NULL, ISSAFE},
+ {"radiobutton", NULL, Tk_RadiobuttonObjCmd, NULL, ISSAFE},
+ {"scale", NULL, Tk_ScaleObjCmd, NULL, ISSAFE},
+ {"scrollbar", Tk_ScrollbarCmd,NULL, NULL, PASSMAINWINDOW|ISSAFE},
+ {"spinbox", NULL, Tk_SpinboxObjCmd, NULL, ISSAFE},
+ {"text", NULL, Tk_TextObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"toplevel", NULL, Tk_ToplevelObjCmd, NULL, 0},
/*
* Classic widget class commands.
*/
- {"::tk::button", NULL, Tk_ButtonObjCmd, NULL, 1, 0},
- {"::tk::canvas", NULL, Tk_CanvasObjCmd, NULL, 1, 1},
- {"::tk::checkbutton",NULL, Tk_CheckbuttonObjCmd, NULL, 1, 0},
- {"::tk::entry", NULL, Tk_EntryObjCmd, NULL, 1, 0},
- {"::tk::frame", NULL, Tk_FrameObjCmd, NULL, 1, 0},
- {"::tk::label", NULL, Tk_LabelObjCmd, NULL, 1, 0},
- {"::tk::labelframe",NULL, Tk_LabelframeObjCmd, NULL, 1, 0},
- {"::tk::listbox", NULL, Tk_ListboxObjCmd, NULL, 1, 0},
- {"::tk::menubutton",NULL, Tk_MenubuttonObjCmd, NULL, 1, 0},
- {"::tk::message", NULL, Tk_MessageObjCmd, NULL, 1, 0},
- {"::tk::panedwindow",NULL, Tk_PanedWindowObjCmd, NULL, 1, 0},
- {"::tk::radiobutton",NULL, Tk_RadiobuttonObjCmd, NULL, 1, 0},
- {"::tk::scale", NULL, Tk_ScaleObjCmd, NULL, 1, 0},
- {"::tk::scrollbar", Tk_ScrollbarCmd,NULL, NULL, 1, 1},
- {"::tk::spinbox", NULL, Tk_SpinboxObjCmd, NULL, 1, 0},
- {"::tk::text", NULL, Tk_TextObjCmd, NULL, 1, 1},
- {"::tk::toplevel", NULL, Tk_ToplevelObjCmd, NULL, 0, 0},
+ {"::tk::button", NULL, Tk_ButtonObjCmd, NULL, ISSAFE},
+ {"::tk::canvas", NULL, Tk_CanvasObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"::tk::checkbutton",NULL, Tk_CheckbuttonObjCmd, NULL, ISSAFE},
+ {"::tk::entry", NULL, Tk_EntryObjCmd, NULL, ISSAFE},
+ {"::tk::frame", NULL, Tk_FrameObjCmd, NULL, ISSAFE},
+ {"::tk::label", NULL, Tk_LabelObjCmd, NULL, ISSAFE},
+ {"::tk::labelframe",NULL, Tk_LabelframeObjCmd, NULL, ISSAFE},
+ {"::tk::listbox", NULL, Tk_ListboxObjCmd, NULL, ISSAFE},
+ {"::tk::menubutton",NULL, Tk_MenubuttonObjCmd, NULL, ISSAFE},
+ {"::tk::message", NULL, Tk_MessageObjCmd, NULL, ISSAFE},
+ {"::tk::panedwindow",NULL, Tk_PanedWindowObjCmd, NULL, ISSAFE},
+ {"::tk::radiobutton",NULL, Tk_RadiobuttonObjCmd, NULL, ISSAFE},
+ {"::tk::scale", NULL, Tk_ScaleObjCmd, NULL, ISSAFE},
+ {"::tk::scrollbar", Tk_ScrollbarCmd,NULL, NULL, PASSMAINWINDOW|ISSAFE},
+ {"::tk::spinbox", NULL, Tk_SpinboxObjCmd, NULL, ISSAFE},
+ {"::tk::text", NULL, Tk_TextObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
+ {"::tk::toplevel", NULL, Tk_ToplevelObjCmd, NULL, 0},
/*
* Standard dialog support. Note that the Unix/X11 platform implements
@@ -184,11 +183,11 @@ static const TkCmd commands[] = {
*/
#if defined(__WIN32__) || defined(MAC_OSX_TK)
- {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, NULL, 0, 1},
- {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd,NULL, 0,1},
- {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, NULL, 0, 1},
- {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, NULL, 0, 1},
- {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, NULL, 0, 1},
+ {"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, NULL, PASSMAINWINDOW},
+ {"tk_chooseDirectory", NULL, Tk_ChooseDirectoryObjCmd,NULL,PASSMAINWINDOW},
+ {"tk_getOpenFile", NULL, Tk_GetOpenFileObjCmd, NULL, PASSMAINWINDOW},
+ {"tk_getSaveFile", NULL, Tk_GetSaveFileObjCmd, NULL, PASSMAINWINDOW},
+ {"tk_messageBox", NULL, Tk_MessageBoxObjCmd, NULL, PASSMAINWINDOW},
#endif
/*
@@ -197,9 +196,9 @@ static const TkCmd commands[] = {
#if defined(MAC_OSX_TK)
{"::tk::unsupported::MacWindowStyle",
- NULL, TkUnsupported1ObjCmd, NULL, 1, 1},
+ NULL, TkUnsupported1ObjCmd, NULL, PASSMAINWINDOW|ISSAFE},
#endif
- {NULL, NULL, NULL, NULL, 0, 0}
+ {NULL, NULL, NULL, NULL, 0}
};
/*
@@ -951,7 +950,7 @@ TkCreateMainWindow(
&& (cmdPtr->initProc == NULL)) {
Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs");
}
- if (cmdPtr->passMainWindow) {
+ if (cmdPtr->flags & PASSMAINWINDOW) {
clientData = tkwin;
} else {
clientData = NULL;
@@ -966,7 +965,7 @@ TkCreateMainWindow(
clientData, NULL);
}
if (isSafe) {
- if (!(cmdPtr->isSafe)) {
+ if (!(cmdPtr->flags & ISSAFE)) {
Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name);
}
}