summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.c
diff options
context:
space:
mode:
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 f5ade9f..87d82c1 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.39 2007/04/17 14:32:28 dkf Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.40 2007/04/23 21:15:18 das Exp $
*/
#include "tkPort.h"
@@ -280,7 +280,7 @@ static const 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},
@@ -1776,7 +1776,9 @@ ListboxWorldChanged(
}
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);
@@ -1861,6 +1863,7 @@ DisplayListbox(
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 done to the pixmap,
@@ -1871,6 +1874,9 @@ DisplayListbox(
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);
@@ -1935,7 +1941,11 @@ DisplayListbox(
* 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;
@@ -2152,10 +2162,12 @@ DisplayListbox(
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 */
}
/*