From 0ee713439182546f0e884ac2db7f83101456d56e Mon Sep 17 00:00:00 2001 From: das Date: Sun, 29 Apr 2007 02:24:01 +0000 Subject: * generic/tkCanvas.c: allow -selectforeground option to be None; add * generic/tkCanvText.c: fallback to fgColor when selFgColor is None * generic/tkEntry.c: (new default on aqua to match native L&F). * generic/tkListbox.c: * generic/tkText.c: * generic/tkCanvas.c: add support for bypassing all of Tk's double * generic/tkEntry.c: buffered drawing into intermediate pixmaps * generic/tkFrame.c: (via TK_NO_DOUBLE_BUFFERING #define), it is * generic/tkListbox.c: unnecessary & wasteful on aqua where all * generic/tkPanedWindow.c: drawing is already double-buffered by the * generic/tkTextDisp.c: window server. (Use of this on other * unix/tkUnixScale.c: platforms would only require implementation of TkpClipDrawableToRect()). --- generic/tkCanvText.c | 6 ++-- generic/tkCanvas.c | 33 +++++++++++++----- generic/tkEntry.c | 16 ++++++--- generic/tkFrame.c | 8 ++++- generic/tkListbox.c | 20 ++++++++--- generic/tkPanedWindow.c | 14 +++++++- generic/tkText.c | 6 ++-- generic/tkTextDisp.c | 89 ++++++++++++++++++++++++++++++++++--------------- unix/tkUnixScale.c | 8 ++++- 9 files changed, 149 insertions(+), 51 deletions(-) diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index d2c1bf8..e9652ec 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.2 2005/08/11 12:17:09 dkf Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.3 2007/04/29 02:24:01 das Exp $ */ #include @@ -466,7 +466,9 @@ ConfigureText(interp, canvas, itemPtr, objc, objv, flags) gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; } - gcValues.foreground = textInfoPtr->selFgColorPtr->pixel; + if (textInfoPtr->selFgColorPtr != NULL) { + gcValues.foreground = textInfoPtr->selFgColorPtr->pixel; + } newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues); } if (textPtr->gc != None) { diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 9c29edb..9d4dd05 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvas.c,v 1.21.2.3 2005/08/11 12:17:09 dkf Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.21.2.4 2007/04/29 02:24:01 das Exp $ */ /* #define USE_OLD_TAG_SEARCH 1 */ @@ -21,6 +21,11 @@ #include "tkInt.h" #include "tkPort.h" #include "tkCanvas.h" +#ifdef TK_NO_DOUBLE_BUFFERING +#ifdef MAC_OSX_TK +#include "tkMacOSXInt.h" +#endif +#endif /* TK_NO_DOUBLE_BUFFERING */ /* * See tkCanvas.h for key data structures used to implement canvases. @@ -174,10 +179,10 @@ static Tk_ConfigSpec configSpecs[] = { TK_CONFIG_MONO_ONLY}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_CANVAS_SELECT_FG_COLOR, Tk_Offset(TkCanvas, textInfo.selFgColorPtr), - TK_CONFIG_COLOR_ONLY}, + TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_CANVAS_SELECT_FG_MONO, Tk_Offset(TkCanvas, textInfo.selFgColorPtr), - TK_CONFIG_MONO_ONLY}, + TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK}, {TK_CONFIG_CUSTOM, "-state", "state", "State", "normal", Tk_Offset(TkCanvas, canvas_state), TK_CONFIG_DONT_SET_DEFAULT, &stateOption}, @@ -2280,6 +2285,10 @@ DisplayCanvas(clientData) goto borders; } + width = screenX2 - screenX1; + height = screenY2 - screenY1; + +#ifndef TK_NO_DOUBLE_BUFFERING /* * Redrawing is done in a temporary pixmap that is allocated * here and freed at the end of the procedure. All drawing @@ -2318,14 +2327,19 @@ DisplayCanvas(clientData) (screenX2 + 30 - canvasPtr->drawableXOrigin), (screenY2 + 30 - canvasPtr->drawableYOrigin), Tk_Depth(tkwin)); +#else + canvasPtr->drawableXOrigin = canvasPtr->xOrigin; + canvasPtr->drawableYOrigin = canvasPtr->yOrigin; + pixmap = Tk_WindowId(tkwin); + TkpClipDrawableToRect(Tk_Display(tkwin), pixmap, + screenX1 - canvasPtr->xOrigin, screenY1 - canvasPtr->yOrigin, + width, height); +#endif /* TK_NO_DOUBLE_BUFFERING */ /* * Clear the area to be redrawn. */ - width = screenX2 - screenX1; - height = screenY2 - screenY1; - XFillRectangle(Tk_Display(tkwin), pixmap, canvasPtr->pixmapGC, screenX1 - canvasPtr->drawableXOrigin, screenY1 - canvasPtr->drawableYOrigin, (unsigned int) width, @@ -2363,6 +2377,7 @@ DisplayCanvas(clientData) height); } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Copy from the temporary pixmap to the screen, then free up * the temporary pixmap. @@ -2372,10 +2387,12 @@ DisplayCanvas(clientData) canvasPtr->pixmapGC, screenX1 - canvasPtr->drawableXOrigin, screenY1 - canvasPtr->drawableYOrigin, - (unsigned) (screenX2 - screenX1), - (unsigned) (screenY2 - screenY1), + (unsigned int) width, (unsigned int) height, screenX1 - canvasPtr->xOrigin, screenY1 - canvasPtr->yOrigin); Tk_FreePixmap(Tk_Display(tkwin), pixmap); +#else + TkpClipDrawableToRect(Tk_Display(tkwin), pixmap, 0, 0, -1, -1); +#endif /* TK_NO_DOUBLE_BUFFERING */ } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 60cbdcf..1a92e3a 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.35.2.3 2006/09/10 17:07:35 das Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.35.2.4 2007/04/29 02:24:02 das Exp $ */ #include "tkInt.h" @@ -144,7 +144,7 @@ static Tk_OptionSpec entryOptSpec[] = { 0, (ClientData) DEF_ENTRY_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr), - 0, (ClientData) DEF_ENTRY_SELECT_FG_MONO, 0}, + TK_CONFIG_NULL_OK, (ClientData) DEF_ENTRY_SELECT_FG_MONO, 0}, {TK_OPTION_STRING, "-show", "show", "Show", DEF_ENTRY_SHOW, -1, Tk_Offset(Entry, showChar), TK_OPTION_NULL_OK, 0, 0}, @@ -302,7 +302,7 @@ static Tk_OptionSpec sbOptSpec[] = { 0, (ClientData) DEF_ENTRY_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr), - 0, (ClientData) DEF_ENTRY_SELECT_FG_MONO, 0}, + TK_CONFIG_NULL_OK, (ClientData) DEF_ENTRY_SELECT_FG_MONO, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state), 0, (ClientData) stateStrings, 0}, @@ -1497,7 +1497,9 @@ EntryWorldChanged(instanceData) } entryPtr->textGC = gc; - gcValues.foreground = entryPtr->selFgColorPtr->pixel; + if (entryPtr->selFgColorPtr != NULL) { + gcValues.foreground = entryPtr->selFgColorPtr->pixel; + } gcValues.font = Tk_FontId(entryPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); @@ -1635,6 +1637,7 @@ DisplayEntry(clientData) Tcl_Release((ClientData) entryPtr); } +#ifndef TK_NO_DOUBLE_BUFFERING /* * In order to avoid screen flashes, this procedure redraws the * textual area of the entry into off-screen memory, then copies @@ -1644,6 +1647,9 @@ DisplayEntry(clientData) pixmap = Tk_GetPixmap(entryPtr->display, Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin)); +#else + pixmap = Tk_WindowId(tkwin); +#endif /* TK_NO_DOUBLE_BUFFERING */ /* * Compute x-coordinate of the pixel just after last visible @@ -1875,6 +1881,7 @@ DisplayEntry(clientData) } } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Everything's been redisplayed; now copy the pixmap onto the screen * and free up the pixmap. @@ -1884,6 +1891,7 @@ DisplayEntry(clientData) 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); Tk_FreePixmap(entryPtr->display, pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ entryPtr->flags &= ~BORDER_NEEDED; } diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 5636917..0410b2a 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFrame.c,v 1.15.2.3 2005/08/11 12:17:09 dkf Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.15.2.4 2007/04/29 02:24:02 das Exp $ */ #include "default.h" @@ -1446,6 +1446,7 @@ DisplayFrame(clientData) goto noLabel; } +#ifndef TK_NO_DOUBLE_BUFFERING /* * In order to avoid screen flashes, this procedure redraws the * frame into off-screen memory, then copies it back on-screen @@ -1455,6 +1456,9 @@ DisplayFrame(clientData) pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin)); +#else + pixmap = Tk_WindowId(tkwin); +#endif /* TK_NO_DOUBLE_BUFFERING */ /* * Clear the pixmap. @@ -1573,6 +1577,7 @@ DisplayFrame(clientData) } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Everything's been redisplayed; now copy the pixmap onto the screen * and free up the pixmap. @@ -1584,6 +1589,7 @@ DisplayFrame(clientData) (unsigned) (Tk_Height(tkwin) - 2 * hlWidth), hlWidth, hlWidth); Tk_FreePixmap(framePtr->display, pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ } } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 040438c..d7ce449 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkListbox.c,v 1.29.2.4 2006/12/04 20:13:00 hobbs Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.29.2.5 2007/04/29 02:24:02 das Exp $ */ #include "tkPort.h" @@ -278,7 +278,7 @@ static Tk_OptionSpec optionSpecs[] = { Tk_Offset(Listbox, selBorderWidth), 0, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_LISTBOX_SELECT_FG_COLOR, -1, Tk_Offset(Listbox, selFgColorPtr), - 0, (ClientData) DEF_LISTBOX_SELECT_FG_MONO, 0}, + TK_CONFIG_NULL_OK, (ClientData) DEF_LISTBOX_SELECT_FG_MONO, 0}, {TK_OPTION_STRING, "-selectmode", "selectMode", "SelectMode", DEF_LISTBOX_SELECT_MODE, -1, Tk_Offset(Listbox, selectMode), TK_OPTION_NULL_OK, 0, 0}, @@ -1779,7 +1779,9 @@ ListboxWorldChanged(instanceData) } listPtr->textGC = gc; - gcValues.foreground = listPtr->selFgColorPtr->pixel; + if (listPtr->selFgColorPtr != NULL) { + gcValues.foreground = listPtr->selFgColorPtr->pixel; + } gcValues.font = Tk_FontId(listPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(listPtr->tkwin, mask, &gcValues); @@ -1865,6 +1867,7 @@ DisplayListbox(clientData) listPtr->flags &= ~(REDRAW_PENDING|UPDATE_V_SCROLLBAR|UPDATE_H_SCROLLBAR); Tcl_Release((ClientData) listPtr); +#ifndef TK_NO_DOUBLE_BUFFERING /* * Redrawing is done in a temporary pixmap that is allocated * here and freed at the end of the procedure. All drawing is @@ -1875,6 +1878,9 @@ DisplayListbox(clientData) pixmap = Tk_GetPixmap(listPtr->display, Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin)); +#else + pixmap = Tk_WindowId(tkwin); +#endif /* TK_NO_DOUBLE_BUFFERING */ Tk_Fill3DRectangle(tkwin, pixmap, listPtr->normalBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); @@ -1922,7 +1928,11 @@ DisplayListbox(clientData) if (entry != NULL) { attrs = (ItemAttr *)Tcl_GetHashValue(entry); /* Default GC has the values from the widget at large */ - gcValues.foreground = listPtr->selFgColorPtr->pixel; + if (listPtr->selFgColorPtr) { + gcValues.foreground = listPtr->selFgColorPtr->pixel; + } else { + gcValues.foreground = listPtr->fgColorPtr->pixel; + } gcValues.font = Tk_FontId(listPtr->tkfont); gcValues.graphics_exposures = False; mask = GCForeground | GCFont | GCGraphicsExposures; @@ -2122,10 +2132,12 @@ DisplayListbox(clientData) listPtr->highlightWidth, pixmap); } } +#ifndef TK_NO_DOUBLE_BUFFERING XCopyArea(listPtr->display, pixmap, Tk_WindowId(tkwin), listPtr->textGC, 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); Tk_FreePixmap(listPtr->display, pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ } /* diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index d97872f..289d649 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPanedWindow.c,v 1.13.2.10 2006/10/17 05:38:47 dgp Exp $ + * RCS: @(#) $Id: tkPanedWindow.c,v 1.13.2.11 2007/04/29 02:24:02 das Exp $ */ #include "tkPort.h" @@ -1381,12 +1381,16 @@ DisplayPanedWindow(clientData) ArrangePanes(clientData); } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Create a pixmap for double-buffering, if necessary. */ pixmap = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin)); +#else + pixmap = Tk_WindowId(tkwin); +#endif /* TK_NO_DOUBLE_BUFFERING */ /* * Redraw the widget's background and border. @@ -1426,6 +1430,7 @@ DisplayPanedWindow(clientData) } } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Copy the information from the off-screen pixmap onto the screen, * then delete the pixmap. @@ -1435,6 +1440,7 @@ DisplayPanedWindow(clientData) 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); Tk_FreePixmap(Tk_Display(tkwin), pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ } /* @@ -2606,12 +2612,16 @@ DisplayProxyWindow(clientData) return; } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Create a pixmap for double-buffering, if necessary. */ pixmap = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin)); +#else + pixmap = Tk_WindowId(tkwin); +#endif /* TK_NO_DOUBLE_BUFFERING */ /* * Redraw the widget's background and border. @@ -2619,6 +2629,7 @@ DisplayProxyWindow(clientData) Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 2, pwPtr->sashRelief); +#ifndef TK_NO_DOUBLE_BUFFERING /* * Copy the pixmap to the display. */ @@ -2626,6 +2637,7 @@ DisplayProxyWindow(clientData) 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); Tk_FreePixmap(Tk_Display(tkwin), pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ } /* diff --git a/generic/tkText.c b/generic/tkText.c index 0c0f44f..b1be4ab 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.33.2.5 2006/10/17 05:38:48 dgp Exp $ + * RCS: @(#) $Id: tkText.c,v 1.33.2.6 2007/04/29 02:24:02 das Exp $ */ #include "default.h" @@ -113,10 +113,10 @@ static Tk_ConfigSpec configSpecs[] = { TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_TEXT_SELECT_FG_COLOR, Tk_Offset(TkText, selFgColorPtr), - TK_CONFIG_COLOR_ONLY}, + TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_TEXT_SELECT_FG_MONO, Tk_Offset(TkText, selFgColorPtr), - TK_CONFIG_MONO_ONLY}, + TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK}, {TK_CONFIG_BOOLEAN, "-setgrid", "setGrid", "SetGrid", DEF_TEXT_SET_GRID, Tk_Offset(TkText, setGrid), 0}, {TK_CONFIG_PIXELS, "-spacing1", "spacing1", "Spacing", diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index ab0a8cf..48897bd 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextDisp.c,v 1.14.2.4 2006/09/10 17:07:35 das Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.14.2.5 2007/04/29 02:24:02 das Exp $ */ #include "tkPort.h" @@ -22,6 +22,12 @@ #include "tkWinInt.h" #endif +#ifdef TK_NO_DOUBLE_BUFFERING +#ifdef MAC_OSX_TK +#include "tkMacOSXInt.h" +#endif +#endif /* TK_NO_DOUBLE_BUFFERING */ + /* * The following structure describes how to display a range of characters. * The information is generated by scanning all of the tags associated @@ -1686,16 +1692,32 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) TextDInfo *dInfoPtr = textPtr->dInfoPtr; Display *display; int height, x; +#ifndef TK_NO_DOUBLE_BUFFERING + const int y = 0; +#else + const int y = dlPtr->y; +#endif /* TK_NO_DOUBLE_BUFFERING */ if (dlPtr->chunkPtr == NULL) return; + display = Tk_Display(textPtr->tkwin); + + height = dlPtr->height; + if ((height + dlPtr->y) > dInfoPtr->maxY) { + height = dInfoPtr->maxY - dlPtr->y; + } + +#ifdef TK_NO_DOUBLE_BUFFERING + TkpClipDrawableToRect(display, pixmap, dInfoPtr->x, y, + dInfoPtr->maxX - dInfoPtr->x, height); +#endif /* TK_NO_DOUBLE_BUFFERING */ + /* * First, clear the area of the line to the background color for the * text widget. */ - display = Tk_Display(textPtr->tkwin); - Tk_Fill3DRectangle(textPtr->tkwin, pixmap, textPtr->border, 0, 0, + Tk_Fill3DRectangle(textPtr->tkwin, pixmap, textPtr->border, 0, y, Tk_Width(textPtr->tkwin), dlPtr->height, 0, TK_RELIEF_FLAT); /* @@ -1717,7 +1739,7 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) chunkPtr = chunkPtr->nextPtr) { x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curPixelOffset; if (chunkPtr->displayProc == TkTextInsertDisplayProc) { - (*chunkPtr->displayProc)(chunkPtr, x, dlPtr->spaceAbove, + (*chunkPtr->displayProc)(chunkPtr, x, y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, display, pixmap, dlPtr->y + dlPtr->spaceAbove); @@ -1757,7 +1779,7 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) if (chunkPtr->displayProc != NULL) (*chunkPtr->displayProc)(chunkPtr, -chunkPtr->width, - dlPtr->spaceAbove, + y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, display, pixmap, dlPtr->y + dlPtr->spaceAbove); @@ -1765,7 +1787,7 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) /* don't call if elide. This tax ok since not very many visible DLine's in an area, but potentially many elide ones */ if (chunkPtr->displayProc != NULL) - (*chunkPtr->displayProc)(chunkPtr, x, dlPtr->spaceAbove, + (*chunkPtr->displayProc)(chunkPtr, x, y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, display, pixmap, dlPtr->y + dlPtr->spaceAbove); @@ -1775,6 +1797,7 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) } } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Copy the pixmap onto the screen. If this is the last line on * the screen then copy a piece of the line, so that it doesn't @@ -1784,13 +1807,12 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap) * to get as much of the cursor as possible. */ - height = dlPtr->height; - if ((height + dlPtr->y) > dInfoPtr->maxY) { - height = dInfoPtr->maxY - dlPtr->y; - } XCopyArea(display, pixmap, Tk_WindowId(textPtr->tkwin), dInfoPtr->copyGC, - dInfoPtr->x, 0, (unsigned) (dInfoPtr->maxX - dInfoPtr->x), + dInfoPtr->x, y, (unsigned) (dInfoPtr->maxX - dInfoPtr->x), (unsigned) height, dInfoPtr->x, dlPtr->y); +#else + TkpClipDrawableToRect(display, pixmap, 0, 0, -1, -1); +#endif /* TK_NO_DOUBLE_BUFFERING */ linesRedrawn++; } @@ -1852,7 +1874,11 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) int minX, maxX, xOffset; StyleValues *sValuePtr; Display *display; - +#ifndef TK_NO_DOUBLE_BUFFERING + const int y = 0; +#else + const int y = dlPtr->y; +#endif /* TK_NO_DOUBLE_BUFFERING */ /* * Pass 1: scan through dlPtr from left to right. For each range of @@ -1916,15 +1942,15 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) } XFillRectangle(display, pixmap, chunkPtr->stylePtr->bgGC, - leftX + xOffset, 0, (unsigned int) (rightX - leftX), + leftX + xOffset, y, (unsigned int) (rightX - leftX), (unsigned int) dlPtr->height); if (sValuePtr->relief != TK_RELIEF_FLAT) { Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border, - leftX + xOffset, 0, sValuePtr->borderWidth, + leftX + xOffset, y, sValuePtr->borderWidth, dlPtr->height, 1, sValuePtr->relief); Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border, rightX - sValuePtr->borderWidth + xOffset, - 0, sValuePtr->borderWidth, dlPtr->height, 0, + y, sValuePtr->borderWidth, dlPtr->height, 0, sValuePtr->relief); } } @@ -1984,7 +2010,7 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) chunkPtr->nextPtr->stylePtr)) { if (!matchLeft && (sValuePtr->relief != TK_RELIEF_FLAT)) { Tk_3DHorizontalBevel(textPtr->tkwin, pixmap, - sValuePtr->border, leftX + xOffset, 0, + sValuePtr->border, leftX + xOffset, y, rightX - leftX, sValuePtr->borderWidth, leftXIn, 1, 1, sValuePtr->relief); } @@ -2025,7 +2051,7 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) if (matchLeft && !matchRight) { if (sValuePtr->relief != TK_RELIEF_FLAT) { Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border, - rightX2 - sValuePtr->borderWidth + xOffset, 0, + rightX2 - sValuePtr->borderWidth + xOffset, y, sValuePtr->borderWidth, sValuePtr->borderWidth, 0, sValuePtr->relief); } @@ -2034,11 +2060,11 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) } else if (!matchLeft && matchRight && (sValuePtr->relief != TK_RELIEF_FLAT)) { Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border, - rightX2 + xOffset, 0, sValuePtr->borderWidth, + rightX2 + xOffset, y, sValuePtr->borderWidth, sValuePtr->borderWidth, 1, sValuePtr->relief); Tk_3DHorizontalBevel(textPtr->tkwin, pixmap, sValuePtr->border, - leftX + xOffset, 0, rightX2 + sValuePtr->borderWidth -leftX, - sValuePtr->borderWidth, leftXIn, 0, 1, + leftX + xOffset, y, rightX2 + sValuePtr->borderWidth - + leftX, sValuePtr->borderWidth, leftXIn, 0, 1, sValuePtr->relief); } @@ -2101,7 +2127,7 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) if (!matchLeft && (sValuePtr->relief != TK_RELIEF_FLAT)) { Tk_3DHorizontalBevel(textPtr->tkwin, pixmap, sValuePtr->border, leftX + xOffset, - dlPtr->height - sValuePtr->borderWidth, + y + dlPtr->height - sValuePtr->borderWidth, rightX - leftX, sValuePtr->borderWidth, leftXIn, 0, 0, sValuePtr->relief); } @@ -2128,7 +2154,7 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) if (sValuePtr->relief != TK_RELIEF_FLAT) { Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border, rightX2 - sValuePtr->borderWidth + xOffset, - dlPtr->height - sValuePtr->borderWidth, + y + dlPtr->height - sValuePtr->borderWidth, sValuePtr->borderWidth, sValuePtr->borderWidth, 0, sValuePtr->relief); } @@ -2137,13 +2163,14 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap) } else if (!matchLeft && matchRight && (sValuePtr->relief != TK_RELIEF_FLAT)) { Tk_3DVerticalBevel(textPtr->tkwin, pixmap, sValuePtr->border, - rightX2 + xOffset, dlPtr->height - sValuePtr->borderWidth, + rightX2 + xOffset, y + dlPtr->height - sValuePtr->borderWidth, sValuePtr->borderWidth, - 1, sValuePtr->relief); + sValuePtr->borderWidth, 1, sValuePtr->relief); Tk_3DHorizontalBevel(textPtr->tkwin, pixmap, sValuePtr->border, - leftX + xOffset, dlPtr->height - sValuePtr->borderWidth, - rightX2 + sValuePtr->borderWidth - leftX, - sValuePtr->borderWidth, leftXIn, 1, 0, sValuePtr->relief); + leftX + xOffset, y + dlPtr->height - + sValuePtr->borderWidth, rightX2 + sValuePtr->borderWidth - + leftX, sValuePtr->borderWidth, leftXIn, 1, 0, + sValuePtr->relief); } nextChunk2b: @@ -2454,9 +2481,13 @@ DisplayText(clientData) maxHeight = dInfoPtr->maxY; } if (maxHeight > 0) { +#ifndef TK_NO_DOUBLE_BUFFERING pixmap = Tk_GetPixmap(Tk_Display(textPtr->tkwin), Tk_WindowId(textPtr->tkwin), Tk_Width(textPtr->tkwin), maxHeight, Tk_Depth(textPtr->tkwin)); +#else + pixmap = Tk_WindowId(textPtr->tkwin); +#endif /* TK_NO_DOUBLE_BUFFERING */ for (prevPtr = NULL, dlPtr = textPtr->dInfoPtr->dLinePtr; (dlPtr != NULL) && (dlPtr->y < dInfoPtr->maxY); prevPtr = dlPtr, dlPtr = dlPtr->nextPtr) { @@ -2471,7 +2502,9 @@ DisplayText(clientData) } DisplayDLine(textPtr, dlPtr, prevPtr, pixmap); if (dInfoPtr->dLinesInvalidated) { +#ifndef TK_NO_DOUBLE_BUFFERING Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ return; } dlPtr->oldY = dlPtr->y; @@ -2479,7 +2512,9 @@ DisplayText(clientData) } /*prevPtr = dlPtr;*/ } +#ifndef TK_NO_DOUBLE_BUFFERING Tk_FreePixmap(Tk_Display(textPtr->tkwin), pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ } /* diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index abc983b..259cc92 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixScale.c,v 1.8.4.1 2004/10/28 15:18:40 patthoyts Exp $ + * RCS: @(#) $Id: tkUnixScale.c,v 1.8.4.2 2007/04/29 02:24:01 das Exp $ */ #include "tkScale.h" @@ -567,6 +567,7 @@ TkpDisplayScale(clientData) } Tcl_Release((ClientData) scalePtr); +#ifndef TK_NO_DOUBLE_BUFFERING /* * In order to avoid screen flashes, this procedure redraws * the scale in a pixmap, then copies the pixmap to the @@ -576,6 +577,9 @@ TkpDisplayScale(clientData) pixmap = Tk_GetPixmap(scalePtr->display, Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin)); +#else + pixmap = Tk_WindowId(tkwin); +#endif /* TK_NO_DOUBLE_BUFFERING */ drawnArea.x = 0; drawnArea.y = 0; drawnArea.width = Tk_Width(tkwin); @@ -620,6 +624,7 @@ TkpDisplayScale(clientData) } } +#ifndef TK_NO_DOUBLE_BUFFERING /* * Copy the information from the off-screen pixmap onto the screen, * then delete the pixmap. @@ -629,6 +634,7 @@ TkpDisplayScale(clientData) scalePtr->copyGC, drawnArea.x, drawnArea.y, drawnArea.width, drawnArea.height, drawnArea.x, drawnArea.y); Tk_FreePixmap(scalePtr->display, pixmap); +#endif /* TK_NO_DOUBLE_BUFFERING */ done: scalePtr->flags &= ~REDRAW_ALL; -- cgit v0.12