summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.c
diff options
context:
space:
mode:
authordas <das>2007-04-29 02:24:01 (GMT)
committerdas <das>2007-04-29 02:24:01 (GMT)
commit45665efbccf16dcd29501b340af30b500efe8187 (patch)
treeb6b29a677c5c6c642d97f66297edf93f269b37b6 /generic/tkListbox.c
parent05fb52ba30bb84f73c067ec3c7bbc09c3cffb5c7 (diff)
downloadtk-45665efbccf16dcd29501b340af30b500efe8187.zip
tk-45665efbccf16dcd29501b340af30b500efe8187.tar.gz
tk-45665efbccf16dcd29501b340af30b500efe8187.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/tkListbox.c')
-rw-r--r--generic/tkListbox.c20
1 files changed, 16 insertions, 4 deletions
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 */
}
/*