diff options
70 files changed, 1309 insertions, 947 deletions
diff --git a/doc/photo.n b/doc/photo.n index 2f6076e..2673985 100644 --- a/doc/photo.n +++ b/doc/photo.n @@ -552,19 +552,20 @@ background on which the image is displayed to show through. This usually also has the effect of desaturating the image. The \fIalphaValue\fR must be between 0.0 and 1.0. .TP -\fBsvg \-dpi\fI dpiValue\fB \-scale\fI scaleValue\fB \-unit\fI unitValue\fR +\fBsvg \-dpi\fI dpiValue\fB \-scale\fI scaleValue\fB \-scaletowidth \fI width\fB \-scaletoheight\fI height\fR . \fIdpiValue\fR is used in conversion between given coordinates and screen resolution. The value must be greater than 0 and the default value is 96. \fIscaleValue\fR is used to scale the resulting image. The value must be greater than 0 and the default value is 1. -\fIunitValue\fR is the unit of all coordinates in the SVG data. -Available units are px (default, coordinates in pixel), pt (1/72 inch), -pc (12 pt), mm , cm and in. +\fIwidth\fR and \fIheight\fR are the width or height that the image +will be adjusted to. Only one parameter among \fB\-scale\fR, +\fB\-scaletowidth\fR and \fB\-scaletoheight\fR can be given at a time +and the aspect ratio of the original image is always preserved. The svg format supports a wide range of SVG features, but the full SVG standard is not available, for instance the 'text' feature -is missing and silently ignores when reading the SVG data. +is missing and silently ignored when reading the SVG data. The supported SVG features are: . .RS diff --git a/doc/tk_mac.n b/doc/tk_mac.n index 6c50281..8b701e6 100644 --- a/doc/tk_mac.n +++ b/doc/tk_mac.n @@ -124,6 +124,8 @@ proc ::tk::mac::OpenDocument {args} { } .CE .RE +Note: the application must be running for this command to work. + .TP \fB::tk::mac::PrintDocument \fIfile...\fR . @@ -131,7 +133,7 @@ If a proc of this name is defined it is the default Apple Event handler for kAEPrintDocuments, .QW pdoc , the Apple Event sent when your application is asked to print a -document. It takes a single absolute file path as an argument. +document. It takes a single absolute file path as an argument. Note: the application must be running for this command to work. .TP \fB::tk::mac::Quit\fR . diff --git a/generic/tk.h b/generic/tk.h index 98cdd5f..4e787e2 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -85,13 +85,14 @@ extern "C" { #ifndef RC_INVOKED -#ifndef _XLIB_H +#if !defined(_XLIB_H) && !defined(_X11_XLIB_H_) # include <X11/Xlib.h> # ifdef MAC_OSX_TK # include <X11/X.h> # endif #endif -#ifdef __STDC__ +#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \ + || defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC) # include <stddef.h> #endif diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 1c70055..1c18d34 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -1036,7 +1036,7 @@ CanvasWidgetCmd( result = TCL_ERROR; goto done; } - if (mask & (unsigned) ~(ButtonMotionMask|Button1MotionMask + if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask |Button2MotionMask|Button3MotionMask|Button4MotionMask |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask @@ -5079,7 +5079,7 @@ CanvasBindProc( XEvent *eventPtr) /* Pointer to X event that just happened. */ { TkCanvas *canvasPtr = clientData; - unsigned int mask; + unsigned long mask; Tcl_Preserve(canvasPtr); @@ -5175,7 +5175,7 @@ PickCurrentItem( * ButtonRelease, or MotionNotify. */ { double coords[2]; - unsigned int buttonDown; + unsigned long buttonDown; Tk_Item *prevItemPtr; SearchUids *searchUids = GetStaticUids(); diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 40409e2..133761e 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -1541,17 +1541,15 @@ EntryWorldChanged( * * TkpDrawEntryBorderAndFocus -- * - * This function redraws the border of an entry widget. It overrides the - * generic border drawing code if the entry widget parameters are such - * that the native widget drawing is a good fit. This version just - * returns 0, so platforms that don't do special native drawing don't - * have to implement it. + * Stub function for Tk on platforms other than Aqua + * (Windows and X11), which do not draw native entry borders. + * See macosx/tkMacOSXEntry.c for function definition in Tk Aqua. * * Results: - * 1 if it has drawn the border, 0 if not. + * Returns 0. * * Side effects: - * May draw the entry border into pixmap. + * None. * *-------------------------------------------------------------- */ @@ -1570,17 +1568,15 @@ TkpDrawEntryBorderAndFocus( * * TkpDrawSpinboxButtons -- * - * This function redraws the buttons of an spinbox widget. It overrides - * the generic button drawing code if the spinbox widget parameters are - * such that the native widget drawing is a good fit. This version just - * returns 0, so platforms that don't do special native drawing don't - * have to implement it. + * Stub function for Tk on platforms other than Aqua + * (Windows and X11), which do not draw native spinbox buttons. + * See macosx/tkMacOSXEntry.c for function definition in Tk Aqua. * * Results: - * 1 if it has drawn the border, 0 if not. + * Returns 0. * * Side effects: - * May draw the entry border into pixmap. + * None. * *-------------------------------------------------------------- */ diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 39d9d4b..edba156 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -539,12 +539,12 @@ RefreshKeyboardMappingIfNeeded( *---------------------------------------------------------------------- */ -static const unsigned int buttonMasks[] = { +static const unsigned long buttonMasks[] = { 0, Button1Mask, Button2Mask, Button3Mask, 0, 0, 0, 0, Button4Mask, \ Button5Mask, Button6Mask, Button7Mask, Button8Mask, Button9Mask }; -unsigned int +unsigned long TkGetButtonMask( unsigned int button) { @@ -584,24 +584,7 @@ UpdateButtonEventState( dispPtr->mouseButtonWindow = eventPtr->xbutton.window; eventPtr->xbutton.state |= dispPtr->mouseButtonState; - if ((eventPtr->xbutton.button >= Button4) && (eventPtr->xbutton.button < Button8)) { - /* - * Turn the event into a mouse wheel event and queue it - * Note: modelled after the code in tkWinX.c - */ - eventPtr->type = MouseWheelEvent; - eventPtr->xany.send_event = -1; -#if defined(_WIN32) || defined(MAC_OSX_TK) - eventPtr->xkey.nbytes = 0; -#endif - eventPtr->xkey.keycode = (eventPtr->xbutton.button & 1) ? 120 : -120; - if (eventPtr->xkey.keycode > Button5) { - eventPtr->xkey.state |= ShiftMask; - } - Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_TAIL); - } else { - dispPtr->mouseButtonState |= TkGetButtonMask(eventPtr->xbutton.button); - } + dispPtr->mouseButtonState |= TkGetButtonMask(eventPtr->xbutton.button); break; case ButtonRelease: @@ -1230,6 +1213,22 @@ Tk_HandleEvent( ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + +#if !defined(_WIN32) && !defined(MAC_OSX_TK) + if ((eventPtr->xbutton.button >= Button4) && (eventPtr->xbutton.button < Button8)) { + if (eventPtr->type == ButtonRelease) { + return; + } else if (eventPtr->type == ButtonPress) { + eventPtr->type = MouseWheelEvent; + eventPtr->xany.send_event = -1; + eventPtr->xkey.keycode = (eventPtr->xbutton.button & 1) ? 120 : -120; + if (eventPtr->xkey.keycode > Button5) { + eventPtr->xkey.state ^= ShiftMask; + } + } + } +#endif + UpdateButtonEventState(eventPtr); /* diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index d64ae5b..d51c211 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -30,9 +30,9 @@ /* Additional parameters to nsvgRasterize() */ typedef struct { - double x; - double y; double scale; + int scaleToHeight; + int scaleToWidth; } RastOpts; /* @@ -42,6 +42,10 @@ typedef struct { */ typedef struct { + /* A poiner to remember if it is the same svn image (data) + * It is a Tcl_Channel if image created by -file option + * or a Tcl_Obj, if image is created with the -data option + */ ClientData dataOrChan; Tcl_DString formatString; NSVGimage *nsvgImage; @@ -68,6 +72,8 @@ static int RasterizeSVG(Tcl_Interp *interp, Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage, int destX, int destY, int width, int height, int srcX, int srcY, RastOpts *ropts); +static double GetScaleFromParameters(NSVGimage *nsvgImage, + RastOpts *ropts, int *widthPtr, int *heightPtr); static NSVGcache * GetCachePtr(Tcl_Interp *interp); static int CacheSVG(Tcl_Interp *interp, ClientData dataOrChan, Tcl_Obj *formatObj, NSVGimage *nsvgImage, @@ -134,16 +140,15 @@ FileMatchSVG( nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage != NULL) { - *widthPtr = (int) ceil(nsvgImage->width * ropts.scale); - *heightPtr = (int) ceil(nsvgImage->height * ropts.scale); - if ((*widthPtr <= 0) || (*heightPtr <= 0)) { - nsvgDelete(nsvgImage); - return 0; + GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); + if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { + nsvgDelete(nsvgImage); + return 0; } - if (!CacheSVG(interp, chan, formatObj, nsvgImage, &ropts)) { + if (!CacheSVG(interp, chan, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); - } - return 1; + } + return 1; } return 0; } @@ -239,16 +244,15 @@ StringMatchSVG( data = TkGetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); if (nsvgImage != NULL) { - *widthPtr = (int) ceil(nsvgImage->width * ropts.scale); - *heightPtr = (int) ceil(nsvgImage->height * ropts.scale); - if ((*widthPtr <= 0) || (*heightPtr <= 0)) { - nsvgDelete(nsvgImage); - return 0; + GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr); + if ((*widthPtr <= 0.0) || (*heightPtr <= 0.0)) { + nsvgDelete(nsvgImage); + return 0; } - if (!CacheSVG(interp, dataObj, formatObj, nsvgImage, &ropts)) { + if (!CacheSVG(interp, dataObj, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); - } - return 1; + } + return 1; } return 0; } @@ -324,14 +328,14 @@ ParseSVGWithOptions( Tcl_Obj **objv = NULL; int objc = 0; double dpi = 96.0; - char unit[3], *p; char *inputCopy = NULL; NSVGimage *nsvgImage; + int parameterScaleSeen = 0; static const char *const fmtOptions[] = { - "-dpi", "-scale", "-unit", NULL + "-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL }; enum fmtOptions { - OPT_DPI, OPT_SCALE, OPT_UNIT + OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH }; /* @@ -352,9 +356,9 @@ ParseSVGWithOptions( * Process elements of format specification as a list. */ - strcpy(unit, "px"); - ropts->x = ropts->y = 0.0; ropts->scale = 1.0; + ropts->scaleToHeight = 0; + ropts->scaleToWidth = 0; if ((formatObj != NULL) && Tcl_ListObjGetElements(interp, formatObj, &objc, &objv) != TCL_OK) { goto error; @@ -385,6 +389,29 @@ ParseSVGWithOptions( objc--; objv++; + /* + * check that only one scale option is given + */ + switch ((enum fmtOptions) optIndex) { + case OPT_SCALE: + case OPT_SCALE_TO_HEIGHT: + case OPT_SCALE_TO_WIDTH: + if ( parameterScaleSeen ) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "only one of -scale, -scaletoheight, -scaletowidth may be given", -1)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", + NULL); + goto error; + } + parameterScaleSeen = 1; + break; + default: + break; + } + + /* + * Decode parameters + */ switch ((enum fmtOptions) optIndex) { case OPT_DPI: if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) { @@ -411,17 +438,36 @@ ParseSVGWithOptions( goto error; } break; - case OPT_UNIT: - p = Tcl_GetString(objv[0]); - if ((p != NULL) && (p[0])) { - strncpy(unit, p, 3); - unit[2] = '\0'; + case OPT_SCALE_TO_HEIGHT: + if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToHeight) == + TCL_ERROR) { + goto error; + } + if (ropts->scaleToHeight <= 0) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "-scaletoheight value must be positive", -1)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", + NULL); + goto error; + } + break; + case OPT_SCALE_TO_WIDTH: + if (Tcl_GetIntFromObj(interp, objv[0], &ropts->scaleToWidth) == + TCL_ERROR) { + goto error; + } + if (ropts->scaleToWidth <= 0) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "-scaletowidth value must be positive", -1)); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", + NULL); + goto error; } break; } } - nsvgImage = nsvgParse(inputCopy, unit, (float) dpi); + nsvgImage = nsvgParse(inputCopy, "px", (float) dpi); if (nsvgImage == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot parse SVG image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL); @@ -470,9 +516,10 @@ RasterizeSVG( NSVGrasterizer *rast; unsigned char *imgData; Tk_PhotoImageBlock svgblock; + double scale; + + scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h); - w = (int) ceil(nsvgImage->width * ropts->scale); - h = (int) ceil(nsvgImage->height * ropts->scale); rast = nsvgCreateRasterizer(); if (rast == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", -1)); @@ -486,8 +533,8 @@ RasterizeSVG( Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto cleanRAST; } - nsvgRasterize(rast, nsvgImage, (float) ropts->x, (float) ropts->y, - (float) ropts->scale, imgData, w, h, w * 4); + nsvgRasterize(rast, nsvgImage, 0, 0, + (float) scale, imgData, w, h, w * 4); /* transfer the data to a photo block */ svgblock.pixelPtr = imgData; svgblock.width = w; @@ -524,6 +571,66 @@ cleanAST: /* *---------------------------------------------------------------------- * + * GetScaleFromParameters -- + * + * Get the scale value from the already parsed parameters -scale, + * -scaletoheight and -scaletowidth. + * + * The image width and height is also returned. + * + * Results: + * The evaluated or configured scale value, or 0.0 on failure + * + * Side effects: + * heightPtr and widthPtr are set to height and width of the image. + * + *---------------------------------------------------------------------- + */ + +static double +GetScaleFromParameters( + NSVGimage *nsvgImage, + RastOpts *ropts, + int *widthPtr, + int *heightPtr) +{ + double scale; + int width, height; + + if ((nsvgImage->width == 0.0) || (nsvgImage->height == 0.0)) { + width = height = 0; + scale = 1.0; + } else if (ropts->scaleToHeight > 0) { + /* + * Fixed height + */ + height = ropts->scaleToHeight; + scale = height / nsvgImage->height; + width = (int) ceil(nsvgImage->width * scale); + } else if (ropts->scaleToWidth > 0) { + /* + * Fixed width + */ + width = ropts->scaleToWidth; + scale = width / nsvgImage->width; + height = (int) ceil(nsvgImage->height * scale); + } else { + /* + * Scale factor + */ + scale = ropts->scale; + width = (int) ceil(nsvgImage->width * scale); + height = (int) ceil(nsvgImage->height * scale); + } + + *heightPtr = height; + *widthPtr = width; + return scale; +} + +/* + *---------------------------------------------------------------------- + * * GetCachePtr -- * * This function is called to get the per interpreter used diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 3a3cbc7..73fda96 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1557,23 +1557,23 @@ declare 13 aqua { int XBell(Display *d, int i) } declare 14 aqua { - void XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, + int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3) } declare 15 aqua { - void XChangeWindowAttributes(Display *d, Window w, unsigned long ul, + int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, XSetWindowAttributes *x) } declare 16 aqua { - void XConfigureWindow(Display *d, Window w, unsigned int i, + int XConfigureWindow(Display *d, Window w, unsigned int i, XWindowChanges *x) } declare 17 aqua { - void XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, + int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 18 aqua { - void XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, + int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul) } @@ -1585,25 +1585,25 @@ declare 20 aqua { int XDefineCursor(Display *d, Window w, Cursor c) } declare 21 aqua { - void XDestroyWindow(Display *d, Window w) + int XDestroyWindow(Display *d, Window w) } declare 22 aqua { - void XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, + int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 23 aqua { int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2) } declare 24 aqua { - void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, + int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2) } declare 25 aqua { - void XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, + int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 26 aqua { - void XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, + int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3) } declare 27 aqua { @@ -1640,70 +1640,70 @@ declare 35 aqua { KeyCode XKeysymToKeycode(Display *d, KeySym k) } declare 36 aqua { - void XMapWindow(Display *d, Window w) + int XMapWindow(Display *d, Window w) } declare 37 aqua { - void XMoveResizeWindow(Display *d, Window w, int i1, int i2, + int XMoveResizeWindow(Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2) } declare 38 aqua { - void XMoveWindow(Display *d, Window w, int i1, int i2) + int XMoveWindow(Display *d, Window w, int i1, int i2) } declare 39 aqua { Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui) } declare 40 aqua { - void XRaiseWindow(Display *d, Window w) + int XRaiseWindow(Display *d, Window w) } declare 41 aqua { - void XRefreshKeyboardMapping(XMappingEvent *x) + int XRefreshKeyboardMapping(XMappingEvent *x) } declare 42 aqua { - void XResizeWindow(Display *d, Window w, unsigned int ui1, + int XResizeWindow(Display *d, Window w, unsigned int ui1, unsigned int ui2) } declare 43 aqua { - void XSelectInput(Display *d, Window w, long l) + int XSelectInput(Display *d, Window w, long l) } declare 44 aqua { Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x) } declare 45 aqua { - void XSetIconName(Display *d, Window w, _Xconst char *c) + int XSetIconName(Display *d, Window w, _Xconst char *c) } declare 46 aqua { - void XSetInputFocus(Display *d, Window w, int i, Time t) + int XSetInputFocus(Display *d, Window w, int i, Time t) } declare 47 aqua { int XSetSelectionOwner(Display *d, Atom a, Window w, Time t) } declare 48 aqua { - void XSetWindowBackground(Display *d, Window w, unsigned long ul) + int XSetWindowBackground(Display *d, Window w, unsigned long ul) } declare 49 aqua { - void XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p) + int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p) } declare 50 aqua { - void XSetWindowBorder(Display *d, Window w, unsigned long ul) + int XSetWindowBorder(Display *d, Window w, unsigned long ul) } declare 51 aqua { - void XSetWindowBorderPixmap(Display *d, Window w, Pixmap p) + int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p) } declare 52 aqua { - void XSetWindowBorderWidth(Display *d, Window w, unsigned int ui) + int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui) } declare 53 aqua { - void XSetWindowColormap(Display *d, Window w, Colormap c) + int XSetWindowColormap(Display *d, Window w, Colormap c) } declare 54 aqua { - void XUngrabKeyboard(Display *d, Time t) + int XUngrabKeyboard(Display *d, Time t) } declare 55 aqua { int XUngrabPointer(Display *d, Time t) } declare 56 aqua { - void XUnmapWindow(Display *d, Window w) + int XUnmapWindow(Display *d, Window w) } declare 57 aqua { int TkPutImage(unsigned long *colors, int ncolors, Display *display, @@ -1771,7 +1771,7 @@ declare 75 aqua { int _XInitImageFuncPtrs(XImage *image) } declare 76 aqua { - XIC XCreateIC(void) + XIC XCreateIC(XIM xim, ...) } declare 77 aqua { XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask, @@ -1790,7 +1790,7 @@ declare 80 aqua { XSegment *segments, int nsegments) } declare 81 aqua { - void XForceScreenSaver(Display *display, int mode) + int XForceScreenSaver(Display *display, int mode) } declare 82 aqua { int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, @@ -1801,7 +1801,7 @@ declare 83 aqua { int x, int y, unsigned int width, unsigned int height) } declare 84 aqua { - void XClearWindow(Display *d, Window w) + int XClearWindow(Display *d, Window w) } declare 85 aqua { int XDrawPoint(Display *display, Drawable d, GC gc, int x, int y) @@ -1816,10 +1816,10 @@ declare 87 aqua { unsigned int src_height, int dest_x, int dest_y) } declare 88 aqua { - void XQueryColor(Display *display, Colormap colormap, XColor *def_in_out) + int XQueryColor(Display *display, Colormap colormap, XColor *def_in_out) } declare 89 aqua { - void XQueryColors(Display *display, Colormap colormap, + int XQueryColors(Display *display, Colormap colormap, XColor *defs_in_out, int ncolors) } declare 90 aqua { diff --git a/generic/tkInt.h b/generic/tkInt.h index 07591d1..9b0616e 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -996,10 +996,11 @@ typedef struct TkpClipMask { */ #define ALL_BUTTONS \ - (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask|Button6Mask|Button7Mask|Button8Mask|Button9Mask) + (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask \ + |Button6Mask|Button7Mask|Button8Mask|Button9Mask) -MODULE_SCOPE unsigned int TkGetButtonMask(unsigned int); +MODULE_SCOPE unsigned long TkGetButtonMask(unsigned int); /* * Object types not declared in tkObj.c need to be mentioned here so they can diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 4efa241..3c9f150 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -462,21 +462,21 @@ EXTERN Status XAllocColor(Display *d, Colormap c, XColor *xp); /* 13 */ EXTERN int XBell(Display *d, int i); /* 14 */ -EXTERN void XChangeProperty(Display *d, Window w, Atom a1, +EXTERN int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 15 */ -EXTERN void XChangeWindowAttributes(Display *d, Window w, +EXTERN int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 16 */ -EXTERN void XConfigureWindow(Display *d, Window w, +EXTERN int XConfigureWindow(Display *d, Window w, unsigned int i, XWindowChanges *x); /* 17 */ -EXTERN void XCopyArea(Display *d, Drawable dr1, Drawable dr2, +EXTERN int XCopyArea(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 18 */ -EXTERN void XCopyPlane(Display *d, Drawable dr1, Drawable dr2, +EXTERN int XCopyPlane(Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); @@ -487,23 +487,23 @@ EXTERN Pixmap XCreateBitmapFromData(Display *display, Drawable d, /* 20 */ EXTERN int XDefineCursor(Display *d, Window w, Cursor c); /* 21 */ -EXTERN void XDestroyWindow(Display *d, Window w); +EXTERN int XDestroyWindow(Display *d, Window w); /* 22 */ -EXTERN void XDrawArc(Display *d, Drawable dr, GC g, int i1, +EXTERN int XDrawArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 23 */ EXTERN int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 24 */ -EXTERN void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, +EXTERN int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 25 */ -EXTERN void XFillArc(Display *d, Drawable dr, GC g, int i1, +EXTERN int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 26 */ -EXTERN void XFillPolygon(Display *d, Drawable dr, GC g, +EXTERN int XFillPolygon(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 27 */ EXTERN int XFillRectangles(Display *d, Drawable dr, GC g, @@ -535,58 +535,58 @@ EXTERN int XGrabPointer(Display *d, Window w1, Bool b, /* 35 */ EXTERN KeyCode XKeysymToKeycode(Display *d, KeySym k); /* 36 */ -EXTERN void XMapWindow(Display *d, Window w); +EXTERN int XMapWindow(Display *d, Window w); /* 37 */ -EXTERN void XMoveResizeWindow(Display *d, Window w, int i1, +EXTERN int XMoveResizeWindow(Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 38 */ -EXTERN void XMoveWindow(Display *d, Window w, int i1, int i2); +EXTERN int XMoveWindow(Display *d, Window w, int i1, int i2); /* 39 */ EXTERN Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 40 */ -EXTERN void XRaiseWindow(Display *d, Window w); +EXTERN int XRaiseWindow(Display *d, Window w); /* 41 */ -EXTERN void XRefreshKeyboardMapping(XMappingEvent *x); +EXTERN int XRefreshKeyboardMapping(XMappingEvent *x); /* 42 */ -EXTERN void XResizeWindow(Display *d, Window w, unsigned int ui1, +EXTERN int XResizeWindow(Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 43 */ -EXTERN void XSelectInput(Display *d, Window w, long l); +EXTERN int XSelectInput(Display *d, Window w, long l); /* 44 */ EXTERN Status XSendEvent(Display *d, Window w, Bool b, long l, XEvent *x); /* 45 */ -EXTERN void XSetIconName(Display *d, Window w, _Xconst char *c); +EXTERN int XSetIconName(Display *d, Window w, _Xconst char *c); /* 46 */ -EXTERN void XSetInputFocus(Display *d, Window w, int i, Time t); +EXTERN int XSetInputFocus(Display *d, Window w, int i, Time t); /* 47 */ EXTERN int XSetSelectionOwner(Display *d, Atom a, Window w, Time t); /* 48 */ -EXTERN void XSetWindowBackground(Display *d, Window w, +EXTERN int XSetWindowBackground(Display *d, Window w, unsigned long ul); /* 49 */ -EXTERN void XSetWindowBackgroundPixmap(Display *d, Window w, +EXTERN int XSetWindowBackgroundPixmap(Display *d, Window w, Pixmap p); /* 50 */ -EXTERN void XSetWindowBorder(Display *d, Window w, +EXTERN int XSetWindowBorder(Display *d, Window w, unsigned long ul); /* 51 */ -EXTERN void XSetWindowBorderPixmap(Display *d, Window w, +EXTERN int XSetWindowBorderPixmap(Display *d, Window w, Pixmap p); /* 52 */ -EXTERN void XSetWindowBorderWidth(Display *d, Window w, +EXTERN int XSetWindowBorderWidth(Display *d, Window w, unsigned int ui); /* 53 */ -EXTERN void XSetWindowColormap(Display *d, Window w, Colormap c); +EXTERN int XSetWindowColormap(Display *d, Window w, Colormap c); /* 54 */ -EXTERN void XUngrabKeyboard(Display *d, Time t); +EXTERN int XUngrabKeyboard(Display *d, Time t); /* 55 */ EXTERN int XUngrabPointer(Display *d, Time t); /* 56 */ -EXTERN void XUnmapWindow(Display *d, Window w); +EXTERN int XUnmapWindow(Display *d, Window w); /* 57 */ EXTERN int TkPutImage(unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, @@ -641,7 +641,7 @@ EXTERN int XSetLineAttributes(Display *display, GC gc, /* 75 */ EXTERN int _XInitImageFuncPtrs(XImage *image); /* 76 */ -EXTERN XIC XCreateIC(void); +EXTERN XIC XCreateIC(XIM xim, ...); /* 77 */ EXTERN XVisualInfo * XGetVisualInfo(Display *display, long vinfo_mask, XVisualInfo *vinfo_template, @@ -656,7 +656,7 @@ EXTERN Status XStringListToTextProperty(char **list, int count, EXTERN int XDrawSegments(Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 81 */ -EXTERN void XForceScreenSaver(Display *display, int mode); +EXTERN int XForceScreenSaver(Display *display, int mode); /* 82 */ EXTERN int XDrawLine(Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); @@ -665,7 +665,7 @@ EXTERN int XFillRectangle(Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 84 */ -EXTERN void XClearWindow(Display *d, Window w); +EXTERN int XClearWindow(Display *d, Window w); /* 85 */ EXTERN int XDrawPoint(Display *display, Drawable d, GC gc, int x, int y); @@ -679,10 +679,10 @@ EXTERN int XWarpPointer(Display *display, Window src_w, unsigned int src_height, int dest_x, int dest_y); /* 88 */ -EXTERN void XQueryColor(Display *display, Colormap colormap, +EXTERN int XQueryColor(Display *display, Colormap colormap, XColor *def_in_out); /* 89 */ -EXTERN void XQueryColors(Display *display, Colormap colormap, +EXTERN int XQueryColors(Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 90 */ EXTERN Status XQueryTree(Display *d, Window w1, Window *w2, @@ -852,19 +852,19 @@ typedef struct TkIntXlibStubs { XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 11 */ Status (*xAllocColor) (Display *d, Colormap c, XColor *xp); /* 12 */ int (*xBell) (Display *d, int i); /* 13 */ - void (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 14 */ - void (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 15 */ - void (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 16 */ - void (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 17 */ - void (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 18 */ + int (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 14 */ + int (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 15 */ + int (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 16 */ + int (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 17 */ + int (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 18 */ Pixmap (*xCreateBitmapFromData) (Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 19 */ int (*xDefineCursor) (Display *d, Window w, Cursor c); /* 20 */ - void (*xDestroyWindow) (Display *d, Window w); /* 21 */ - void (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 22 */ + int (*xDestroyWindow) (Display *d, Window w); /* 21 */ + int (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 22 */ int (*xDrawLines) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 23 */ - void (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 24 */ - void (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 25 */ - void (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 26 */ + int (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 24 */ + int (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 25 */ + int (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 26 */ int (*xFillRectangles) (Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 27 */ int (*xFreeColormap) (Display *d, Colormap c); /* 28 */ int (*xFreeColors) (Display *d, Colormap c, unsigned long *ulp, int i, unsigned long ul); /* 29 */ @@ -874,27 +874,27 @@ typedef struct TkIntXlibStubs { int (*xGrabKeyboard) (Display *d, Window w, Bool b, int i1, int i2, Time t); /* 33 */ int (*xGrabPointer) (Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 34 */ KeyCode (*xKeysymToKeycode) (Display *d, KeySym k); /* 35 */ - void (*xMapWindow) (Display *d, Window w); /* 36 */ - void (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 37 */ - void (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 38 */ + int (*xMapWindow) (Display *d, Window w); /* 36 */ + int (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 37 */ + int (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 38 */ Bool (*xQueryPointer) (Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 39 */ - void (*xRaiseWindow) (Display *d, Window w); /* 40 */ - void (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 41 */ - void (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 42 */ - void (*xSelectInput) (Display *d, Window w, long l); /* 43 */ + int (*xRaiseWindow) (Display *d, Window w); /* 40 */ + int (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 41 */ + int (*xResizeWindow) (Display *d, Window w, unsigned int ui1, unsigned int ui2); /* 42 */ + int (*xSelectInput) (Display *d, Window w, long l); /* 43 */ Status (*xSendEvent) (Display *d, Window w, Bool b, long l, XEvent *x); /* 44 */ - void (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 45 */ - void (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 46 */ + int (*xSetIconName) (Display *d, Window w, _Xconst char *c); /* 45 */ + int (*xSetInputFocus) (Display *d, Window w, int i, Time t); /* 46 */ int (*xSetSelectionOwner) (Display *d, Atom a, Window w, Time t); /* 47 */ - void (*xSetWindowBackground) (Display *d, Window w, unsigned long ul); /* 48 */ - void (*xSetWindowBackgroundPixmap) (Display *d, Window w, Pixmap p); /* 49 */ - void (*xSetWindowBorder) (Display *d, Window w, unsigned long ul); /* 50 */ - void (*xSetWindowBorderPixmap) (Display *d, Window w, Pixmap p); /* 51 */ - void (*xSetWindowBorderWidth) (Display *d, Window w, unsigned int ui); /* 52 */ - void (*xSetWindowColormap) (Display *d, Window w, Colormap c); /* 53 */ - void (*xUngrabKeyboard) (Display *d, Time t); /* 54 */ + int (*xSetWindowBackground) (Display *d, Window w, unsigned long ul); /* 48 */ + int (*xSetWindowBackgroundPixmap) (Display *d, Window w, Pixmap p); /* 49 */ + int (*xSetWindowBorder) (Display *d, Window w, unsigned long ul); /* 50 */ + int (*xSetWindowBorderPixmap) (Display *d, Window w, Pixmap p); /* 51 */ + int (*xSetWindowBorderWidth) (Display *d, Window w, unsigned int ui); /* 52 */ + int (*xSetWindowColormap) (Display *d, Window w, Colormap c); /* 53 */ + int (*xUngrabKeyboard) (Display *d, Time t); /* 54 */ int (*xUngrabPointer) (Display *d, Time t); /* 55 */ - void (*xUnmapWindow) (Display *d, Window w); /* 56 */ + int (*xUnmapWindow) (Display *d, Window w); /* 56 */ int (*tkPutImage) (unsigned long *colors, int ncolors, Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); /* 57 */ Status (*xParseColor) (Display *display, Colormap map, _Xconst char *spec, XColor *colorPtr); /* 58 */ GC (*xCreateGC) (Display *display, Drawable d, unsigned long valuemask, XGCValues *values); /* 59 */ @@ -914,20 +914,20 @@ typedef struct TkIntXlibStubs { int (*xSetFunction) (Display *display, GC gc, int function); /* 73 */ int (*xSetLineAttributes) (Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 74 */ int (*_XInitImageFuncPtrs) (XImage *image); /* 75 */ - XIC (*xCreateIC) (void); /* 76 */ + XIC (*xCreateIC) (XIM xim, ...); /* 76 */ XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 77 */ void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 78 */ Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 79 */ int (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */ - void (*xForceScreenSaver) (Display *display, int mode); /* 81 */ + int (*xForceScreenSaver) (Display *display, int mode); /* 81 */ int (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 82 */ int (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 83 */ - void (*xClearWindow) (Display *d, Window w); /* 84 */ + int (*xClearWindow) (Display *d, Window w); /* 84 */ int (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */ int (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */ int (*xWarpPointer) (Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y); /* 87 */ - void (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */ - void (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */ + int (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */ + int (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */ Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 90 */ int (*xSync) (Display *display, Bool flag); /* 91 */ #endif /* AQUA */ diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 2aeec2e..33b9720 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -631,7 +631,6 @@ static int IsStartOfNotMergedLine(TkText *textPtr, #define TKTEXT_SCROLL_UNITS 3 #define TKTEXT_SCROLL_ERROR 4 #define TKTEXT_SCROLL_PIXELS 5 -#define TKTEXT_SCROLL_MOUSE 6 /* *---------------------------------------------------------------------- @@ -5894,10 +5893,6 @@ TkTextXviewCmd( case TKTEXT_SCROLL_PIXELS: dInfoPtr->newXPixelOffset += count; break; - case TKTEXT_SCROLL_MOUSE: - if (count < 0) count -= 2; - dInfoPtr->newXPixelOffset += (-count)/3; - break; } dInfoPtr->flags |= DINFO_OUT_OF_DATE; @@ -6302,10 +6297,6 @@ TkTextYviewCmd( case TKTEXT_SCROLL_PIXELS: YScrollByPixels(textPtr, count); break; - case TKTEXT_SCROLL_MOUSE: - if (count < 0) count -= 2; - YScrollByPixels(textPtr, (-count)/3); - break; case TKTEXT_SCROLL_UNITS: YScrollByLines(textPtr, count); break; @@ -8779,10 +8770,10 @@ TextGetScrollInfoObj( VIEW_MOVETO, VIEW_SCROLL }; static const char *const units[] = { - "mouseunits", "pages", "pixels", "units", NULL + "pages", "pixels", "units", NULL }; enum viewUnits { - VIEW_SCROLL_MOUSE, VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS, VIEW_SCROLL_UNITS + VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS, VIEW_SCROLL_UNITS }; int index; @@ -8803,7 +8794,7 @@ TextGetScrollInfoObj( return TKTEXT_SCROLL_MOVETO; case VIEW_SCROLL: if (objc != 5) { - Tcl_WrongNumArgs(interp, 3, objv, "number mouseunits|pages|pixels|units"); + Tcl_WrongNumArgs(interp, 3, objv, "number pages|pixels|units"); return TKTEXT_SCROLL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[4], units, @@ -8811,11 +8802,6 @@ TextGetScrollInfoObj( return TKTEXT_SCROLL_ERROR; } switch ((enum viewUnits) index) { - case VIEW_SCROLL_MOUSE: - if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { - return TKTEXT_SCROLL_ERROR; - } - return TKTEXT_SCROLL_MOUSE; case VIEW_SCROLL_PAGES: if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { return TKTEXT_SCROLL_ERROR; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 2870c07..523a8cb 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -1298,6 +1298,7 @@ ForwBack( if (forward) { TkTextFindDisplayLineEnd(textPtr, indexPtr, 1, &xOffset); while (count-- > 0) { + /* * Go to the end of the line, then forward one char/byte * to get to the beginning of the next line. @@ -1310,17 +1311,31 @@ ForwBack( } else { TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, &xOffset); while (count-- > 0) { + TkTextIndex indexPtr2; + /* * Go to the beginning of the line, then backward one * char/byte to get to the end of the previous line. */ TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL); - TkTextIndexBackChars(textPtr, indexPtr, 1, indexPtr, + TkTextIndexBackChars(textPtr, indexPtr, 1, &indexPtr2, COUNT_DISPLAY_INDICES); + + /* + * If we couldn't go to the previous line, then we wanted + to go before the start of the text: arrange for returning + the first index of the first display line. + */ + + if (!TkTextIndexCmp(indexPtr, &indexPtr2)) { + xOffset = 0; + break; + } + *indexPtr = indexPtr2; } - TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL); } + TkTextFindDisplayLineEnd(textPtr, indexPtr, 0, NULL); /* * This call assumes indexPtr is the beginning of a display line diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index bda315e..16e6f54 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -292,7 +292,7 @@ TkTextTagCmd( if (mask == 0) { return TCL_ERROR; } - if (mask & (unsigned) ~(ButtonMotionMask|Button1MotionMask + if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask |Button2MotionMask|Button3MotionMask|Button4MotionMask |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask @@ -1491,7 +1491,7 @@ TkTextBindProc( unsigned int oldState; oldState = eventPtr->xbutton.state; - eventPtr->xbutton.state &= ~ALL_BUTTONS; + eventPtr->xbutton.state &= ~(unsigned long)ALL_BUTTONS; if (!(textPtr->flags & DESTROYED)) { TkTextPickCurrent(textPtr, eventPtr); } diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 4844bc2..712b3e5 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -745,13 +745,22 @@ Tk_GetScrollInfoObj( } return TK_SCROLL_MOVETO; } else if (ArgPfxEq("scroll")) { + double d; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "scroll number pages|units"); return TK_SCROLL_ERROR; } - if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { + if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) { return TK_SCROLL_ERROR; } + if (d >= 0) { + *intPtr = ceil(d); + } else { + *intPtr = floor(d); + } + if (dblPtr) { + *dblPtr = d; + } arg = TkGetStringFromObj(objv[4], &length); if (ArgPfxEq("pages")) { diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 5b5375c..822a4a6 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -921,7 +921,7 @@ static void DragColumn(Treeview *tv, int i, int delta) static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/ -static const unsigned int TreeviewBindEventMask = +static const unsigned long TreeviewBindEventMask = KeyPressMask|KeyReleaseMask | ButtonPressMask|ButtonReleaseMask | PointerMotionMask|ButtonMotionMask diff --git a/library/bgerror.tcl b/library/bgerror.tcl index 574ad8b..fa095f3 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -21,7 +21,8 @@ namespace eval ::tk::dialog::error { if {[tk windowingsystem] eq "aqua"} { option add *ErrorDialog*background systemAlertBackgroundActive \ widgetDefault - option add *ErrorDialog*info.text.background white widgetDefault + option add *ErrorDialog*info.text.background \ + systemTextBackgroundColor widgetDefault option add *ErrorDialog*Button.highlightBackground \ systemAlertBackgroundActive widgetDefault } diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl index c709668..7bbb91c 100644 --- a/library/demos/cscroll.tcl +++ b/library/demos/cscroll.tcl @@ -58,19 +58,62 @@ $c bind all <Any-Leave> "scrollLeave $c" $c bind all <1> "scrollButton $c" bind $c <2> "$c scan mark %x %y" bind $c <B2-Motion> "$c scan dragto %x %y" -bind $c <MouseWheel> { - %W yview scroll [expr {-((%D+60) / 120)}] units -} -bind $c <Option-MouseWheel> { - %W yview scroll [expr {-((%D+6) / 12)}] units -} -bind $c <Shift-MouseWheel> { - %W xview scroll [expr {-((%D+60) / 120)}] units +if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} { + bind $c <MouseWheel> { + %W yview scroll [expr {-(%D)}] units + } + bind $c <Option-MouseWheel> { + %W yview scroll [expr {-10 * (%D)}] units + } + bind $c <Shift-MouseWheel> { + %W xview scroll [expr {-(%D)}] units + } + bind $c <Shift-Option-MouseWheel> { + %W xview scroll [expr {-10 * (%D)}] units + } +} else { + bind $c <MouseWheel> { + %W yview scroll [expr {-(%D / 30)}] units + } + bind $c <Option-MouseWheel> { + %W yview scroll [expr {-(%D / 3)}] units + } + bind $c <Shift-MouseWheel> { + %W xview scroll [expr {-(%D / 30)}] units + } + bind $c <Shift-Option-MouseWheel> { + %W xview scroll [expr {-(%D / 3)}] units + } } -bind $c <Shift-Option-MouseWheel> { - %W xview scroll [expr {-((%D+6) / 12)}] units + +if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} { + # Support for mousewheels on Linux/Unix commonly comes through mapping + # the wheel to the extended buttons. If you have a mousewheel, find + # Linux configuration info at: + # http://linuxreviews.org/howtos/xfree/mouse/ + bind $c <4> { + if {!$tk_strictMotif} { + %W yview scroll -5 units + } + } + bind $c <Shift-4> { + if {!$tk_strictMotif} { + %W xview scroll -5 units + } + } + bind $c <5> { + if {!$tk_strictMotif} { + %W yview scroll 5 units + } + } + bind $c <Shift-5> { + if {!$tk_strictMotif} { + %W xview scroll 5 units + } + } } + proc scrollEnter canvas { global oldFill set id [$canvas find withtag current] diff --git a/library/demos/paned1.tcl b/library/demos/paned1.tcl index 783b7f3..6b21d35 100644 --- a/library/demos/paned1.tcl +++ b/library/demos/paned1.tcl @@ -26,7 +26,7 @@ pack $btns -side bottom -fill x panedwindow $w.pane pack $w.pane -side top -expand yes -fill both -pady 2 -padx 2m -label $w.pane.left -text "This is the\nleft side" -bg yellow -label $w.pane.right -text "This is the\nright side" -bg cyan +label $w.pane.left -text "This is the\nleft side" -fg black -bg yellow +label $w.pane.right -text "This is the\nright side" -fg black -bg cyan $w.pane add $w.pane.left $w.pane.right diff --git a/library/dialog.tcl b/library/dialog.tcl index c751621..a099d90 100644 --- a/library/dialog.tcl +++ b/library/dialog.tcl @@ -44,11 +44,6 @@ proc ::tk_dialog {w title text bitmap default args} { } set windowingsystem [tk windowingsystem] - if {$windowingsystem eq "aqua"} { - option add *Dialog*background systemDialogBackgroundActive widgetDefault - option add *Dialog*Button.highlightBackground \ - systemDialogBackgroundActive widgetDefault - } # 1. Create the top-level window and divide it into top # and bottom parts. diff --git a/library/iconlist.tcl b/library/iconlist.tcl index 62b0b2d..30352a1 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -446,6 +446,19 @@ package require Tk 8.6 bind $canvas <Control-B1-Motion> {;} bind $canvas <Shift-B1-Motion> [namespace code {my ShiftMotion1 %x %y}] + if {[tk windowingsystem] eq "aqua"} { + bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel [expr {40 * (%W)}]}] + bind $canvas <Option-Shift-MouseWheel> [namespace code {my MouseWheel [expr {400 * (%W)}]}] + } else { + bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel %W}] + } + if {[tk windowingsystem] eq "x11"} { + bind $canvas <Shift-4> [namespace code {my MouseWheel 120}] + bind $canvas <Shift-5> [namespace code {my MouseWheel -120}] + bind $canvas <6> [namespace code {my MouseWheel 120}] + bind $canvas <7> [namespace code {my MouseWheel -120}] + } + bind $canvas <<PrevLine>> [namespace code {my UpDown -1}] bind $canvas <<NextLine>> [namespace code {my UpDown 1}] bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}] @@ -492,6 +505,16 @@ package require Tk 8.6 # ---------------------------------------------------------------------- # Event handlers + method MouseWheel {amount} { + if {$noScroll || $::tk_strictMotif} { + return + } + if {$amount > 0} { + $canvas xview scroll [expr {(-119-$amount) / 120}] units + } else { + $canvas xview scroll [expr {-($amount / 120)}] units + } + } method Btn1 {x y} { focus $canvas set i [$w index @$x,$y] diff --git a/library/listbox.tcl b/library/listbox.tcl index 769fe25..4a76a18 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -177,19 +177,18 @@ bind Listbox <B2-Motion> { } bind Listbox <MouseWheel> { - %W yview scroll [expr {-((%D+15) / 30)}] units + %W yview scroll [expr {-(%D/30)}] units } bind Listbox <Option-MouseWheel> { - %W yview scroll [expr {-((%D+1) / 3)}] units + %W yview scroll [expr {-(%D/3)}] units } bind Listbox <Shift-MouseWheel> { - %W xview scroll [expr {-((%D+15) / 30)}] units + %W xview scroll [expr {-(%D/30)}] units } bind Listbox <Shift-Option-MouseWheel> { - %W xview scroll [expr {-((%D+1) / 3)}] units + %W xview scroll [expr {-(%D/3)}] units } - # ::tk::ListboxBeginSelect -- # # This procedure is typically invoked on button-1 presses. It begins diff --git a/library/msgbox.tcl b/library/msgbox.tcl index 98603af..646c143 100644 --- a/library/msgbox.tcl +++ b/library/msgbox.tcl @@ -164,9 +164,6 @@ proc ::tk::MessageBox {args} { "warning" {set data(-icon) "caution"} "info" {set data(-icon) "note"} } - option add *Dialog*background systemDialogBackgroundActive widgetDefault - option add *Dialog*Button.highlightBackground \ - systemDialogBackgroundActive widgetDefault } if {![winfo exists $data(-parent)]} { diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index a20f1a0..d797b24 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -130,16 +130,16 @@ bind Scrollbar <<LineEnd>> { } bind Scrollbar <MouseWheel> { - tk::ScrollByUnits %W v [expr {-((%D+15) / 30)}] + tk::ScrollByUnits %W v [expr {-(%D / 30)}] } bind Scrollbar <Option-MouseWheel> { - tk::ScrollByUnits %W v [expr {-((%D+1) / 3)}] + tk::ScrollByUnits %W v [expr {-(%D / 3)}] } bind Scrollbar <Shift-MouseWheel> { - tk::ScrollByUnits %W h [expr {-((%D+15) / 30)}] + tk::ScrollByUnits %W h [expr {-(%D / 30)}] } bind Scrollbar <Shift-Option-MouseWheel> { - tk::ScrollByUnits %W h [expr {-((%D+1) / 3)}] + tk::ScrollByUnits %W h [expr {-(%D / 3)}] } # tk::ScrollButtonDown -- diff --git a/library/text.tcl b/library/text.tcl index 98255e4..e7a5a0e 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -427,17 +427,36 @@ bind Text <B2-Motion> { } set ::tk::Priv(prevPos) {} +# The MouseWheel will typically only fire on Windows and MacOS X. +# However, someone could use the "event generate" command to produce one +# on other platforms. We must be careful not to round -ve values of %D +# down to zero. + +# We must make sure that positive and negative movements are rounded +# equally to integers, avoiding the problem that +# (int)1/3 = 0, +# but +# (int)-1/3 = -1 +# The following code ensure equal +/- behaviour. bind Text <MouseWheel> { - %W yview scroll %D mouseunits + if {%D >= 0} { + %W yview scroll [expr {-%D/3}] pixels + } else { + %W yview scroll [expr {(2-%D)/3}] pixels + } } bind Text <Option-MouseWheel> { - %W yview scroll [expr {10 * (%D)}] mouseunits + %W yview scroll [expr {-3*%D}] pixels } bind Text <Shift-MouseWheel> { - %W xview scroll %D mouseunits + if {%D >= 0} { + %W xview scroll [expr {-%D/3}] pixels + } else { + %W xview scroll [expr {(2-%D)/3}] pixels + } } bind Text <Shift-Option-MouseWheel> { - %W xview scroll [expr {10 * (%D)}] mouseunits + %W xview scroll [expr {-3*%D}] pixels } # ::tk::TextClosestGap -- @@ -845,11 +864,10 @@ proc ::tk::TextInsert {w s} { # ::tk::TextUpDownLine -- # Returns the index of the character one display line above or below the -# insertion cursor. There are two tricky things here. First, we want to -# maintain the original x position across repeated operations, even though -# some lines that will get passed through don't have enough characters to -# cover the original column. Second, don't try to scroll past the -# beginning or end of the text. +# insertion cursor. There is a tricky thing here: we want to maintain the +# original x position across repeated operations, even though some lines +# that will get passed through don't have enough characters to cover the +# original column. # # Arguments: # w - The text window in which the cursor is to move. @@ -866,11 +884,11 @@ proc ::tk::TextUpDownLine {w n} { set lines [$w count -displaylines $Priv(textPosOrig) $i] set new [$w index \ "$Priv(textPosOrig) + [expr {$lines + $n}] displaylines"] - if {[$w compare $new == end] \ - || [$w compare $new == "insert display linestart"]} { - set new $i - } set Priv(prevPos) $new + if {[$w compare $new == "end display lineend"] \ + || [$w compare $new == "insert display linestart"]} { + set Priv(textPosOrig) $new + } return $new } diff --git a/library/tk.tcl b/library/tk.tcl index 67aedf9..f00b4f9 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -462,7 +462,8 @@ switch -exact -- [tk windowingsystem] { # Official bindings # See http://support.apple.com/kb/HT1343 event add <<SelectAll>> <Command-Key-a> - event add <<SelectNone>> <Option-Command-Key-a> + #Attach function keys not otherwise assigned to this event so they no-op - workaround for bug 0e6930dfe7 + event add <<SelectNone>> <Option-Command-Key-a> <Key-F5> <Key-F1> <Key-F5> <Key-F6> <Key-F7> <Key-F8> <Key-F9> <Key-F10> <Key-F11> <Key-F12> event add <<Undo>> <Command-Key-z> <Command-Lock-Key-Z> event add <<Redo>> <Shift-Command-Key-z> <Shift-Command-Lock-Key-z> event add <<NextChar>> <Right> <Control-Key-f> <Control-Lock-Key-F> diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index d1b0bff..15e13ce 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -26,8 +26,12 @@ namespace eval ttk::theme::aqua { !focus systemSelectedTextColor} # Button - ttk::style configure TButton -anchor center -width -6\ + ttk::style configure TButton -anchor center -width -6 \ -foreground systemControlTextColor + ttk::style map TButton \ + -foreground { + pressed white + {alternate !pressed !background} white} ttk::style configure TMenubutton -anchor center -padding {2 0 0 2} ttk::style configure Toolbutton -anchor center diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index 75f7791..852f01c 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -99,23 +99,20 @@ namespace eval ttk { } "aqua" { - if {[package vsatisfies [package provide Tk] 8.5]} { - # appeared 2007-04-23, Tk 8.5a6 - array set Cursors { - standard arrow - text ibeam - link pointinghand - crosshair crosshair - busy watch - forbidden notallowed - - hresize resizeleftright - vresize resizeupdown - nresize resizeup - sresize resizedown - wresize resizeleft - eresize resizeright - } + array set Cursors { + standard arrow + text ibeam + link pointinghand + crosshair crosshair + busy watch + forbidden notallowed + + hresize resizeleftright + vresize resizeupdown + nresize resizeup + sresize resizedown + wresize resizeleft + eresize resizeright } } } diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index ad36927..fc8b4e0 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -285,8 +285,8 @@ proc ttk::copyBindings {from to} { # proc ttk::bindMouseWheel {bindtag callback} { - bind $bindtag <MouseWheel> [append callback { [expr {-((%D+60)/120)}]}] - bind $bindtag <Option-MouseWheel> [append callback { [expr {-((%D+6)/12)}]}] + bind $bindtag <MouseWheel> [append callback { [expr {-(%D / 120)}]}] + bind $bindtag <Option-MouseWheel> [append callback { [expr {-(%D / 12)}]}] } ## Mousewheel bindings for standard scrollable widgets. @@ -298,12 +298,12 @@ proc ttk::bindMouseWheel {bindtag callback} { # bind TtkScrollable <MouseWheel> \ -{ %W yview scroll [expr {-((%D+60)/120)}] units } + { %W yview scroll [expr {-(%D / 120)}] units } bind TtkScrollable <Option-MouseWheel> \ -{ %W yview scroll [expr {-((%D+6)/12)}] units } + { %W yview scroll [expr {-(%D / 12)}] units } bind TtkScrollable <Shift-MouseWheel> \ -{ %W xview scroll [expr {-((%D+60)/120)}] units } + { %W xview scroll [expr {-(%D / 120)}] units } bind TtkScrollable <Shift-Option-MouseWheel> \ -{ %W xview scroll [expr {-((%D+6)/12)}] units } + { %W xview scroll [expr {-(%D / 12)}] units } #*EOF* diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index 39e5962..2263e37 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -225,22 +225,6 @@ ifeq (${EMBEDDED_BUILD},1) @rm -f "${INSTALL_ROOT}${BINDIR}/${WISH}" && \ rmdir -p "${INSTALL_ROOT}${BINDIR}" 2>&- || true else -# redo prebinding (when not building for Mac OS X 10.4 or later only) - @if [ "`echo "$${MACOSX_DEPLOYMENT_TARGET}" | \ - awk -F '10\\.' '{print int($$2)}'`" -lt 4 -a "`echo "$${CFLAGS}" | \ - awk -F '-mmacosx-version-min=10\\.' '{print int($$2)}'`" -lt 4 ]; \ - then cd ${INSTALL_ROOT}/; \ - if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; \ - if [ -n "${TK_X11}" -a ! -d usr/X11R6 ]; then mkdir -p usr && ln -fs /usr/X11R6 usr/ && RM_USRX11=1; fi; \ - if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; \ - if [ ! -d "./${LIBDIR}/Tcl.framework" ]; then ln -fs "${TCL_FRAMEWORK_DIR}/Tcl.framework" "./${LIBDIR}"; RM_TCL=1; fi; \ - redo_prebinding -r . "./${TK_FMWK_DIR}/${PRODUCT_NAME}"; \ - if [ -z "${TK_X11}" ]; then redo_prebinding -r . "./${TK_FMWK_DIR}/Resources/Wish.app/Contents/MacOS/Wish"; \ - else redo_prebinding -r . "./${BINDIR}/${WISH}"; fi; \ - if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; \ - if [ -n "$${RM_USRX11:-}" ]; then rm -f usr/X11R6; rmdir -p usr 2>&-; fi; \ - if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi; \ - if [ -n "$${RM_TCL:-}" ]; then rm -f "./${LIBDIR}/Tcl.framework"; fi; fi # install wish symbolic link @ln -fs ${WISH} "${INSTALL_ROOT}${BINDIR}/${wish}" endif diff --git a/macosx/README b/macosx/README index 7df4893..6d84b3e 100644 --- a/macosx/README +++ b/macosx/README @@ -171,7 +171,8 @@ newAppearance option: "aqua", "darkaqua", or "auto". If the appearance is set to aqua or darkaqua then the window will be displayed with the corresponding appearance independent of any preferences settings. If it is set to "auto" the appearance will be determined by the preferences. This command can be -used to opt out of Dark Mode on a per-window basis. +used to opt out of Dark Mode on a per-window basis. It may be best to run the "update" command before setting the appearance property, to allow the event loop to run. + - To determine the current appearance of a window in macOS 10.14 (Mojave) and higher, one can use the command: diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 00c7c9b..8a121ee 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -457,12 +457,12 @@ DrawButtonImageAndText( int textXOffset = 0, textYOffset = 0; int width = 0, height = 0; int fullWidth = 0, fullHeight = 0; + DrawParams *dpPtr = &mbPtr->drawParams; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } - DrawParams *dpPtr = &mbPtr->drawParams; pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->image != None) { @@ -477,10 +477,6 @@ DrawButtonImageAndText( imageHeight = height; if (mbPtr->drawinfo.state == kThemeStatePressed) { - /* - * Offset bitmaps by a bit when the button is pressed. - */ - pressed = 1; } @@ -578,11 +574,9 @@ DrawButtonImageAndText( imageXOffset, imageYOffset, 1); XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } - y += 1; /* Tweak to match native buttons. */ - Tk_DrawTextLayout(butPtr->display, pixmap, - dpPtr->gc, butPtr->textLayout, - x + textXOffset, y + textYOffset, 0, -1); + Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, + x + textXOffset, y + textYOffset, 0, -1); Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x + textXOffset, y + textYOffset, @@ -630,8 +624,8 @@ DrawButtonImageAndText( butPtr->textHeight, &x, &y); x += butPtr->indicatorSpace; y += 1; /* Tweak to match native buttons */ - Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, - butPtr->textLayout, x, y, 0, -1); + Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, + x, y, 0, -1); } /* @@ -772,12 +766,15 @@ TkMacOSXDrawButton( } /* - * To avoid buttons with white text on a white background, we always - * set the state to inactive in Dark Mode. It isn't perfect but it is - * usable. Using a ttk::button would be a better choice, however. + * To avoid buttons with white text on a white background, we set the + * state to inactive in Dark Mode unless the button is pressed or is a + * -default active button. This isn't perfect but it is mostly usable. + * Using a ttk::button would be a much better choice, however. */ - if (TkMacOSXInDarkMode(butPtr->tkwin)) { + if (TkMacOSXInDarkMode(butPtr->tkwin) && + mbPtr->drawinfo.state != kThemeStatePressed && + !(mbPtr->drawinfo.adornment & kThemeAdornmentDefault)) { hiinfo.state = kThemeStateInactive; } HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, @@ -1047,7 +1044,9 @@ TkMacOSXComputeButtonParams( drawinfo->adornment = kThemeAdornmentNone; if (butPtr->defaultState == DEFAULT_ACTIVE) { - drawinfo->adornment |= kThemeAdornmentDefault; + if (drawinfo->state != kThemeStatePressed) { + drawinfo->adornment |= kThemeAdornmentDefault; + } if (!mbPtr->defaultPulseHandler) { mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler( PULSE_TIMER_MSECS, PulseDefaultButtonProc, butPtr); @@ -1109,6 +1108,13 @@ TkMacOSXComputeButtonDrawParams( } else if (butPtr->type == TYPE_BUTTON && butPtr->state == STATE_ACTIVE) { dpPtr->gc = butPtr->activeTextGC; dpPtr->border = butPtr->activeBorder; + } else if ((mbPtr->drawinfo.adornment & kThemeAdornmentDefault) && + mbPtr->drawinfo.state == kThemeStateActive) { + /* + * This is a "-default active" button in the front window. + */ + + dpPtr->gc = butPtr->activeTextGC; } else { dpPtr->gc = butPtr->normalTextGC; } diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 6cbcdf6..452b32f 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -259,7 +259,7 @@ TkSelUpdateClipboard( void TkSelEventProc( Tk_Window tkwin, /* Window for which event was targeted. */ - register XEvent *eventPtr) /* X event: either SelectionClear, + XEvent *eventPtr) /* X event: either SelectionClear, * SelectionRequest, or SelectionNotify. */ { if (eventPtr->type == SelectionClear) { @@ -287,7 +287,7 @@ TkSelEventProc( void TkSelPropProc( - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { } diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 4cdae53..73060ef 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -54,8 +54,8 @@ #define DEF_BUTTON_ANCHOR "center" #define DEF_BUTTON_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_BUTTON_ACTIVE_BG_MONO BLACK -#define DEF_BUTTON_ACTIVE_FG_COLOR ACTIVE_FG -#define DEF_CHKRAD_ACTIVE_FG_COLOR DEF_BUTTON_ACTIVE_FG_COLOR +#define DEF_BUTTON_ACTIVE_FG_COLOR WHITE +#define DEF_CHKRAD_ACTIVE_FG_COLOR ACTIVE_FG #define DEF_BUTTON_ACTIVE_FG_MONO WHITE #define DEF_BUTTON_BG_COLOR NORMAL_BG #define DEF_BUTTON_BG_MONO WHITE diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index ad952e8..d93b5e2 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -197,6 +197,18 @@ getFileURL( @implementation TKApplication(TKDialog) +- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { + return YES; +} + +- (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url { +} + +- (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError { + *outError = nil; + return YES; +} + - (void) tkFilePanelDidEnd: (NSSavePanel *) panel returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo { @@ -324,6 +336,30 @@ getFileURL( #pragma mark - +static NSInteger showOpenSavePanel( + NSSavePanel *panel, + NSWindow *parent, + FilePanelCallbackInfo *callbackInfo) +{ + NSInteger modalReturnCode; + + if (parent && ![parent attachedSheet] && [NSApp macMinorVersion] < 15) { + [panel beginSheetModalForWindow:parent + completionHandler:^(NSInteger returnCode) { + [NSApp tkFilePanelDidEnd:panel + returnCode:returnCode + contextInfo:callbackInfo ]; + }]; + modalReturnCode = callbackInfo->cmdObj ? modalOther : + [NSApp runModalForWindow:panel]; + } else { + modalReturnCode = [panel runModal]; + [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode + contextInfo:callbackInfo]; + } + return modalReturnCode; +} + /* *---------------------------------------------------------------------- * @@ -618,6 +654,8 @@ Tk_GetOpenFileObjCmd( NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; + [openpanel setDelegate:NSApp]; + for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], openOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { @@ -679,25 +717,24 @@ Tk_GetOpenFileObjCmd( break; } } - if (title) { [openpanel setTitle:title]; /* * From OSX 10.11, the title string is silently ignored in the open - * panel. Prepend the title to the message in this case. NOTE should - * be conditional on OSX version, but -mmacosx-version-min does not - * revert this behaviour + * panel. Prepend the title to the message in this case. */ - if (message) { - NSString *fullmessage = + if ([NSApp macMinorVersion] > 10) { + if (message) { + NSString *fullmessage = [[NSString alloc] initWithFormat:@"%@\n%@", title, message]; - [message release]; - [title release]; - message = fullmessage; - } else { - message = title; + [message release]; + [title release]; + message = fullmessage; + } else { + message = title; + } } } @@ -713,27 +750,24 @@ Tk_GetOpenFileObjCmd( } if (filterInfo.doFileTypes) { - NSView *accessoryView = [[NSView alloc] - initWithFrame:NSMakeRect(0.0, 0.0, 300, 32.0)]; NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 60, 22)]; + NSPopUpButton *popupButton = [[NSPopUpButton alloc] + initWithFrame:NSMakeRect(50.0, 2, 240, 22.0) pullsDown:NO]; + NSView *accessoryView = [[NSView alloc] + initWithFrame:NSMakeRect(0.0, 0.0, 300, 32.0)]; [label setEditable:NO]; [label setStringValue:@"Filter:"]; [label setBordered:NO]; [label setBezeled:NO]; [label setDrawsBackground:NO]; - - NSPopUpButton *popupButton = [[NSPopUpButton alloc] - initWithFrame:NSMakeRect(50.0, 2, 240, 22.0) pullsDown:NO]; - [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton setAction:@selector(selectFormat:)]; - [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; - if (filterInfo.preselectFilter) { + /* * A specific filter was selected from the typevariable. Select it * and open the accessory view. @@ -746,17 +780,16 @@ Tk_GetOpenFileObjCmd( * allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ + [openpanel setAllowedFileTypes:filterInfo.allowedExtensions]; } else { [openpanel setAllowedFileTypes:filterInfo.allowedExtensions]; } - if (filterInfo.allowedExtensionsAllowAll) { [openpanel setAllowsOtherFileTypes:YES]; } else { [openpanel setAllowsOtherFileTypes:NO]; } - [openpanel setAccessoryView:accessoryView]; } else { /* @@ -765,51 +798,33 @@ Tk_GetOpenFileObjCmd( [openpanel setAllowsOtherFileTypes:YES]; } - if (cmdObj) { - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } - + callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = multiple; - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); - if (haveParentOption && parent && ![parent attachedSheet]) { - parentIsKey = [parent isKeyWindow]; - if (directory || filename) { - NSURL *fileURL = getFileURL(directory, filename); + if (directory || filename) { + NSURL *fileURL = getFileURL(directory, filename); - [openpanel setDirectoryURL:fileURL]; - } - - [openpanel beginSheetModalForWindow:parent - completionHandler:^(NSInteger returnCode) { - [NSApp tkFilePanelDidEnd:openpanel - returnCode:returnCode - contextInfo:callbackInfo ]; - }]; - modalReturnCode = cmdObj ? modalOther : - [NSApp runModalForWindow:openpanel]; + [openpanel setDirectoryURL:fileURL]; + } + if (haveParentOption) { + parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parentIsKey = parent && [parent isKeyWindow]; } else { - if (directory || filename) { - NSURL *fileURL = getFileURL(directory, filename); - - [openpanel setDirectoryURL:fileURL]; - } - - modalReturnCode = [openpanel runModal]; - [NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode - contextInfo:callbackInfo]; + parent = nil; + parentIsKey = False; } + modalReturnCode = showOpenSavePanel(openpanel, parent, callbackInfo); result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } - if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && filterInfo.doFileTypes) { /* @@ -833,7 +848,7 @@ Tk_GetOpenFileObjCmd( */ NSURL *selectedFile; - + NSString *extension; if (multiple) { /* * Use the first file in the case of multiple selection. @@ -844,14 +859,13 @@ Tk_GetOpenFileObjCmd( selectedFile = [openpanel URL]; } - NSString *extension = [selectedFile pathExtension]; + extension = [selectedFile pathExtension]; if (filterInfo.preselectFilter && filterCompatible(extension, filterInfo.fileTypeIndex)) { selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { - // scan the list NSUInteger i; for (i = 0; i < [filterInfo.fileTypeNames count]; i++) { @@ -867,13 +881,11 @@ Tk_GetOpenFileObjCmd( } } } - Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY); } - - end: + end: return result; } @@ -916,6 +928,8 @@ Tk_GetSaveFileObjCmd( NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; + [savepanel setDelegate:NSApp]; + for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], saveOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { @@ -1063,60 +1077,38 @@ Tk_GetSaveFileObjCmd( [savepanel setExtensionHidden:NO]; if (cmdObj) { - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } + callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); - if (haveParentOption && parent && ![parent attachedSheet]) { - parentIsKey = [parent isKeyWindow]; - if (directory) { - [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; - } + if (directory) { + [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; + } - /* - * Check for file name, otherwise set to empty string; crashes with - * uncaught exception if set to nil. - */ + /* + * Check for file name and set to the empty string if nil. This prevents a crash + * with an uncaught exception. + */ - if (filename) { - [savepanel setNameFieldStringValue:filename]; - } else { - [savepanel setNameFieldStringValue:@""]; - } - [savepanel beginSheetModalForWindow:parent - completionHandler:^(NSInteger returnCode) { - [NSApp tkFilePanelDidEnd:savepanel - returnCode:returnCode - contextInfo:callbackInfo]; - }]; - modalReturnCode = cmdObj ? modalOther : - [NSApp runModalForWindow:savepanel]; + if (filename) { + [savepanel setNameFieldStringValue:filename]; } else { - if (directory) { - [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; - } - - /* - * Check for file name, otherwise set to empty string; crashes with - * uncaught exception if set to nil. - */ - - if (filename) { - [savepanel setNameFieldStringValue:filename]; - } else { - [savepanel setNameFieldStringValue:@""]; - } - modalReturnCode = [savepanel runModal]; - [NSApp tkFilePanelDidEnd:savepanel returnCode:modalReturnCode - contextInfo:callbackInfo]; + [savepanel setNameFieldStringValue:@""]; } + if (haveParentOption) { + parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parentIsKey = parent && [parent isKeyWindow]; + } else { + parent = nil; + parentIsKey = False; + } + modalReturnCode = showOpenSavePanel(savepanel, parent, callbackInfo); result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; @@ -1179,6 +1171,8 @@ Tk_ChooseDirectoryObjCmd( NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; + [panel setDelegate:NSApp]; + for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], chooseOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { @@ -1234,12 +1228,12 @@ Tk_ChooseDirectoryObjCmd( [panel setCanChooseDirectories:YES]; [panel setCanCreateDirectories:!mustexist]; if (cmdObj) { - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } + callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; @@ -1253,22 +1247,15 @@ Tk_ChooseDirectoryObjCmd( directory = @"/"; } parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); - if (haveParentOption && parent && ![parent attachedSheet]) { - parentIsKey = [parent isKeyWindow]; - [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; - [panel beginSheetModalForWindow:parent - completionHandler:^(NSInteger returnCode) { - [NSApp tkFilePanelDidEnd:panel - returnCode:returnCode - contextInfo:callbackInfo]; - }]; - modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:panel]; + [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; + if (haveParentOption) { + parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parentIsKey = parent && [parent isKeyWindow]; } else { - [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; - modalReturnCode = [panel runModal]; - [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode - contextInfo:callbackInfo]; + parent = nil; + parentIsKey = False; } + modalReturnCode = showOpenSavePanel(panel, parent, callbackInfo); result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; @@ -1537,19 +1524,19 @@ Tk_MessageBoxObjCmd( [[buttons objectAtIndex: defaultNativeButtonIndex-1] setKeyEquivalent: @"\r"]; if (cmdObj) { - callbackInfo = ckalloc(sizeof(AlertCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } + callbackInfo = ckalloc(sizeof(AlertCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->typeIndex = typeIndex; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; -#if MAC_OS_X_VERSION_MIN_REQUIRED > 1090 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 [alert beginSheetModalForWindow:parent completionHandler:^(NSModalResponse returnCode) { [NSApp tkAlertDidEnd:alert @@ -1563,7 +1550,7 @@ Tk_MessageBoxObjCmd( contextInfo:callbackInfo]; #endif modalReturnCode = cmdObj ? 0 : - [NSApp runModalForWindow:[alert window]]; + [alert runModal]; } else { modalReturnCode = [alert runModal]; [NSApp tkAlertDidEnd:alert returnCode:modalReturnCode diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index f985931..103a72e 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -222,7 +222,7 @@ TkMacOSXBitmapRepFromDrawableRect( *---------------------------------------------------------------------- */ -void +int XCopyArea( Display *display, /* Display. */ Drawable src, /* Source drawable. */ @@ -243,17 +243,17 @@ XCopyArea( display->request++; if (!width || !height) { - return; + return BadDrawable; } if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { TkMacOSXDbgMsg("Failed to setup drawing context."); - return; + return BadDrawable; } if (!dc.context) { TkMacOSXDbgMsg("Invalid destination drawable - no context."); - return; + return BadDrawable; } if (srcDraw->flags & TK_IS_PIXMAP) { @@ -280,6 +280,7 @@ XCopyArea( } TkMacOSXRestoreDrawingContext(&dc); + return Success; } /* @@ -300,7 +301,7 @@ XCopyArea( *---------------------------------------------------------------------- */ -void +int XCopyPlane( Display *display, /* Display. */ Drawable src, /* Source drawable. */ @@ -321,14 +322,14 @@ XCopyPlane( display->request++; if (!width || !height) { /* TkMacOSXDbgMsg("Drawing of empty area requested"); */ - return; + return BadDrawable; } if (plane != 1) { Tcl_Panic("Unexpected plane specified for XCopyPlane"); } if (srcDraw->flags & TK_IS_PIXMAP) { if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { - return; + return BadDrawable; } CGContextRef context = dc.context; @@ -401,12 +402,13 @@ XCopyPlane( "could not get a bitmap context."); } TkMacOSXRestoreDrawingContext(&dc); + return Success; } else { /* * Source drawable is a Window, not a Pixmap. */ - XCopyArea(display, src, dst, gc, src_x, src_y, width, height, + return XCopyArea(display, src, dst, gc, src_x, src_y, width, height, dest_x, dest_y); } } @@ -848,7 +850,7 @@ XDrawSegments( *---------------------------------------------------------------------- */ -void +int XFillPolygon( Display *display, /* Display. */ Drawable d, /* Draw on this. */ @@ -864,7 +866,7 @@ XFillPolygon( display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { double prevx, prevy; @@ -888,6 +890,7 @@ XFillPolygon( CGContextEOFillPath(dc.context); } TkMacOSXRestoreDrawingContext(&dc); + return Success; } /* @@ -906,7 +909,7 @@ XFillPolygon( *---------------------------------------------------------------------- */ -void +int XDrawRectangle( Display *display, /* Display. */ Drawable d, /* Draw on this. */ @@ -920,12 +923,12 @@ XDrawRectangle( int lw = gc->line_width; if (width == 0 || height == 0) { - return; + return BadDrawable; } display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { CGRect rect; @@ -937,6 +940,7 @@ XDrawRectangle( CGContextStrokeRect(dc.context, rect); } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #ifdef TK_MACOSXDRAW_UNUSED @@ -1115,7 +1119,7 @@ TkMacOSXDrawSolidBorder( *---------------------------------------------------------------------- */ -void +int XDrawArc( Display *display, /* Display. */ Drawable d, /* Draw on this. */ @@ -1131,12 +1135,12 @@ XDrawArc( int lw = gc->line_width; if (width == 0 || height == 0 || angle2 == 0) { - return; + return BadDrawable; } display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { CGRect rect; @@ -1166,6 +1170,7 @@ XDrawArc( } } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #ifdef TK_MACOSXDRAW_UNUSED @@ -1191,7 +1196,7 @@ XDrawArc( *---------------------------------------------------------------------- */ -void +int XDrawArcs( Display *display, Drawable d, @@ -1206,7 +1211,7 @@ XDrawArcs( display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { CGRect rect; @@ -1247,6 +1252,7 @@ XDrawArcs( } } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #endif @@ -1266,7 +1272,7 @@ XDrawArcs( *---------------------------------------------------------------------- */ -void +int XFillArc( Display *display, /* Display. */ Drawable d, /* Draw on this. */ @@ -1282,12 +1288,12 @@ XFillArc( int lw = gc->line_width; if (width == 0 || height == 0 || angle2 == 0) { - return; + return BadDrawable; } display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { CGRect rect; @@ -1326,6 +1332,7 @@ XFillArc( } } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #ifdef TK_MACOSXDRAW_UNUSED diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c index a1c5d60..7915f6f 100644 --- a/macosx/tkMacOSXEntry.c +++ b/macosx/tkMacOSXEntry.c @@ -124,16 +124,17 @@ TkpDrawEntryBorderAndFocus( int incDecWidth; /* - * Temporarily change the width of the widget so that the same code can - * be used for drawing the Entry portion of the Spinbox as is used to - * draw an ordinary Entry. The width must be restored before - * returning. + * If native spinbox buttons are going to be drawn, then temporarily + * change the width of the widget so that the same code can be used + * for drawing the Entry portion of the Spinbox as is used to draw + * an ordinary Entry. The width must be restored before returning. */ oldWidth = Tk_Width(tkwin); - ComputeIncDecParameters(Tk_Height(tkwin) - 2 * MAC_OSX_FOCUS_WIDTH, - &incDecWidth); - Tk_Width(tkwin) -= incDecWidth + 1; + if (ComputeIncDecParameters(Tk_Height(tkwin) - 2 * MAC_OSX_FOCUS_WIDTH, + &incDecWidth) != 0) { + Tk_Width(tkwin) -= incDecWidth + 1; + } } /* @@ -186,10 +187,10 @@ TkpDrawEntryBorderAndFocus( * have to implement it. * * Results: - * 1 if it has drawn the border, 0 if not. + * 1 if it has drawn the buttons, 0 if not. * * Side effects: - * May draw the entry border into pixmap. + * May draw the buttons into pixmap. * *-------------------------------------------------------------- */ @@ -258,9 +259,9 @@ TkpDrawSpinboxButtons( */ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d); - rects[0].x = bounds.origin.x; + rects[0].x = Tk_Width(tkwin) - incDecWidth - 1; rects[0].y = 0; - rects[0].width = Tk_Width(tkwin); + rects[0].width = incDecWidth + 1; rects[0].height = Tk_Height(tkwin); XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1); diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 65b7aee..f62e07c 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -572,7 +572,7 @@ XGrabKeyboard( *---------------------------------------------------------------------- */ -void +int XUngrabKeyboard( Display* display, Time time) @@ -586,6 +586,7 @@ XUngrabKeyboard( keyboardGrabNSWindow = nil; } keyboardGrabWinPtr = NULL; + return Success; } /* diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 5899064..5c30cb3 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -361,7 +361,7 @@ XKeycodeToKeysym( KeyCode keycode, int index) { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; int newKeycode; UniChar newChar; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 790b6ff..4c1ad51 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -628,6 +628,10 @@ TkpConfigureMenuEntry( &imageHeight); image = TkMacOSXGetNSImageWithBitmap(mePtr->menuPtr->display, bitmap, gc, imageWidth, imageHeight); + if (gc->foreground == defaultFg) { + // Use a semantic foreground color by default + [image setTemplate:YES]; + } } [menuItem setImage:image]; if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr && diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 53adb01..2e2838d 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -246,7 +246,7 @@ TkpDestroyMenuButton( void TkpComputeMenuButtonGeometry(butPtr) - register TkMenuButton *butPtr; /* Widget record for menu button. */ + TkMenuButton *butPtr; /* Widget record for menu button. */ { int width, height, avgWidth, haveImage = 0, haveText = 0; int txtWidth, txtHeight; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 60b24f6..9d121b2 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -293,6 +293,8 @@ VISIBILITY_HIDDEN @interface TKApplication(TKWindowEvent) <NSApplicationDelegate> - (void) _setupWindowNotifications; @end +@interface TKApplication(TKDialog) <NSOpenSavePanelDelegate> +@end @interface TKApplication(TKMenu) - (void)tkSetMainMenu:(TKMenu *)menu; @end diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index a189646..66619c2 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -238,9 +238,9 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - register TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = clientData; MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; - register Tk_Window tkwin = scrollPtr->tkwin; + Tk_Window tkwin = scrollPtr->tkwin; TkWindow *winPtr = (TkWindow *) tkwin; TkMacOSXDrawingContext dc; @@ -346,7 +346,7 @@ TkpDisplayScrollbar( extern void TkpComputeScrollbarGeometry( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { @@ -476,7 +476,7 @@ TkpDestroyScrollbar( void TkpConfigureScrollbar( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) { /* empty */ } @@ -501,7 +501,7 @@ TkpConfigureScrollbar( int TkpScrollbarPosition( - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { @@ -511,7 +511,7 @@ TkpScrollbarPosition( */ int length, width, tmp; - register const int inset = scrollPtr->inset; + const int inset = scrollPtr->inset; if (scrollPtr->vertical) { length = Tk_Height(scrollPtr->tkwin); diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index b660917..e851701 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -49,7 +49,7 @@ static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr); *---------------------------------------------------------------------- */ -void +int XDestroyWindow( Display *display, /* Display. */ Window window) /* Window. */ @@ -87,7 +87,7 @@ XDestroyWindow( ckfree(macWin->toplevel); } ckfree(macWin); - return; + return Success; } if (macWin->visRgn) { CFRelease(macWin->visRgn); @@ -111,6 +111,7 @@ XDestroyWindow( if (macWin->toplevel->referenceCount == 0) { ckfree(macWin->toplevel); } + return Success; } /* @@ -130,7 +131,7 @@ XDestroyWindow( *---------------------------------------------------------------------- */ -void +int XMapWindow( Display *display, /* Display. */ Window window) /* Window. */ @@ -226,6 +227,7 @@ XMapWindow( event.xvisibility.type = VisibilityNotify; event.xvisibility.state = VisibilityUnobscured; NotifyVisibility(winPtr, &event); + return Success; } /* @@ -279,7 +281,7 @@ NotifyVisibility( *---------------------------------------------------------------------- */ -void +int XUnmapWindow( Display *display, /* Display. */ Window window) /* Window. */ @@ -332,6 +334,7 @@ XUnmapWindow( } else { [[win contentView] setNeedsDisplay:YES]; } + return Success; } /* @@ -351,7 +354,7 @@ XUnmapWindow( *---------------------------------------------------------------------- */ -void +int XResizeWindow( Display *display, /* Display. */ Window window, /* Window. */ @@ -375,6 +378,7 @@ XResizeWindow( } else { MoveResizeWindow(macWin); } + return Success; } /* @@ -394,7 +398,7 @@ XResizeWindow( *---------------------------------------------------------------------- */ -void +int XMoveResizeWindow( Display *display, /* Display. */ Window window, /* Window. */ @@ -430,6 +434,7 @@ XMoveResizeWindow( } else { MoveResizeWindow(macWin); } + return Success; } /* @@ -448,7 +453,7 @@ XMoveResizeWindow( *---------------------------------------------------------------------- */ -void +int XMoveWindow( Display *display, /* Display. */ Window window, /* Window. */ @@ -467,6 +472,7 @@ XMoveWindow( } else { MoveResizeWindow(macWin); } + return Success; } /* @@ -591,7 +597,7 @@ GenerateConfigureNotify( *---------------------------------------------------------------------- */ -void +int XRaiseWindow( Display *display, /* Display. */ Window window) /* Window. */ @@ -606,6 +612,7 @@ XRaiseWindow( * TODO: this should generate damage */ } + return Success; } #if 0 @@ -661,7 +668,7 @@ XLowerWindow( *---------------------------------------------------------------------- */ -void +int XConfigureWindow( Display *display, /* Display. */ Window w, /* Window. */ @@ -708,6 +715,7 @@ XConfigureWindow( TkGenWMMoveRequestEvent(macWin->winPtr, macWin->winPtr->changes.x, macWin->winPtr->changes.y); #endif + return Success; } /* diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index da1b002..dae6506 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1241,7 +1241,7 @@ WmAspectCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; if ((objc != 3) && (objc != 7)) { @@ -1581,7 +1581,7 @@ WmClientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; int length; @@ -1637,7 +1637,7 @@ WmColormapwindowsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2; int i, windowObjc, gotToplevel = 0; Tcl_Obj **windowObjv, *resultObj; @@ -1726,7 +1726,7 @@ WmCommandCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int len; if ((objc != 3) && (objc != 4)) { @@ -1783,7 +1783,7 @@ WmDeiconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); if (objc != 3) { @@ -1862,7 +1862,7 @@ WmFocusmodelCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "active", "passive", NULL }; enum options { @@ -1916,7 +1916,7 @@ WmForgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window) winPtr; if (Tk_IsTopLevel(frameWin)) { MacDrawable *macWin; @@ -1982,7 +1982,7 @@ WmFrameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; if (objc != 3) { @@ -2022,7 +2022,7 @@ WmGeometryCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); char xSign = '+', ySign = '+'; int width, height, x = wmPtr->x, y= wmPtr->y; @@ -2093,7 +2093,7 @@ WmGridCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; const char *errorMsg; @@ -2187,7 +2187,7 @@ WmGroupCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; char *argv3; int length; @@ -2251,7 +2251,7 @@ WmIconbitmapCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; char *str; int len; @@ -2320,7 +2320,7 @@ WmIconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; @@ -2401,7 +2401,7 @@ WmIconmaskCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; char *argv3; @@ -2461,7 +2461,7 @@ WmIconnameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; @@ -2598,7 +2598,7 @@ WmIconpositionCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; if ((objc != 3) && (objc != 5)) { @@ -2656,7 +2656,7 @@ WmIconwindowCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; @@ -2759,8 +2759,8 @@ WmManageCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + Tk_Window frameWin = (Tk_Window) winPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { MacDrawable *macWin = (MacDrawable *) winPtr->window; @@ -2823,7 +2823,7 @@ WmMaxsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2877,7 +2877,7 @@ WmMinsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2980,7 +2980,7 @@ WmPositionfromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3046,8 +3046,8 @@ WmProtocolCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; - register ProtocolHandler *protPtr, *prevPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + ProtocolHandler *protPtr, *prevPtr; Atom protocol; char *cmd; int cmdLength; @@ -3147,7 +3147,7 @@ WmResizableCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; @@ -3226,7 +3226,7 @@ WmSizefromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3418,7 +3418,7 @@ WmStateCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "normal", "iconic", "withdrawn", "zoomed", NULL }; enum options { @@ -3538,7 +3538,7 @@ WmTitleCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; int length; @@ -3586,7 +3586,7 @@ WmTransientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window master; TkWindow *masterPtr, *w; WmInfo *wmPtr2; @@ -3766,7 +3766,7 @@ WmWithdrawCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -5912,6 +5912,7 @@ WmWinAppearance( #else NSString *appearance; #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 + const char *resultString = "unrecognized"; NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); if (win) { @@ -5930,7 +5931,8 @@ WmWinAppearance( result = Tcl_NewStringObj(resultString, strlen(resultString)); } if (result == NULL) { - Tcl_Panic("Failed to read appearance name."); + NSLog(@"Failed to read appearance name; try calling update before setting the appearance of the window."); + return TCL_OK; } if (objc == 4) { int index; @@ -6518,7 +6520,7 @@ TkpGetMS(void) *---------------------------------------------------------------------- */ -void +int XSetInputFocus( Display* display, Window focus, @@ -6528,6 +6530,7 @@ XSetInputFocus( /* * Don't need to do a thing. Tk manages the focus for us. */ + return Success; } /* diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 3cd70a7..016b334 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -435,7 +435,7 @@ XGetGeometry( return 1; } -void +int XChangeProperty( Display* display, Window w, @@ -447,15 +447,17 @@ XChangeProperty( int nelements) { Debugger(); + return Success; } -void +int XSelectInput( Display* display, Window w, long event_mask) { Debugger(); + return Success; } int @@ -514,11 +516,12 @@ XSendEvent( return 0; } -void +int XClearWindow( Display* display, Window w) { + return Success; } /* @@ -530,6 +533,7 @@ XDrawPoint( int x, int y) { + return Success; } int @@ -541,6 +545,7 @@ XDrawPoints( int npoints, int mode) { + return Success; } */ @@ -559,7 +564,7 @@ XWarpPointer( return Success; } -void +int XQueryColor( Display* display, Colormap colormap, @@ -578,9 +583,10 @@ XQueryColor( d->blue = (b << 8) | b; d->flags = DoRed|DoGreen|DoBlue; d->pad = 0; + return Success; } -void +int XQueryColors( Display* display, Colormap colormap, @@ -603,6 +609,7 @@ XQueryColors( d->flags = DoRed|DoGreen|DoBlue; d->pad = 0; } + return Success; } int @@ -641,15 +648,16 @@ XGetWindowProperty( return 0; } -void +int XRefreshKeyboardMapping( XMappingEvent *x) { /* used by tkXEvent.c */ Debugger(); + return Success; } -void +int XSetIconName( Display* display, Window w, @@ -659,9 +667,10 @@ XSetIconName( * This is a no-op, no icon name for Macs. */ display->request++; + return Success; } -void +int XForceScreenSaver( Display* display, int mode) @@ -673,6 +682,7 @@ XForceScreenSaver( */ display->request++; + return Success; } int @@ -768,62 +778,69 @@ TkGetServerInfo( *---------------------------------------------------------------------- */ -void +int XChangeWindowAttributes( Display *display, Window w, unsigned long value_mask, XSetWindowAttributes *attributes) { + return Success; } -void +int XSetWindowBackground( Display *display, Window window, unsigned long value) { + return Success; } -void +int XSetWindowBackgroundPixmap( Display *display, Window w, Pixmap background_pixmap) { + return Success; } -void +int XSetWindowBorder( Display *display, Window w, unsigned long border_pixel) { + return Success; } -void +int XSetWindowBorderPixmap( Display *display, Window w, Pixmap border_pixmap) { + return Success; } -void +int XSetWindowBorderWidth( Display *display, Window w, unsigned int width) { + return Success; } -void +int XSetWindowColormap( Display *display, Window w, Colormap colormap) { Debugger(); + return Success; } Status @@ -846,7 +863,7 @@ XSetWMClientMachine( } XIC -XCreateIC(void) +XCreateIC(XIM xim, ...) { Debugger(); return (XIC) 0; diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 27f6005..ca9d294 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -105,6 +105,10 @@ static CGFloat darkSelectedGradient[8] = { 23.0 / 255, 111.0 / 255, 232.0 / 255, 1.0, 20.0 / 255, 94.0 / 255, 206.0 / 255, 1.0 }; +static CGFloat pressedPushButtonGradient[8] = { + 35.0 / 255, 123.0 / 255, 244.0 / 255, 1.0, + 30.0 / 255, 114.0 / 255, 235.0 / 255, 1.0 +}; /* * When building on systems earlier than 10.8 there is no reasonable way to @@ -152,6 +156,7 @@ static inline CGRect BoxToRect( */ static Ttk_StateTable ThemeStateTable[] = { + {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, {kThemeStateUnavailable, TTK_STATE_DISABLED, 0}, {kThemeStatePressed, TTK_STATE_PRESSED, 0}, {kThemeStateInactive, TTK_STATE_BACKGROUND, 0}, @@ -647,6 +652,11 @@ static void DrawDarkButton( bounds = CGRectInset(bounds, 1, 1); if (kind == kThemePushButton && (state & TTK_STATE_PRESSED)) { GradientFillRoundedRectangle(context, bounds, 4, + pressedPushButtonGradient, 2); + } else if (kind == kThemePushButton && + (state & TTK_STATE_ALTERNATE) && + !(state & TTK_STATE_BACKGROUND)) { + GradientFillRoundedRectangle(context, bounds, 4, darkSelectedGradient, 2); } else { if (state & TTK_STATE_DISABLED) { @@ -1198,6 +1208,7 @@ static ThemeButtonParams ListHeaderParams = {kThemeListHeaderButton, kThemeMetricListHeaderHeight}; static Ttk_StateTable ButtonValueTable[] = { + {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, {kThemeButtonMixed, TTK_STATE_ALTERNATE, 0}, {kThemeButtonOn, TTK_STATE_SELECTED, 0}, {kThemeButtonOff, 0, 0} @@ -1209,11 +1220,11 @@ static Ttk_StateTable ButtonValueTable[] = { }; static Ttk_StateTable ButtonAdornmentTable[] = { + {kThemeAdornmentNone, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeAdornmentDefault | kThemeAdornmentFocus, TTK_STATE_ALTERNATE | TTK_STATE_FOCUS, 0}, - {kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0}, - {kThemeAdornmentNone, TTK_STATE_ALTERNATE, 0}, {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0}, + {kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0}, {kThemeAdornmentNone, 0, 0} }; @@ -1372,6 +1383,11 @@ static void ButtonElementDraw( ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } + } else if (info.kind == kThemePushButton && + (state & TTK_STATE_PRESSED)) { + bounds.size.height += 2; + GradientFillRoundedRectangle(dc.context, bounds, 4, + pressedPushButtonGradient, 2); } else { /* diff --git a/tests/bind.test b/tests/bind.test index ebc39b7..607c25a 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -22,7 +22,7 @@ foreach event [bind Test] { bind Test $event {} } foreach event [bind all] { - bind all $event {} + bind all $event {} } proc unsetBindings {} { @@ -355,11 +355,11 @@ test bind-9.2 {Tk_DeleteBinding procedure} -setup { } -body { frame .t.f -class Test -width 150 -height 100 foreach i {a b c d} { - bind .t.f $i "binding for $i" + bind .t.f $i "binding for $i" } foreach i {b d a c} { - bind .t.f $i {} - lappend result [lsort [bind .t.f]] + bind .t.f $i {} + lappend result [lsort [bind .t.f]] } return $result } -cleanup { @@ -370,11 +370,11 @@ test bind-9.3 {Tk_DeleteBinding procedure} -setup { } -body { frame .t.f -class Test -width 150 -height 100 foreach i {<1> <Meta-1> <Control-1> <Double-Alt-1>} { - bind .t.f $i "binding for $i" + bind .t.f $i "binding for $i" } foreach i {<Control-1> <Double-Alt-1> <1> <Meta-1>} { - bind .t.f $i {} - lappend result [lsort [bind .t.f]] + bind .t.f $i {} + lappend result [lsort [bind .t.f]] } return $result } -cleanup { @@ -398,7 +398,7 @@ test bind-10.2 {Tk_GetBinding procedure} -body { test bind-11.1 {Tk_GetAllBindings procedure} -body { frame .t.f foreach i "! a \\\{ ~ <Delete> <space> <<Paste>> <Tab> <Linefeed> <less> <Meta-a> <Acircumflex>" { - bind .t.f $i Test + bind .t.f $i Test } lsort [bind .t.f] } -cleanup { @@ -407,7 +407,7 @@ test bind-11.1 {Tk_GetAllBindings procedure} -body { test bind-11.2 {Tk_GetAllBindings procedure} -body { frame .t.f foreach i "<Double-1> <Triple-1> <Meta-Control-a> <Double-Alt-Enter> <1>" { - bind .t.f $i Test + bind .t.f $i Test } lsort [bind .t.f] } -cleanup { @@ -416,7 +416,7 @@ test bind-11.2 {Tk_GetAllBindings procedure} -body { test bind-11.3 {Tk_GetAllBindings procedure} -body { frame .t.f foreach i "<Double-Triple-1> abcd a<Leave>b" { - bind .t.f $i Test + bind .t.f $i Test } lsort [bind .t.f] } -cleanup { @@ -431,7 +431,7 @@ test bind-12.1 {Tk_DeleteAllBindings procedure} -body { test bind-12.2 {Tk_DeleteAllBindings procedure} -body { frame .t.f -class Test -width 150 -height 100 foreach i "a b c <Meta-1> <Alt-a> <Control-a>" { - bind .t.f $i x + bind .t.f $i x } destroy .t.f } -result {} @@ -948,7 +948,7 @@ test bind-13.33 {Tk_BindEvent procedure: many C bindings cause realloc} -setup { set x {} } -body { bindtags .t.f {a b c d e f g h i j k l m n o p} - foreach p [bindtags .t.f] { + foreach p [bindtags .t.f] { bind $p <1> "lappend x $p" } event generate .t.f <1> @@ -4942,7 +4942,7 @@ test bind-24.3 {FindSequence procedure: virtual allowed} -setup { destroy .t.f } -result {} test bind-24.4 {FindSequence procedure: virtual not allowed} -body { - event add <<Paste>> <<Alive>> + event add <<Paste>> <<Alive>> } -returnCodes error -result {virtual event not allowed in definition of another virtual event} test bind-24.5 {FindSequence procedure, multiple bindings} -setup { frame .t.f -class Test -width 150 -height 100 @@ -5170,310 +5170,310 @@ test bind-25.17 {ParseEventDescription} -body { # Modifier canonicalization tests test bind-25.18 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f {<Control- a>} foo - bind .t.f + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Control-Key-a> test bind-25.19 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Shift-a> foo - bind .t.f + bind .t.f <Shift-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Shift-Key-a> test bind-25.20 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Lock-a> foo - bind .t.f + bind .t.f <Lock-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Lock-Key-a> test bind-25.21 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Meta---a> foo - bind .t.f + bind .t.f <Meta---a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Meta-Key-a> test bind-25.22 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <M-a> foo - bind .t.f + bind .t.f <M-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Meta-Key-a> test bind-25.23 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Alt-a> foo - bind .t.f + bind .t.f <Alt-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Alt-Key-a> test bind-25.24 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <B1-a> foo - bind .t.f + bind .t.f <B1-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B1-Key-a> test bind-25.25 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <B2-a> foo - bind .t.f + bind .t.f <B2-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B2-Key-a> test bind-25.26 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <B3-a> foo - bind .t.f + bind .t.f <B3-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B3-Key-a> test bind-25.27 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <B4-a> foo - bind .t.f + bind .t.f <B4-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B4-Key-a> test bind-25.28 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <B5-a> foo - bind .t.f + bind .t.f <B5-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B5-Key-a> test bind-25.29 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Button1-a> foo - bind .t.f + bind .t.f <Button1-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B1-Key-a> test bind-25.30 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Button2-a> foo - bind .t.f + bind .t.f <Button2-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B2-Key-a> test bind-25.31 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Button3-a> foo - bind .t.f + bind .t.f <Button3-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B3-Key-a> test bind-25.32 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Button4-a> foo - bind .t.f + bind .t.f <Button4-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B4-Key-a> test bind-25.33 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Button5-a> foo - bind .t.f + bind .t.f <Button5-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <B5-Key-a> test bind-25.34 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <M1-a> foo - bind .t.f + bind .t.f <M1-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod1-Key-a> test bind-25.35 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <M2-a> foo - bind .t.f + bind .t.f <M2-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod2-Key-a> test bind-25.36 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <M3-a> foo - bind .t.f + bind .t.f <M3-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod3-Key-a> test bind-25.37 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <M4-a> foo - bind .t.f + bind .t.f <M4-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod4-Key-a> test bind-25.38 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <M5-a> foo - bind .t.f + bind .t.f <M5-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod5-Key-a> test bind-25.39 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Mod1-a> foo - bind .t.f + bind .t.f <Mod1-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod1-Key-a> test bind-25.40 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Mod2-a> foo - bind .t.f + bind .t.f <Mod2-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod2-Key-a> test bind-25.41 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Mod3-a> foo - bind .t.f + bind .t.f <Mod3-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod3-Key-a> test bind-25.42 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Mod4-a> foo - bind .t.f + bind .t.f <Mod4-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod4-Key-a> test bind-25.43 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Mod5-a> foo - bind .t.f + bind .t.f <Mod5-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Mod5-Key-a> test bind-25.44 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Double-a> foo - bind .t.f + bind .t.f <Double-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Double-Key-a> test bind-25.45 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Triple-a> foo - bind .t.f + bind .t.f <Triple-a> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Triple-Key-a> test bind-25.46 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f {<Double 1>} foo - bind .t.f + bind .t.f {<Double 1>} foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Double-Button-1> test bind-25.47 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Triple-1> foo - bind .t.f + bind .t.f <Triple-1> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Triple-Button-1> test bind-25.48 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f {<M1-M2 M3-M4 B1-Control-a>} foo - bind .t.f + bind .t.f {<M1-M2 M3-M4 B1-Control-a>} foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Control-B1-Mod1-Mod2-Mod3-Mod4-Key-a> test bind-25.49 {modifier names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f <Extended-Return> foo - bind .t.f + bind .t.f <Extended-Return> foo + bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <Extended-Key-Return> test bind-26.1 {event names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <FocusIn> {nothing} bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <FocusIn> test bind-26.2 {event names} -setup { - frame .t.f -class Test -width 150 -height 100 + frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <FocusOut> {nothing} bind .t.f } -cleanup { - destroy .t.f + destroy .t.f } -result <FocusOut> test bind-26.3 {event names} -setup { frame .t.f -class Test -width 150 -height 100 @@ -5495,12 +5495,12 @@ test bind-26.4 {event names: Motion} -setup { focus -force .t.f update } -body { - bind .t.f <Motion> "set x {event Motion}" - set x xyzzy - event generate .t.f <Motion> - list $x [bind .t.f] + bind .t.f <Motion> "set x {event Motion}" + set x xyzzy + event generate .t.f <Motion> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Motion} <Motion>} test bind-26.5 {event names: Button} -setup { @@ -5509,12 +5509,12 @@ test bind-26.5 {event names: Button} -setup { focus -force .t.f update } -body { - bind .t.f <Button> "set x {event Button}" - set x xyzzy - event generate .t.f <Button> - list $x [bind .t.f] + bind .t.f <Button> "set x {event Button}" + set x xyzzy + event generate .t.f <Button> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Button} <Button>} test bind-26.6 {event names: ButtonPress} -setup { @@ -5523,12 +5523,12 @@ test bind-26.6 {event names: ButtonPress} -setup { focus -force .t.f update } -body { - bind .t.f <ButtonPress> "set x {event ButtonPress}" - set x xyzzy - event generate .t.f <ButtonPress> - list $x [bind .t.f] + bind .t.f <ButtonPress> "set x {event ButtonPress}" + set x xyzzy + event generate .t.f <ButtonPress> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event ButtonPress} <Button>} test bind-26.7 {event names: ButtonRelease} -setup { @@ -5537,12 +5537,12 @@ test bind-26.7 {event names: ButtonRelease} -setup { focus -force .t.f update } -body { - bind .t.f <ButtonRelease> "set x {event ButtonRelease}" - set x xyzzy - event generate .t.f <ButtonRelease> - list $x [bind .t.f] + bind .t.f <ButtonRelease> "set x {event ButtonRelease}" + set x xyzzy + event generate .t.f <ButtonRelease> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event ButtonRelease} <ButtonRelease>} test bind-26.8 {event names: Colormap} -setup { @@ -5551,12 +5551,12 @@ test bind-26.8 {event names: Colormap} -setup { focus -force .t.f update } -body { - bind .t.f <Colormap> "set x {event Colormap}" - set x xyzzy - event generate .t.f <Colormap> - list $x [bind .t.f] + bind .t.f <Colormap> "set x {event Colormap}" + set x xyzzy + event generate .t.f <Colormap> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Colormap} <Colormap>} test bind-26.9 {event names: Enter} -setup { @@ -5565,12 +5565,12 @@ test bind-26.9 {event names: Enter} -setup { focus -force .t.f update } -body { - bind .t.f <Enter> "set x {event Enter}" - set x xyzzy - event generate .t.f <Enter> - list $x [bind .t.f] + bind .t.f <Enter> "set x {event Enter}" + set x xyzzy + event generate .t.f <Enter> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Enter} <Enter>} test bind-26.10 {event names: Leave} -setup { @@ -5579,12 +5579,12 @@ test bind-26.10 {event names: Leave} -setup { focus -force .t.f update } -body { - bind .t.f <Leave> "set x {event Leave}" - set x xyzzy - event generate .t.f <Leave> - list $x [bind .t.f] + bind .t.f <Leave> "set x {event Leave}" + set x xyzzy + event generate .t.f <Leave> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Leave} <Leave>} test bind-26.11 {event names: Expose} -setup { @@ -5593,12 +5593,12 @@ test bind-26.11 {event names: Expose} -setup { focus -force .t.f update } -body { - bind .t.f <Expose> "set x {event Expose}" - set x xyzzy - event generate .t.f <Expose> - list $x [bind .t.f] + bind .t.f <Expose> "set x {event Expose}" + set x xyzzy + event generate .t.f <Expose> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Expose} <Expose>} test bind-26.12 {event names: Key} -setup { @@ -5607,12 +5607,12 @@ test bind-26.12 {event names: Key} -setup { focus -force .t.f update } -body { - bind .t.f <Key> "set x {event Key}" - set x xyzzy - event generate .t.f <Key> - list $x [bind .t.f] + bind .t.f <Key> "set x {event Key}" + set x xyzzy + event generate .t.f <Key> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Key} <Key>} test bind-26.13 {event names: KeyPress} -setup { @@ -5621,12 +5621,12 @@ test bind-26.13 {event names: KeyPress} -setup { focus -force .t.f update } -body { - bind .t.f <KeyPress> "set x {event KeyPress}" - set x xyzzy - event generate .t.f <KeyPress> - list $x [bind .t.f] + bind .t.f <KeyPress> "set x {event KeyPress}" + set x xyzzy + event generate .t.f <KeyPress> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event KeyPress} <Key>} test bind-26.14 {event names: KeyRelease} -setup { @@ -5635,12 +5635,12 @@ test bind-26.14 {event names: KeyRelease} -setup { focus -force .t.f update } -body { - bind .t.f <KeyRelease> "set x {event KeyRelease}" - set x xyzzy - event generate .t.f <KeyRelease> - list $x [bind .t.f] + bind .t.f <KeyRelease> "set x {event KeyRelease}" + set x xyzzy + event generate .t.f <KeyRelease> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event KeyRelease} <KeyRelease>} test bind-26.15 {event names: Property} -setup { @@ -5649,12 +5649,12 @@ test bind-26.15 {event names: Property} -setup { focus -force .t.f update } -body { - bind .t.f <Property> "set x {event Property}" - set x xyzzy - event generate .t.f <Property> - list $x [bind .t.f] + bind .t.f <Property> "set x {event Property}" + set x xyzzy + event generate .t.f <Property> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Property} <Property>} test bind-26.16 {event names: Visibility} -setup { @@ -5663,12 +5663,12 @@ test bind-26.16 {event names: Visibility} -setup { focus -force .t.f update } -body { - bind .t.f <Visibility> "set x {event Visibility}" - set x xyzzy - event generate .t.f <Visibility> - list $x [bind .t.f] + bind .t.f <Visibility> "set x {event Visibility}" + set x xyzzy + event generate .t.f <Visibility> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Visibility} <Visibility>} test bind-26.17 {event names: Activate} -setup { @@ -5677,12 +5677,12 @@ test bind-26.17 {event names: Activate} -setup { focus -force .t.f update } -body { - bind .t.f <Activate> "set x {event Activate}" - set x xyzzy - event generate .t.f <Activate> - list $x [bind .t.f] + bind .t.f <Activate> "set x {event Activate}" + set x xyzzy + event generate .t.f <Activate> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Activate} <Activate>} test bind-26.18 {event names: Deactivate} -setup { @@ -5691,12 +5691,12 @@ test bind-26.18 {event names: Deactivate} -setup { focus -force .t.f update } -body { - bind .t.f <Deactivate> "set x {event Deactivate}" - set x xyzzy - event generate .t.f <Deactivate> - list $x [bind .t.f] + bind .t.f <Deactivate> "set x {event Deactivate}" + set x xyzzy + event generate .t.f <Deactivate> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Deactivate} <Deactivate>} @@ -5707,12 +5707,12 @@ test bind-26.19 {event names: Circulate} -setup { focus -force .t.f update } -body { - bind .t.f <Circulate> "set x {event Circulate}" - set x xyzzy - event generate .t.f <Circulate> - list $x [bind .t.f] + bind .t.f <Circulate> "set x {event Circulate}" + set x xyzzy + event generate .t.f <Circulate> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Circulate} <Circulate>} test bind-26.20 {event names: Configure} -setup { @@ -5721,12 +5721,12 @@ test bind-26.20 {event names: Configure} -setup { focus -force .t.f update } -body { - bind .t.f <Configure> "set x {event Configure}" - set x xyzzy - event generate .t.f <Configure> - list $x [bind .t.f] + bind .t.f <Configure> "set x {event Configure}" + set x xyzzy + event generate .t.f <Configure> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Configure} <Configure>} test bind-26.21 {event names: Gravity} -setup { @@ -5735,12 +5735,12 @@ test bind-26.21 {event names: Gravity} -setup { focus -force .t.f update } -body { - bind .t.f <Gravity> "set x {event Gravity}" - set x xyzzy - event generate .t.f <Gravity> - list $x [bind .t.f] + bind .t.f <Gravity> "set x {event Gravity}" + set x xyzzy + event generate .t.f <Gravity> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Gravity} <Gravity>} test bind-26.22 {event names: Map} -setup { @@ -5749,12 +5749,12 @@ test bind-26.22 {event names: Map} -setup { focus -force .t.f update } -body { - bind .t.f <Map> "set x {event Map}" - set x xyzzy - event generate .t.f <Map> - list $x [bind .t.f] + bind .t.f <Map> "set x {event Map}" + set x xyzzy + event generate .t.f <Map> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Map} <Map>} test bind-26.23 {event names: Reparent} -setup { @@ -5763,12 +5763,12 @@ test bind-26.23 {event names: Reparent} -setup { focus -force .t.f update } -body { - bind .t.f <Reparent> "set x {event Reparent}" - set x xyzzy - event generate .t.f <Reparent> - list $x [bind .t.f] + bind .t.f <Reparent> "set x {event Reparent}" + set x xyzzy + event generate .t.f <Reparent> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Reparent} <Reparent>} test bind-26.24 {event names: Unmap} -setup { @@ -5777,12 +5777,12 @@ test bind-26.24 {event names: Unmap} -setup { focus -force .t.f update } -body { - bind .t.f <Unmap> "set x {event Unmap}" - set x xyzzy - event generate .t.f <Unmap> - list $x [bind .t.f] + bind .t.f <Unmap> "set x {event Unmap}" + set x xyzzy + event generate .t.f <Unmap> + list $x [bind .t.f] } -cleanup { - destroy .t.f + destroy .t.f } -result {{event Unmap} <Unmap>} @@ -6200,6 +6200,7 @@ test bind-32 {-warp, window was destroyed before the idle callback DoWarp} -setu cleanupTests return +# vi:set ts=4 sw=4 et: # Local Variables: # mode: tcl # End: diff --git a/tests/imgSVGnano.test b/tests/imgSVGnano.test index a7470df..ff7046a 100644 --- a/tests/imgSVGnano.test +++ b/tests/imgSVGnano.test @@ -27,6 +27,12 @@ namespace eval svgnano { "> </svg>} + tcltest::makeFile $data(plus) plus.svg + set data(plusFilePath) [file join [tcltest::configure -tmpdir] plus.svg] + + tcltest::makeFile $data(bad) bad.svg + set data(badFilePath) [file join [tcltest::configure -tmpdir] bad.svg] + test imgSVGnano-1.1 {reading simple image} -setup { catch {rename foo ""} } -body { @@ -61,17 +67,42 @@ test imgSVGnano-1.4 {image options} -setup { } -body { image create photo foo -data $data(plus) foo configure -format {svg -scale 2} - foo configure -format {svg -unit pt} - foo configure -format {svg -unit mm} - foo configure -format {svg -unit cm} - foo configure -format {svg -unit in} - foo configure -format {svg -unit px} foo configure -format {svg -dpi 600} list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {100 100} +test imgSVGnano-1.5 {reading simple image from file} -setup { + catch {rename foo ""} +} -body { + image create photo foo -file $data(plusFilePath) + list [image width foo] [image height foo] +} -cleanup { + rename foo "" +} -result {100 100} +test imgSVGnano-1.6 {simple image with options} -setup { + catch {rename foo ""} +} -body { + image create photo foo -file $data(plusFilePath) -format {svg -dpi 100 -scale 3} + list [image width foo] [image height foo] +} -cleanup { + rename foo "" +} -result {300 300} +test imgSVGnano-1.7 {Very small scale gives 1x1 image} -body { + image create photo foo -format "svg -scale 0.000001"\ + -data $data(plus) + list [image width foo] [image height foo] +} -cleanup { + rename foo "" +} -result {1 1} +test imgSVGnano-1.8 {Very small scale gives 1x1 image from file} -body { + image create photo foo -format "svg -scale 0.000001"\ + -file $data(plusFilePath) + list [image width foo] [image height foo] +} -cleanup { + rename foo "" +} -result {1 1} test imgSVGnano-2.1 {reading a bad image} -body { image create photo foo -format svg -data $data(bad) @@ -84,7 +115,97 @@ test imgSVGnano-2.3 {using bad option} -body { foo configure -format {svg 1.0} } -cleanup { rename foo "" -} -returnCodes error -result {bad option "1.0": must be -dpi, -scale, or -unit} +} -returnCodes error -result {bad option "1.0": must be -dpi, -scale, -scaletoheight, or -scaletowidth} +test imgSVGnano-2.4 {reading a bad image from file} -body { + image create photo foo -format svg -file $data(badFilePath) +} -returnCodes error -match glob\ + -result {couldn't recognize data in image file "*/bad.svg"} + +# -scaletoheight and -scaletowidth options +test imgSVGnano-3.1 {multiple scale options} -body { + image create photo foo -format "svg -scale 1 -scaletowidth 20"\ + -data $data(bad) +} -returnCodes error -result {only one of -scale, -scaletoheight, -scaletowidth may be given} + +test imgSVGnano-3.2 {no number parameter to -scaletowidth} -body { + image create photo foo -format "svg -scaletowidth invalid"\ + -data $data(plus) +} -returnCodes error -result {expected integer but got "invalid"} + +test imgSVGnano-3.3 {no number parameter to -scaletoheight} -body { + image create photo foo -format "svg -scaletoheight invalid"\ + -data $data(plus) +} -returnCodes error -result {expected integer but got "invalid"} + +test imgSVGnano-3.4 {zero parameter to -scaletowidth} -body { + image create photo foo -format "svg -scaletowidth 0"\ + -data $data(plus) +} -returnCodes error -result {-scaletowidth value must be positive} + +test imgSVGnano-3.5 {zero parameter to -scaletoheight} -body { + image create photo foo -format "svg -scaletoheight 0"\ + -data $data(plus) +} -returnCodes error -result {-scaletoheight value must be positive} + +test imgSVGnano-3.6 {no number parameter to -scaletoheight} -body { + image create photo foo -format "svg -scaletoheight invalid"\ + -data $data(plus) +} -returnCodes error -result {expected integer but got "invalid"} + +test imgSVGnano-3.7 {Option -scaletowidth} -body { + image create photo foo -format "svg -scaletowidth 20"\ + -data $data(plus) + image width foo +} -cleanup { + rename foo "" +} -result {20} + +test imgSVGnano-3.8 {Option -scaletoheight} -body { + image create photo foo -format "svg -scaletoheight 20"\ + -data $data(plus) + image height foo +} -cleanup { + rename foo "" +} -result {20} + +test imgSVGnano-3.10 {change from -scaletoheight to -scale} -body { + set res {} + image create photo foo -format "svg -scaletoheight 16"\ + -data $data(plus) + lappend res [image width foo] [image height foo] + foo configure -format "svg -scale 2" + lappend res [image width foo] [image height foo] +} -cleanup { + rename foo "" + unset res +} -result {16 16 200 200} + +# svg file access +test imgSVGnano-4.1 {reread file on configure -scale} -setup { + catch {rename foo ""} + set res {} +} -body { + image create photo foo -file $data(plusFilePath) + lappend res [image width foo] [image height foo] + foo configure -format "svg -scale 2" + lappend res [image width foo] [image height foo] +} -cleanup { + rename foo "" + unset res +} -result {100 100 200 200} + + +test imgSVGnano-4.2 {error on file not accessible on reread due to configure} -setup { + catch {rename foo ""} + tcltest::makeFile $data(plus) tmpplus.svg + image create photo foo -file [file join [tcltest::configure -tmpdir] tmpplus.svg] + tcltest::removeFile tmpplus.svg +} -body { + foo configure -format "svg -scale 2" +} -cleanup { + rename foo "" + tcltest::removeFile tmpplus.svg +} -returnCodes error -match glob -result {couldn't open "*/tmpplus.svg": no such file or directory} };# end of namespace svgnano diff --git a/tests/textDisp.test b/tests/textDisp.test index 698f8a7..1b6f4c5 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -1867,10 +1867,10 @@ test textDisp-14.9 {TkTextXviewCmd procedure} { } [list [expr {9.0/14}] 1.0] test textDisp-14.10 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a} msg] $msg -} {1 {wrong # args: should be ".t xview scroll number mouseunits|pages|pixels|units"}} +} {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}} test textDisp-14.11 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a b c} msg] $msg -} {1 {wrong # args: should be ".t xview scroll number mouseunits|pages|pixels|units"}} +} {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}} test textDisp-14.12 {TkTextXviewCmd procedure} { list [catch {.t xview scroll gorp units} msg] $msg } {1 {expected integer but got "gorp"}} @@ -1904,7 +1904,7 @@ test textDisp-14.14 {TkTextXviewCmd procedure} { } {2.21 2.20 2.99 2.84} test textDisp-14.15 {TkTextXviewCmd procedure} { list [catch {.t xview scroll 14 globs} msg] $msg -} {1 {bad argument "globs": must be mouseunits, pages, pixels, or units}} +} {1 {bad argument "globs": must be pages, pixels, or units}} test textDisp-14.16 {TkTextXviewCmd procedure} { list [catch {.t xview flounder} msg] $msg } {1 {bad option "flounder": must be moveto or scroll}} @@ -2086,13 +2086,13 @@ test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} {textfonts} { } [list [expr {1.0/3}] [expr {5.0/6}]] test textDisp-16.19 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll a} msg] $msg -} {1 {wrong # args: should be ".t yview scroll number mouseunits|pages|pixels|units"}} +} {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}} test textDisp-16.20 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll a b c} msg] $msg -} {1 {wrong # args: should be ".t yview scroll number mouseunits|pages|pixels|units"}} +} {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}} test textDisp-16.21 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll badInt bogus} msg] $msg -} {1 {bad argument "bogus": must be mouseunits, pages, pixels, or units}} +} {1 {bad argument "bogus": must be pages, pixels, or units}} test textDisp-16.21.2 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll badInt units} msg] $msg } {1 {expected integer but got "badInt"}} @@ -2104,7 +2104,7 @@ test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} { } {42.0} test textDisp-16.22.1 {TkTextYviewCmd procedure, "scroll" option, back pages} { list [catch {.t yview scroll -3 p} res] $res -} {1 {ambiguous argument "p": must be mouseunits, pages, pixels, or units}} +} {1 {ambiguous argument "p": must be pages, pixels, or units}} test textDisp-16.23 {TkTextYviewCmd procedure, "scroll" option, back pages} { .t yview 50.0 update @@ -2175,7 +2175,7 @@ test textDisp-16.31 {TkTextYviewCmd procedure, "scroll units" option} { } {151.40} test textDisp-16.32 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 12 bogoids} msg] $msg -} {1 {bad argument "bogoids": must be mouseunits, pages, pixels, or units}} +} {1 {bad argument "bogoids": must be pages, pixels, or units}} test textDisp-16.33 {TkTextYviewCmd procedure} { list [catch {.t yview bad_arg 1 2} msg] $msg } {1 {bad option "bad_arg": must be moveto or scroll}} diff --git a/tests/textIndex.test b/tests/textIndex.test index 3f26af5..310db6a 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -803,6 +803,14 @@ test textIndex-19.12 {Display lines} { .t index "2.40 -1displaylines" } {2.20} +test textIndex-19.12.1 {Display lines} { + .t index "2.50 - 100 displaylines" +} {1.0} + +test textIndex-19.12.2 {Display lines} { + .t compare [.t index "2.50 + 100 displaylines"] == "end - 1 c" +} {1} + test textIndex-19.13 {Display lines} { destroy {*}[pack slaves .] text .txt -height 1 -wrap word -yscroll ".sbar set" -width 400 diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 975fca8..24ac8cc 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -396,7 +396,7 @@ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; @@ -860,7 +860,7 @@ TkpDisplayButton( void TkpComputeButtonGeometry( - register TkButton *butPtr) /* Button whose geometry may have changed. */ + TkButton *butPtr) /* Button whose geometry may have changed. */ { int width, height, avgWidth, txtWidth, txtHeight; int haveImage = 0, haveText = 0; diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 8afb92d..4c58adf 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.c @@ -245,7 +245,7 @@ TkGetCursorByName( if ((argv[0][0] != '@') && !inTkTable) { XColor fg, bg; unsigned int maskIndex; - register const struct CursorName *namePtr; + const struct CursorName *namePtr; TkDisplay *dispPtr; /* diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 8605934..908deeb 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -2584,7 +2584,7 @@ CanUseFallback( memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fixSubFontPtrPtr != NULL) { - register SubFont *fixSubFontPtr = *fixSubFontPtrPtr; + SubFont *fixSubFontPtr = *fixSubFontPtrPtr; if (fixSubFontPtr != &fontPtr->controlSubFont) { *fixSubFontPtrPtr = diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 296523c..0d3d255 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -199,7 +199,7 @@ TkpDestroyMenuEntry( int TkpConfigureMenuEntry( - register TkMenuEntry *mePtr)/* Information about menu entry; may or may + TkMenuEntry *mePtr)/* Information about menu entry; may or may * not already have values for some fields. */ { /* diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index c49f15b..eb0af47 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -58,14 +58,14 @@ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization needed only to stop compiler * warning. */ int y = 0; - register Tk_Window tkwin = mbPtr->tkwin; + Tk_Window tkwin = mbPtr->tkwin; int fullWidth, fullHeight; int textXOffset, textYOffset; int imageWidth, imageHeight; diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index d26b139..ca5183d 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -256,7 +256,7 @@ DisplayVerticalScale( static void DisplayVerticalValue( - register TkScale *scalePtr, /* Information about widget in which to + TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ @@ -267,7 +267,7 @@ DisplayVerticalValue( * specified in pixels. */ const char *format) /* Format string to use for the value */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int y, width, length; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; @@ -325,7 +325,7 @@ DisplayHorizontalScale( * to reflect the part of the window that was * redrawn. */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int x, y, width, height, shadowWidth; double tickInterval = scalePtr->tickInterval; Tk_3DBorder sliderBorder; @@ -479,7 +479,7 @@ DisplayHorizontalScale( static void DisplayHorizontalValue( - register TkScale *scalePtr, /* Information about widget in which to + TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ @@ -490,7 +490,7 @@ DisplayHorizontalValue( * in pixels. */ const char *format) /* Format string to use for the value */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int x, y, length, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index d3e4436..c51aa18 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -97,8 +97,8 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - register TkScrollbar *scrollPtr = clientData; - register Tk_Window tkwin = scrollPtr->tkwin; + TkScrollbar *scrollPtr = clientData; + Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; int relief, width, elementBorderWidth; @@ -277,7 +277,7 @@ TkpDisplayScrollbar( extern void TkpComputeScrollbarGeometry( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { @@ -394,7 +394,7 @@ TkpDestroyScrollbar( void TkpConfigureScrollbar( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Information about widget; may or may not * already have values for some fields. */ { @@ -437,12 +437,12 @@ TkpConfigureScrollbar( int TkpScrollbarPosition( - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { int length, width, tmp; - register const int inset = scrollPtr->inset; + const int inset = scrollPtr->inset; if (scrollPtr->vertical) { length = Tk_Height(scrollPtr->tkwin); diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index b3fe49d..b6e980e 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -240,10 +240,10 @@ TkSelGetSelection( void TkSelPropProc( - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { - register IncrInfo *incrPtr; - register TkSelHandler *selPtr; + IncrInfo *incrPtr; + TkSelHandler *selPtr; int length, numItems; unsigned long i; Atom target, formatType; @@ -519,10 +519,10 @@ TkSelPropProc( void TkSelEventProc( Tk_Window tkwin, /* Window for which event was targeted. */ - register XEvent *eventPtr) /* X event: either SelectionClear, + XEvent *eventPtr) /* X event: either SelectionClear, * SelectionRequest, or SelectionNotify. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; Tcl_Interp *interp; @@ -540,7 +540,7 @@ TkSelEventProc( */ if (eventPtr->type == SelectionNotify) { - register TkSelRetrievalInfo *retrPtr; + TkSelRetrievalInfo *retrPtr; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; @@ -742,7 +742,7 @@ static void SelTimeoutProc( ClientData clientData) /* Information about retrieval in progress. */ { - register TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = clientData; /* * Make sure that the retrieval is still in progress. Then see how long @@ -796,7 +796,7 @@ ConvertSelection( * request; may not be selection's current * owner, be we set it to the current * owner. */ - register XSelectionRequestEvent *eventPtr) + XSelectionRequestEvent *eventPtr) /* Event describing request. */ { union { @@ -898,7 +898,7 @@ ConvertSelection( for (i = 0; i < incr.numConversions; i++) { Atom target, property, type; long buffer[TK_SEL_WORDS_AT_ONCE]; - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int numItems, format; char *propPtr; @@ -1124,9 +1124,9 @@ ConvertSelection( static void SelRcvIncrProc( ClientData clientData, /* Information about retrieval. */ - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { - register TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = clientData; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; @@ -1374,7 +1374,7 @@ IncrTimeoutProc( * retrieval for which we are selection * owner. */ { - register IncrInfo *incrPtr = clientData; + IncrInfo *incrPtr = clientData; incrPtr->idleTime++; if (incrPtr->idleTime >= 5) { @@ -1487,7 +1487,7 @@ SelCvtToX( static void SelCvtFromX32( - register long *propPtr, /* Property value from X. */ + long *propPtr, /* Property value from X. */ int numValues, /* Number of 32-bit values in property. */ Atom type, /* Type of property Should not be XA_STRING * (if so, don't bother calling this function @@ -1520,7 +1520,7 @@ SelCvtFromX32( static void SelCvtFromX8( - register char *propPtr, /* Property value from X. */ + char *propPtr, /* Property value from X. */ int numValues, /* Number of 8-bit values in property. */ Atom type, /* Type of property Should not be XA_STRING * (if so, don't bother calling this function diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 7f3e31f..4a24a89 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -958,7 +958,7 @@ Tk_SendObjCmd( TkWindow *winPtr; Window commWindow; PendingCommand pending; - register RegisteredInterp *riPtr; + RegisteredInterp *riPtr; const char *destName; int result, index, async, i, firstArg; Tk_RestrictProc *prevProc; @@ -1781,7 +1781,7 @@ AppendErrorProc( XErrorEvent *errorPtr) /* Information about error. */ { PendingCommand *pendingPtr = clientData; - register PendingCommand *pcPtr; + PendingCommand *pcPtr; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -1830,7 +1830,7 @@ DeleteProc( * ClientData. */ { RegisteredInterp *riPtr = clientData; - register RegisteredInterp *riPtr2; + RegisteredInterp *riPtr2; NameRegistry *regPtr; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -1878,7 +1878,7 @@ DeleteProc( static Tk_RestrictAction SendRestrictProc( ClientData clientData, /* Not used. */ - register XEvent *eventPtr) /* Event that just arrived. */ + XEvent *eventPtr) /* Event that just arrived. */ { TkDisplay *dispPtr; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 2edc809..1cf0402 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -564,7 +564,7 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - register WmInfo *wmPtr; + WmInfo *wmPtr; TkDisplay *dispPtr = winPtr->dispPtr; wmPtr = ckalloc(sizeof(WmInfo)); @@ -659,7 +659,7 @@ TkWmMapWindow( TkWindow *winPtr) /* Top-level window that's about to be * mapped. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; XTextProperty textProp; if (wmPtr->flags & WM_NEVER_MAPPED) { @@ -827,7 +827,7 @@ void TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; WmInfo *wmPtr2; if (wmPtr == NULL) { @@ -836,7 +836,7 @@ TkWmDeadWindow( if ((WmInfo *) winPtr->dispPtr->firstWmPtr == wmPtr) { winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr; } else { - register WmInfo *prevPtr; + WmInfo *prevPtr; for (prevPtr = (WmInfo *) winPtr->dispPtr->firstWmPtr; ; prevPtr = prevPtr->nextPtr) { @@ -1188,7 +1188,7 @@ WmAspectCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; if ((objc != 3) && (objc != 7)) { @@ -1455,7 +1455,7 @@ WmClientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if ((objc != 3) && (objc != 4)) { @@ -1540,7 +1540,7 @@ WmColormapwindowsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Window *cmapList; TkWindow *winPtr2; int count, i, windowObjc, gotToplevel; @@ -1641,7 +1641,7 @@ WmCommandCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int cmdArgc; const char **cmdArgv; @@ -1710,7 +1710,7 @@ WmDeiconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1760,7 +1760,7 @@ WmFocusmodelCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "active", "passive", NULL }; enum options { @@ -1815,7 +1815,7 @@ WmForgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window) winPtr; if (Tk_IsTopLevel(frameWin)) { TkFocusJoin(winPtr); @@ -1868,7 +1868,7 @@ WmFrameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; if (objc != 3) { @@ -1908,7 +1908,7 @@ WmGeometryCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; int width, height; const char *argv3; @@ -1968,7 +1968,7 @@ WmGridCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; if ((objc != 3) && (objc != 7)) { @@ -2067,7 +2067,7 @@ WmGroupCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; const char *argv3; @@ -2142,7 +2142,7 @@ WmIconbitmapCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -2202,7 +2202,7 @@ WmIconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -2271,7 +2271,7 @@ WmIconmaskCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -2330,7 +2330,7 @@ WmIconnameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if (objc > 4) { @@ -2381,7 +2381,7 @@ WmIconphotoCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_PhotoHandle photo; Tk_PhotoImageBlock block; int i, size = 0, width, height, index = 0, x, y, isDefault = 0; @@ -2470,9 +2470,9 @@ WmIconphotoCmd( iconPropertyData[index++] = (unsigned long) height; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { - register unsigned char *pixelPtr = + unsigned char *pixelPtr = block.pixelPtr + x*block.pixelSize + y*block.pitch; - register unsigned long R, G, B, A; + unsigned long R, G, B, A; R = pixelPtr[block.offset[0]]; G = pixelPtr[block.offset[1]]; @@ -2527,7 +2527,7 @@ WmIconpositionCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; if ((objc != 3) && (objc != 5)) { @@ -2584,7 +2584,7 @@ WmIconwindowCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; XSetWindowAttributes atts; @@ -2704,8 +2704,8 @@ WmManageCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + Tk_Window frameWin = (Tk_Window) winPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -2766,7 +2766,7 @@ WmMaxsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2825,7 +2825,7 @@ WmMinsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2934,7 +2934,7 @@ WmPositionfromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3001,8 +3001,8 @@ WmProtocolCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; - register ProtocolHandler *protPtr, *prevPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; TkSizeT cmdLength; @@ -3111,7 +3111,7 @@ WmResizableCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -3170,7 +3170,7 @@ WmSizefromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3360,7 +3360,7 @@ WmStateCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "normal", "iconic", "withdrawn", NULL }; enum options { @@ -3466,7 +3466,7 @@ WmTitleCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if (objc > 4) { @@ -3519,7 +3519,7 @@ WmTransientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *masterPtr = wmPtr->masterPtr, *w; WmInfo *wmPtr2; @@ -3668,7 +3668,7 @@ WmWithdrawCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3768,7 +3768,7 @@ Tk_SetGrid( * of one grid unit. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Ensure widthInc and heightInc are greater than 0 @@ -3873,7 +3873,7 @@ Tk_UnsetGrid( * controlling gridding. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Find the top-level window for tkwin, plus the window manager @@ -4556,8 +4556,8 @@ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { - register TkWindow *winPtr = clientData; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + TkWindow *winPtr = clientData; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; unsigned long serial; @@ -4818,7 +4818,7 @@ UpdateSizeHints( int newWidth, int newHeight) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; XSizeHints *hintsPtr; int maxWidth, maxHeight; @@ -5564,10 +5564,10 @@ ParseGeometry( TkWindow *winPtr) /* Pointer to top-level window whose geometry * is to be changed. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, flags; char *end; - register const char *p = string; + const char *p = string; /* * The leading "=" is optional. @@ -5700,7 +5700,7 @@ Tk_GetRootCoords( int *yPtr) /* Where to store y-displacement of (0,0). */ { int x, y; - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * Search back through this window's parents all the way to a top-level @@ -6167,7 +6167,7 @@ Tk_MoveToplevelWindow( int x, int y) /* New location for window (within parent). */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window"); @@ -6215,9 +6215,9 @@ Tk_MoveToplevelWindow( static void UpdateWmProtocols( - register WmInfo *wmPtr) /* Information about top-level window. */ + WmInfo *wmPtr) /* Information about top-level window. */ { - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom deleteWindowAtom, pingAtom; int count; Atom *arrayPtr, *atomPtr; @@ -6276,7 +6276,7 @@ TkWmProtocolEventProc( XEvent *eventPtr) /* X event. */ { WmInfo *wmPtr; - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom protocol; int result; const char *protocolName; @@ -7280,7 +7280,7 @@ TkWindow * TkpGetWrapperWindow( TkWindow *winPtr) /* A toplevel window pointer. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if ((winPtr == NULL) || (wmPtr == NULL)) { return NULL; @@ -7310,7 +7310,7 @@ static void UpdateCommand( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tcl_DString cmds, ds; int i, *offsets; char **cmdArgv; diff --git a/win/Makefile.in b/win/Makefile.in index f857b7c..03705c5 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -101,6 +101,17 @@ TCL_PLATFORM_DIR = @TCL_SRC_DIR@/win TCL_TOOL_DIR = @TCL_SRC_DIR@/tools +SRC_DIR = @srcdir@ +ROOT_DIR = @srcdir@/.. +TOP_DIR = $(shell cd @srcdir@/..; pwd -W 2>/dev/null || pwd -P) +WIN_DIR = $(TOP_DIR)/win +UNIX_DIR = $(TOP_DIR)/unix +GENERIC_DIR = $(TOP_DIR)/generic +TTK_DIR = $(GENERIC_DIR)/ttk +BITMAP_DIR = $(TOP_DIR)/bitmaps +XLIB_DIR = $(TOP_DIR)/xlib +RC_DIR = $(WIN_DIR)/rc + # Converts a POSIX path to a Windows native path. CYGPATH = @CYGPATH@ @@ -108,16 +119,6 @@ CYGPATH = @CYGPATH@ TCL_LIB_FILE = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_LIB_FILE@')" TCL_STUB_LIB_FILE = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_STUB_LIB_FILE@')" -SRC_DIR = @srcdir@ -ROOT_DIR = $(SRC_DIR)/.. -WIN_DIR = $(SRC_DIR) -UNIX_DIR = $(SRC_DIR)/../unix -GENERIC_DIR = $(SRC_DIR)/../generic -TTK_DIR = $(GENERIC_DIR)/ttk -BITMAP_DIR = $(ROOT_DIR)/bitmaps -XLIB_DIR = $(ROOT_DIR)/xlib -RC_DIR = $(WIN_DIR)/rc - ROOT_DIR_NATIVE = $(shell $(CYGPATH) '$(ROOT_DIR)' | sed 's!\\!/!g') WIN_DIR_NATIVE = $(shell $(CYGPATH) '$(WIN_DIR)' | sed 's!\\!/!g') GENERIC_DIR_NATIVE = $(shell $(CYGPATH) '$(GENERIC_DIR)' | sed 's!\\!/!g') diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 52b6e2a..48f9109 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -316,14 +316,14 @@ TkpDisplayButton( { TkWinDCState state; HDC dc; - register TkButton *butPtr = clientData; + TkButton *butPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization only needed to stop compiler * warning. */ int y, relief; - register Tk_Window tkwin = butPtr->tkwin; + Tk_Window tkwin = butPtr->tkwin; int width = 0, height = 0, haveImage = 0, haveText = 0, drawRing = 0; RECT rect; int defaultWidth; /* Width of default ring. */ @@ -818,7 +818,7 @@ TkpDisplayButton( void TkpComputeButtonGeometry( - register TkButton *butPtr) /* Button whose geometry may have changed. */ + TkButton *butPtr) /* Button whose geometry may have changed. */ { int txtWidth, txtHeight; /* Width and height of text */ int imgWidth, imgHeight; /* Width and height of image */ diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 06200d4..0097d1b 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -424,7 +424,7 @@ UpdateClipboard( void TkSelEventProc( Tk_Window tkwin, /* Window for which event was targeted. */ - register XEvent *eventPtr) /* X event: either SelectionClear, + XEvent *eventPtr) /* X event: either SelectionClear, * SelectionRequest, or SelectionNotify. */ { if (eventPtr->type == SelectionClear) { @@ -451,7 +451,7 @@ TkSelEventProc( void TkSelPropProc( - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { } diff --git a/win/tkWinColor.c b/win/tkWinColor.c index 5540d9a..1f2bfa1 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -274,7 +274,7 @@ int TkWinIndexOfColor( XColor *colorPtr) { - register WinColor *winColPtr = (WinColor *) colorPtr; + WinColor *winColPtr = (WinColor *) colorPtr; if (winColPtr->info.magic == COLOR_MAGIC) { return winColPtr->index; } diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 62c33ce..948ca10 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -2177,7 +2177,7 @@ FontMapInsert( * None. * * Side effects: - * Mempry allocated. + * Memory allocated. * *------------------------------------------------------------------------- */ diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 329c0af..5c82a8f 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -2579,7 +2579,7 @@ DrawTearoffEntry( int TkpConfigureMenuEntry( - register TkMenuEntry *mePtr)/* Information about menu entry; may or may + TkMenuEntry *mePtr)/* Information about menu entry; may or may * not already have values for some fields. */ { ScheduleMenuReconfigure(mePtr->menuPtr); diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 74cac15..254f44e 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -64,7 +64,6 @@ typedef _TCHAR TCHAR; #endif -#include <unistd.h> #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 1edb1d8..f511a2c 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -383,7 +383,7 @@ UpdateScrollbarMetrics(void) void TkpComputeScrollbarGeometry( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { @@ -591,7 +591,7 @@ ScrollbarProc( void TkpConfigureScrollbar( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Information about widget; may or may not * already have values for some fields. */ { @@ -650,7 +650,7 @@ ModalLoop( int TkpScrollbarPosition( - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c index 9e5b7a0..b47e08d 100644 --- a/win/tkWinSendCom.c +++ b/win/tkWinSendCom.c @@ -427,7 +427,7 @@ Send( HRESULT hr = S_OK; int result = TCL_OK; VARIANT v; - register Tcl_Interp *interp = obj->interp; + Tcl_Interp *interp = obj->interp; Tcl_Obj *scriptPtr; Tcl_DString ds; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index e41e68d..a48ae74 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -1774,7 +1774,7 @@ SetLimits( HWND hwnd, MINMAXINFO *info) { - register WmInfo *wmPtr; + WmInfo *wmPtr; int maxWidth, maxHeight; int minWidth, minHeight; int base; @@ -1910,7 +1910,7 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - register WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); + WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); /* * Initialize full structure, then set what isn't NULL @@ -1995,7 +1995,7 @@ static void UpdateWrapper( TkWindow *winPtr) /* Top-level window to redecorate. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; HWND parentHWND, oldWrapper = wmPtr->wrapper; HWND child, nextHWND, focusHWND; int x, y, width, height, state; @@ -2359,7 +2359,7 @@ TkWmMapWindow( TkWindow *winPtr) /* Top-level window that's about to be * mapped. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -2585,7 +2585,7 @@ void TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; WmInfo *wmPtr2; if (wmPtr == NULL) { @@ -2599,7 +2599,7 @@ TkWmDeadWindow( if (winPtr->dispPtr->firstWmPtr == wmPtr) { winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr; } else { - register WmInfo *prevPtr; + WmInfo *prevPtr; for (prevPtr = winPtr->dispPtr->firstWmPtr; ; prevPtr = prevPtr->nextPtr) { @@ -2955,7 +2955,7 @@ WmAspectCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; if ((objc != 3) && (objc != 7)) { @@ -3025,7 +3025,7 @@ WmAttributesCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr = NULL; const char *string; int i, boolean; @@ -3321,7 +3321,7 @@ WmClientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; @@ -3391,7 +3391,7 @@ WmColormapwindowsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2, **winPtr2Ptr = &winPtr2; int i, windowObjc, gotToplevel; Tcl_Obj **windowObjv, *resultObj; @@ -3485,7 +3485,7 @@ WmCommandCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int cmdArgc; const char **cmdArgv; @@ -3554,7 +3554,7 @@ WmDeiconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3606,7 +3606,7 @@ WmFocusmodelCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "active", "passive", NULL }; @@ -3662,7 +3662,7 @@ WmForgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window) winPtr; if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); @@ -3710,7 +3710,7 @@ WmFrameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; if (objc != 3) { @@ -3753,7 +3753,7 @@ WmGeometryCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; int width, height; const char *argv3; @@ -3821,7 +3821,7 @@ WmGridCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; if ((objc != 3) && (objc != 7)) { @@ -3919,7 +3919,7 @@ WmGroupCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; const char *argv3; TkSizeT length; @@ -3982,7 +3982,7 @@ WmIconbitmapCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ const char *string; @@ -4118,7 +4118,7 @@ WmIconifyCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; @@ -4183,7 +4183,7 @@ WmIconmaskCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -4241,7 +4241,7 @@ WmIconnameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; @@ -4485,7 +4485,7 @@ WmIconpositionCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; if ((objc != 3) && (objc != 5)) { @@ -4541,7 +4541,7 @@ WmIconwindowCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; XSetWindowAttributes atts; @@ -4651,8 +4651,8 @@ WmManageCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + Tk_Window frameWin = (Tk_Window) winPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -4705,7 +4705,7 @@ WmMaxsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -4756,7 +4756,7 @@ WmMinsizeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -4807,7 +4807,7 @@ WmOverrideredirectCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; XSetWindowAttributes atts; @@ -4879,7 +4879,7 @@ WmPositionfromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; @@ -4947,8 +4947,8 @@ WmProtocolCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; - register ProtocolHandler *protPtr, *prevPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; TkSizeT cmdLength; @@ -5043,7 +5043,7 @@ WmResizableCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -5105,7 +5105,7 @@ WmSizefromCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; @@ -5302,7 +5302,7 @@ WmStateCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "normal", "iconic", "withdrawn", "zoomed", NULL }; @@ -5442,7 +5442,7 @@ WmTitleCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; HWND wrapper; @@ -5517,7 +5517,7 @@ WmTransientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr, *w; WmInfo *wmPtr2; @@ -5645,7 +5645,7 @@ WmWithdrawCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -5757,7 +5757,7 @@ Tk_SetGrid( * of one grid unit. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Ensure widthInc and heightInc are greater than 0 @@ -5854,7 +5854,7 @@ Tk_UnsetGrid( * controlling gridding. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Find the top-level window for tkwin, plus the window manager @@ -5913,7 +5913,7 @@ TopLevelEventProc( ClientData clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { - register TkWindow *winPtr = clientData; + TkWindow *winPtr = clientData; if (eventPtr->type == DestroyNotify) { Tk_ErrorHandler handler; @@ -6004,8 +6004,8 @@ UpdateGeometryInfo( int width, height; /* Size of client area. */ int min, max; RECT rect; - register TkWindow *winPtr = clientData; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + TkWindow *winPtr = clientData; + WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags &= ~WM_UPDATE_PENDING; @@ -6285,10 +6285,10 @@ ParseGeometry( TkWindow *winPtr) /* Pointer to top-level window whose geometry * is to be changed. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, flags; char *end; - register const char *p = string; + const char *p = string; /* * The leading "=" is optional. @@ -6417,7 +6417,7 @@ Tk_GetRootCoords( int *xPtr, /* Where to store x-displacement of (0,0). */ int *yPtr) /* Where to store y-displacement of (0,0). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * If the window is mapped, let Windows figure out the translation. @@ -6546,7 +6546,7 @@ Tk_MoveToplevelWindow( int x, int y) /* New location for window (within parent). */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window"); @@ -6597,7 +6597,7 @@ TkWmProtocolEventProc( XEvent *eventPtr) /* X event. */ { WmInfo *wmPtr; - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom protocol; int result; Tcl_Interp *interp; @@ -8352,7 +8352,7 @@ void TkWinSetForegroundWindow( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (wmPtr->wrapper != NULL) { SetForegroundWindow(wmPtr->wrapper); @@ -8382,7 +8382,7 @@ void TkpWinToplevelWithDraw( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags |= WM_WITHDRAWN; TkpWmSetState(winPtr, WithdrawnState); @@ -8433,7 +8433,7 @@ void TkpWinToplevelDeiconify( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags &= ~WM_WITHDRAWN; @@ -8501,7 +8501,7 @@ long TkpWinToplevelIsControlledByWm( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!wmPtr) { return 0; @@ -8531,7 +8531,7 @@ TkpWinToplevelMove( TkWindow *winPtr, int x, int y) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (wmPtr && x >= 0 && y >= 0 && !TkpWinToplevelIsControlledByWm(winPtr)) { Tk_MoveToplevelWindow((Tk_Window) winPtr, x, y); @@ -8563,7 +8563,7 @@ TkpWinToplevelOverrideRedirect( int reqValue) { int curValue; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; if (reqValue < 0) { @@ -8610,7 +8610,7 @@ void TkpWinToplevelDetachWindow( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (winPtr->flags & TK_EMBEDDED) { int state = SendMessage(wmPtr->wrapper, TK_STATE, -1, -1) - 1; |