summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.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/tkListbox.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/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 */
}
/*