diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-22 14:16:42 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-22 14:16:42 (GMT) |
commit | e1486d48b18bdd738d42c22f61f597b17ea02fc4 (patch) | |
tree | f1ee74148eb7e6b073d776877344a0a9342ced75 /generic | |
parent | 4424dff3092a2ea0574195815aca62fd5c751b08 (diff) | |
parent | 3c4e724f033bf187c86fe8b49e53abe44671ee47 (diff) | |
download | tk-e1486d48b18bdd738d42c22f61f597b17ea02fc4.zip tk-e1486d48b18bdd738d42c22f61f597b17ea02fc4.tar.gz tk-e1486d48b18bdd738d42c22f61f597b17ea02fc4.tar.bz2 |
Merge trunk.
Eliminate use of "mouseunits", was not a good idea. Move code out of UpdateButtonEventState() function.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.h | 5 | ||||
-rw-r--r-- | generic/tkCanvas.c | 6 | ||||
-rw-r--r-- | generic/tkEntry.c | 24 | ||||
-rw-r--r-- | generic/tkEvent.c | 39 | ||||
-rw-r--r-- | generic/tkImgSVGnano.c | 173 | ||||
-rw-r--r-- | generic/tkInt.decls | 64 | ||||
-rw-r--r-- | generic/tkInt.h | 5 | ||||
-rw-r--r-- | generic/tkIntXlibDecls.h | 128 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 20 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 19 | ||||
-rw-r--r-- | generic/tkTextTag.c | 4 | ||||
-rw-r--r-- | generic/tkUtil.c | 11 | ||||
-rw-r--r-- | generic/ttk/ttkTreeview.c | 2 |
13 files changed, 307 insertions, 193 deletions
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 |