diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-29 08:22:32 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-04-29 08:22:32 (GMT) |
commit | 83dd76da7170a8bb9c59b60508c5df606204709c (patch) | |
tree | 80e0b58dcbf82e4938b45f818c125a17099d7fc2 | |
parent | 6543fa41fa55392ee287df3d24888f2662bb7b8d (diff) | |
parent | 64ac9dba8558f572db2bd2d6f908134796bf92c3 (diff) | |
download | tk-83dd76da7170a8bb9c59b60508c5df606204709c.zip tk-83dd76da7170a8bb9c59b60508c5df606204709c.tar.gz tk-83dd76da7170a8bb9c59b60508c5df606204709c.tar.bz2 |
merge trunk
-rw-r--r-- | ChangeLog | 53 | ||||
-rw-r--r-- | generic/tk.decls | 23 | ||||
-rw-r--r-- | generic/tkBind.c | 26 | ||||
-rw-r--r-- | generic/tkFocus.c | 8 | ||||
-rw-r--r-- | generic/tkInt.decls | 16 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 200 | ||||
-rw-r--r-- | generic/tkMenuDraw.c | 28 | ||||
-rw-r--r-- | generic/tkPlatDecls.h | 94 | ||||
-rw-r--r-- | generic/tkStubInit.c | 157 | ||||
-rw-r--r-- | generic/tkWindow.c | 145 | ||||
-rw-r--r-- | library/bgerror.tcl | 4 | ||||
-rw-r--r-- | library/choosedir.tcl | 2 | ||||
-rw-r--r-- | library/clrpick.tcl | 2 | ||||
-rw-r--r-- | library/dialog.tcl | 22 | ||||
-rw-r--r-- | library/msgbox.tcl | 2 | ||||
-rw-r--r-- | library/tk.tcl | 21 | ||||
-rw-r--r-- | library/tkfbox.tcl | 6 | ||||
-rw-r--r-- | unix/Makefile.in | 11 | ||||
-rw-r--r-- | unix/tkUnixPort.h | 16 | ||||
-rw-r--r-- | win/rules.vc | 11 | ||||
-rw-r--r-- | win/tkWinWm.c | 18 |
21 files changed, 376 insertions, 489 deletions
@@ -1,10 +1,57 @@ +2012-04-29 Jan Nijtmans <nijtmans@users.sf.net> + + * library/tk.tcl: [Bug 3508771]: Window placement with multiple screens + * generic/tkBind.c: + * generic/tkFocus.c: + * generic/tkMenuDraw.c: + * generic/tkWinWm.c: + +2012-04-26 Donal K. Fellows <dkf@users.sf.net> + + * generic/tkStubInit.c (Tk_GetHINSTANCE): Ensure that this is defined + for OSX. + +2012-04-26 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tk.decls: [Bug 3508771]: Implement TkClipBox, Tk*Region and + * generic/tkInt.decls: Tk_GetHINSTANCE for Cygwin + * generic/tkPlatDecls.h: + * generic/tkintDecls.h: + * generic/tkStubInit.c: + +2012-04-22 Donal K. Fellows <dkf@users.sf.net> + + * generic/tkBind.c (ExpandPercents): [Bug 3520202]: Ensure that the + %k, %K and %N substitutions use dummy tokens with <MouseWheel> events + and that the %D subsitution is a dummy with <Key>/<KeyRelease>. This + was causing significant indigestion (and a read of goodness knows what + memory) to Tkinter/Python because of the way they map events between + languages. + +2012-04-20 Donal K. Fellows <dkf@users.sf.net> + + * generic/tkWindow.c (commands): Ensure that all descriptions of + commands created by Tk are correct. + +2012-04-20 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tk.tcl: Use vroot size in stead of screen size for clipping + window coordinates in ::tk::PlaceWindow. + * generic/dialog.tcl: Use ::tk::PlaceWindow in dialog.tcl, instead of + dumplicating the code there. (harmless part of [Bug 533519]) + +2012-04-13 Jan Nijtmans <nijtmans@users.sf.net> + + * win/rules.vc: [Bug 3517448]: TclKit build fails (unresolved + __strtoi64) + 2012-04-07 Jan Nijtmans <nijtmans@users.sf.net> - * generic/tkBind.c: [Bug 3176239] control-MouseWheel causes segv + * generic/tkBind.c: [Bug 3176239]: control-MouseWheel causes segv 2012-03-30 Jan Nijtmans <nijtmans@users.sf.net> - * unix/tcl.m4: [Bug 3511806] Compiler checks too early + * unix/tcl.m4: [Bug 3511806]: Compiler checks too early * unix/configure.in: This change allows to build the cygwin * unix/configure and mingw32 ports of Tcl/Tk to build * win/tcl.m4: out-of-the-box using a native or cross- @@ -13,7 +60,7 @@ 2012-03-21 Jan Nijtmans <nijtmans@users.sf.net> - * generic/tkColor.c: [Bug 2809525] Abort on overlong color name. + * generic/tkColor.c: [Bug 2809525]: Abort on overlong color name. * unix/tkUnixColor.c: 2012-03-18 Jan Nijtmans <nijtmans@users.sf.net> 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); } } diff --git a/library/bgerror.tcl b/library/bgerror.tcl index 65e7209..3b21d4c 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -220,7 +220,9 @@ proc ::tk::dialog::error::bgerror err { bind $dlg.function <Return> [namespace code {ReturnInDetails %W}] $dlg.function configure -command [namespace code Details] - # 6. Place the window (centered in the display) and deiconify it. + # 6. Withdraw the window, then update all the geometry information + # so we know how big it wants to be, then center the window in the + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $dlg diff --git a/library/choosedir.tcl b/library/choosedir.tcl index 8c87b9e..62e3165 100644 --- a/library/choosedir.tcl +++ b/library/choosedir.tcl @@ -89,7 +89,7 @@ proc ::tk::dialog::file::chooseDir:: {args} { # Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the - # display and de-iconify it. + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) wm title $w $data(-title) diff --git a/library/clrpick.tcl b/library/clrpick.tcl index 712c45d..092915c 100644 --- a/library/clrpick.tcl +++ b/library/clrpick.tcl @@ -89,7 +89,7 @@ proc ::tk::dialog::color:: {args} { # 5. Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the - # display and de-iconify it. + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) wm title $w $data(-title) diff --git a/library/dialog.tcl b/library/dialog.tcl index 1ae5b8a..adea259 100644 --- a/library/dialog.tcl +++ b/library/dialog.tcl @@ -146,27 +146,9 @@ proc ::tk_dialog {w title text bitmap default args} { # 6. Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the - # display and de-iconify it. - - wm withdraw $w - update idletasks - set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \ - - [winfo vrootx [winfo parent $w]]}] - set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \ - - [winfo vrooty [winfo parent $w]]}] - # Make sure that the window is on the screen and set the maximum - # size of the window is the size of the screen. That'll let things - # fail fairly gracefully when very large messages are used. [Bug 827535] - if {$x < 0} { - set x 0 - } - if {$y < 0} { - set y 0 - } - wm maxsize $w [winfo screenwidth $w] [winfo screenheight $w] - wm geometry $w +$x+$y - wm deiconify $w + # display (Motif style) and de-iconify it. + ::tk::PlaceWindow $w tkwait visibility $w # 7. Set a grab and claim the focus too. diff --git a/library/msgbox.tcl b/library/msgbox.tcl index 087567e..60a2a19 100644 --- a/library/msgbox.tcl +++ b/library/msgbox.tcl @@ -395,7 +395,7 @@ proc ::tk::MessageBox {args} { # 7. Withdraw the window, then update all the geometry information # so we know how big it wants to be, then center the window in the - # display and de-iconify it. + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) diff --git a/library/tk.tcl b/library/tk.tcl index 5e6f4a6..deea9db 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -111,20 +111,16 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} { set y [expr {([winfo screenheight $w]-[winfo reqheight $w])/2}] set checkBounds 0 } - if {[tk windowingsystem] eq "win32"} { - # Bug 533519: win32 multiple desktops may produce negative geometry. - set checkBounds 0 - } if {$checkBounds} { - if {$x < 0} { - set x 0 - } elseif {$x > ([winfo screenwidth $w]-[winfo reqwidth $w])} { - set x [expr {[winfo screenwidth $w]-[winfo reqwidth $w]}] + if {$x < [winfo vrootx $w]} { + set x [winfo vrootx $w] + } elseif {$x > ([winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w])} { + set x [expr {[winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w]}] } - if {$y < 0} { - set y 0 - } elseif {$y > ([winfo screenheight $w]-[winfo reqheight $w])} { - set y [expr {[winfo screenheight $w]-[winfo reqheight $w]}] + if {$y < [winfo vrooty $w]} { + set y [winfo vrooty $w] + } elseif {$y > ([winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w])} { + set y [expr {[winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w]}] } if {[tk windowingsystem] eq "aqua"} { # Avoid the native menu bar which sits on top of everything. @@ -133,6 +129,7 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} { } } } + wm maxsize $w [winfo vrootwidth $w] [winfo vrootheight $w] wm geometry $w +$x+$y wm deiconify $w } diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index 6354300..ff79df8 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -196,9 +196,9 @@ proc ::tk::dialog::file:: {type args} { } UpdateWhenIdle $w - # Withdraw the window, then update all the geometry information so we know - # how big it wants to be, then center the window in the display and - # de-iconify it. + # Withdraw the window, then update all the geometry information + # so we know how big it wants to be, then center the window in the + # display (Motif style) and de-iconify it. ::tk::PlaceWindow $w widget $data(-parent) wm title $w $data(-title) diff --git a/unix/Makefile.in b/unix/Makefile.in index 2ab5913..0e73871 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -724,8 +724,15 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) ${WISH_EXE} (\ echo "if {[catch {package present Tcl $(TCLVERSION)$(TCLPATCHL)}]} return";\ relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\ - echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL)\ - [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\ + echo "if {[string match CYGWIN* \$$::tcl_platform(os)]} {";\ + echo " if {([info exists ::env(DISPLAY)] || [lsearch -exact \$$::argv -display] > -1)} {";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]";\ + echo " } else {";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll] Tk]";\ + echo " }";\ + echo "} else {";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\ + echo "}";\ ) > "$(PKG_INDEX)"; \ fi @echo "Installing $(LIB_FILE) to @DLL_INSTALL_DIR@/" diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 64589be..0076e5d 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -114,22 +114,6 @@ #endif /* - * These macros are just wrappers for the equivalent X Region calls. - */ - -#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) - -/* * The TkPutImage macro strips off the color table information, which isn't * needed for X. */ diff --git a/win/rules.vc b/win/rules.vc index 01e44e0..f2ee135 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -473,18 +473,21 @@ OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED !endif -!if $(DEBUG) -OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DEBUG -!elseif $(OPTIMIZING) +!if !$(DEBUG) +OPTDEFINES = $(OPTDEFINES) -DNDEBUG +!if $(OPTIMIZING) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED !endif +!endif !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED !endif !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif - +!if $(VCVERSION) < 1300 +OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 +!endif #---------------------------------------------------------- # Locate the Tcl headers to build against diff --git a/win/tkWinWm.c b/win/tkWinWm.c index e4c9c34..2aa251c 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -6401,20 +6401,10 @@ Tk_GetVRootGeometry( int *widthPtr, int *heightPtr) /* Store dimensions of virtual root here. */ { - TkWindow *winPtr = (TkWindow *) tkwin; - - /* - * XXX: This is not correct for multiple monitors. There may be many - * changes required to get this right, and it may effect existing - * applications that don't consider possible <0 vroot. See - * http://msdn.microsoft.com/library/en-us/gdi/monitor_3lrn.asp for more - * info. - */ - - *xPtr = 0; - *yPtr = 0; - *widthPtr = DisplayWidth(winPtr->display, winPtr->screenNum); - *heightPtr = DisplayHeight(winPtr->display, winPtr->screenNum); + *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); + *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); + *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); + *heightPtr = GetSystemMetrics(SM_CYVIRTUALSCREEN); } /* |