summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordas <das>2007-04-29 02:24:01 (GMT)
committerdas <das>2007-04-29 02:24:01 (GMT)
commit0ee713439182546f0e884ac2db7f83101456d56e (patch)
treeb6b29a677c5c6c642d97f66297edf93f269b37b6 /generic
parent7614214a0526527a62f6cc88b6560f003397c1a3 (diff)
downloadtk-0ee713439182546f0e884ac2db7f83101456d56e.zip
tk-0ee713439182546f0e884ac2db7f83101456d56e.tar.gz
tk-0ee713439182546f0e884ac2db7f83101456d56e.tar.bz2
* 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()).
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvText.c6
-rw-r--r--generic/tkCanvas.c33
-rw-r--r--generic/tkEntry.c16
-rw-r--r--generic/tkFrame.c8
-rw-r--r--generic/tkListbox.c20
-rw-r--r--generic/tkPanedWindow.c14
-rw-r--r--generic/tkText.c6
-rw-r--r--generic/tkTextDisp.c89
8 files changed, 142 insertions, 50 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 <stdio.h>
@@ -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 */
}
/*