From abba76b707739e5a8614f12f8d35ffda60329b1e Mon Sep 17 00:00:00 2001 From: patthoyts Date: Mon, 5 Oct 2009 14:49:20 +0000 Subject: [Bug #2860827] avoid 3D effects with user-specified backgrounds The default disabled text is embossed on Windows. But this looks poor when a non-default background color is in use. This patch disables the embossed effect for buttons and labels when the background is non- standard. --- ChangeLog | 8 ++++++++ win/tkWinButton.c | 22 +++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index fbf8872..fd10b03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-10-05 Pat Thoyts + + * win/tkWinButton.c: [Bug 2860827] avoid 3D effects with + user-specified backgrounds. The default disabled text is embossed + on Windows. But this looks poor when a non-default background + color is in use. This patch disables the embossed effect for + buttons and labels when the background is non- standard. + 2009-09-30 Pat Thoyts * tests/winWm.test: [Bug 2799589] grab on deleted window. diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 8aafd7b..21fc3fb 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.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: tkWinButton.c,v 1.36 2008/12/09 21:22:56 dgp Exp $ + * RCS: @(#) $Id: tkWinButton.c,v 1.37 2009/10/05 14:49:21 patthoyts Exp $ */ #define OEMRESOURCE @@ -552,15 +552,17 @@ TkpDisplayButton( (butPtr->disabledFg != NULL)) { COLORREF oldFgColor = gc->foreground; - gc->foreground = GetSysColor(COLOR_3DHILIGHT); - Tk_DrawTextLayout(butPtr->display, pixmap, gc, + if (gc->background == GetSysColor(COLOR_BTNFACE)) { + gc->foreground = GetSysColor(COLOR_3DHILIGHT); + Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout, x + textXOffset + 1, y + textYOffset + 1, 0, -1); - Tk_UnderlineTextLayout(butPtr->display, pixmap, gc, + Tk_UnderlineTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout, x + textXOffset + 1, y + textYOffset + 1, butPtr->underline); - gc->foreground = oldFgColor; + gc->foreground = oldFgColor; + } } Tk_DrawTextLayout(butPtr->display, pixmap, gc, @@ -615,13 +617,15 @@ TkpDisplayButton( if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) { COLORREF oldFgColor = gc->foreground; - gc->foreground = GetSysColor(COLOR_3DHILIGHT); - Tk_DrawTextLayout(butPtr->display, pixmap, gc, + if (gc->background == GetSysColor(COLOR_BTNFACE)) { + gc->foreground = GetSysColor(COLOR_3DHILIGHT); + Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout, x + 1, y + 1, 0, -1); - Tk_UnderlineTextLayout(butPtr->display, pixmap, gc, + Tk_UnderlineTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout, x + 1, y + 1, butPtr->underline); - gc->foreground = oldFgColor; + gc->foreground = oldFgColor; + } } Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout, x, y, 0, -1); -- cgit v0.12