summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvas.c
diff options
context:
space:
mode:
authordas <das>2007-04-23 21:15:17 (GMT)
committerdas <das>2007-04-23 21:15:17 (GMT)
commiteed9e6e51c9b315cca0fab5242fb5d5ed79f1d92 (patch)
tree32076caa36b64498e5a51239d238793d593cfd09 /generic/tkCanvas.c
parentb5c021fb2226984ca793d193dd65e007f6780ea4 (diff)
downloadtk-eed9e6e51c9b315cca0fab5242fb5d5ed79f1d92.zip
tk-eed9e6e51c9b315cca0fab5242fb5d5ed79f1d92.tar.gz
tk-eed9e6e51c9b315cca0fab5242fb5d5ed79f1d92.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 * generic/ttk/ttkWidget.c: platforms would only require implementation * unix/tkUnixScale.c: of TkpClipDrawableToRect()).
Diffstat (limited to 'generic/tkCanvas.c')
-rw-r--r--generic/tkCanvas.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 34454bb..3a60a2b 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.42 2007/04/17 15:24:48 dkf Exp $
+ * RCS: @(#) $Id: tkCanvas.c,v 1.43 2007/04/23 21:15:18 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.
@@ -177,10 +182,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},
@@ -2132,6 +2137,10 @@ DisplayCanvas(
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 function. All drawing is done to the
@@ -2166,14 +2175,19 @@ DisplayCanvas(
(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,
@@ -2211,6 +2225,7 @@ DisplayCanvas(
height);
}
+#ifndef TK_NO_DOUBLE_BUFFERING
/*
* Copy from the temporary pixmap to the screen, then free up the
* temporary pixmap.
@@ -2220,10 +2235,12 @@ DisplayCanvas(
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 */
}
/*