Bug 1043686

Summary: tk apps fail in KDE with unknown color name BACKGROUND
Product: Red Hat Enterprise Linux 7 Reporter: Jeff Bastian <jbastian>
Component: kde-workspaceAssignee: Than Ngo <than>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: medium Docs Contact:
Priority: low    
Version: 7.0CC: gbeshers, jbastian, mholec, vbenes, wmealing
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kde-workspace-4.10.5-19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1260129 (view as bug list) Environment:
Last Closed: 2014-09-22 13:17:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 722241, 1260129    

Description Jeff Bastian 2013-12-16 22:43:46 UTC
Description of problem:
Tk applications, e.g., gitk and tkdiff, fail in RHEL7 KDE with an error:
Application initialization failed: unknown color name "BACKGROUND"

The applications work fine in Gnome.

Version-Release number of selected component (if applicable):
kde-workspace-4.10.5-7.el7.x86_64
tk-8.5.13-2.el7.x86_64

How reproducible:
every time

Steps to Reproduce:
1. login to KDE
2. run a Tk application, e.g., gitk, or even the plain wish interpreter

Actual results:
~]$ wish
Application initialization failed: unknown color name "BACKGROUND"
%
~]$ gitk
Application initialization failed: unknown color name "BACKGROUND"
Error in startup script: unknown color name "BACKGROUND"
    (database entry for "-background" in widget ".")
    invoked from within
"load /usr/lib64/tk8.5/../libtk8.5.so Tk"
    ("package ifneeded Tk 8.5.13" script)
    invoked from within
"package require Tk"
    (file "/usr/bin/gitk" line 10)

Expected results:
Tk applications launch correctly

Additional info:

Comment 1 Jeff Bastian 2013-12-16 22:49:51 UTC
I see this in my ~/.xsession-errors file too:

~]$ grep -i background .xsession-errors
QColor::setNamedColor: Unknown color name 'BACKGROUND'
QColor::setNamedColor: Unknown color name 'BACKGROUND'
QColor::setNamedColor: Unknown color name 'SELECT_BACKGROUND'
QColor::setNamedColor: Unknown color name 'BACKGROUND'
QColor::setNamedColor: Unknown color name 'BACKGROUND'
QColor::setNamedColor: Unknown color name 'SELECT_BACKGROUND'

Comment 2 Jeff Bastian 2013-12-16 23:23:44 UTC
I searched the source code for the string "SELECT_BACKGROUND" and this was the only reference I found.  From kcontrol/krdb/krdb.cpp:

    419   if (exportColors)
    420   {
    421     KGlobal::dirs()->addResourceType("appdefaults", "data", "kdisplay/app-defaults/");
    422     KGlobal::locale()->insertCatalog("krdb");
    423 
    424     QString preproc;
    425     QColor backCol = newPal.color( QPalette::Active, QPalette::Background );
    426     addColorDef(preproc, "FOREGROUND"         , newPal.color( QPalette::Active, QPalette::Foreground ) );
    427     addColorDef(preproc, "BACKGROUND"         , backCol);
    428     addColorDef(preproc, "HIGHLIGHT"          , backCol.light(100+(2*KGlobalSettings::contrast()+4)*16/1));
    429     addColorDef(preproc, "LOWLIGHT"           , backCol.dark(100+(2*KGlobalSettings::contrast()+4)*10));
    430     addColorDef(preproc, "SELECT_BACKGROUND"  , newPal.color( QPalette::Active, QPalette::Highlight));
    431     addColorDef(preproc, "SELECT_FOREGROUND"  , newPal.color( QPalette::Active, QPalette::HighlightedText));
    432     addColorDef(preproc, "WINDOW_BACKGROUND"  , newPal.color( QPalette::Active, QPalette::Base ) );
    433     addColorDef(preproc, "WINDOW_FOREGROUND"  , newPal.color( QPalette::Active, QPalette::Foreground ) );
    434     addColorDef(preproc, "INACTIVE_BACKGROUND", KGlobalSettings::inactiveTitleColor());
    435     addColorDef(preproc, "INACTIVE_FOREGROUND", KGlobalSettings::inactiveTitleColor());
    436     addColorDef(preproc, "ACTIVE_BACKGROUND"  , KGlobalSettings::activeTitleColor());
    437     addColorDef(preproc, "ACTIVE_FOREGROUND"  , KGlobalSettings::activeTitleColor());

Comment 3 Jeff Bastian 2013-12-16 23:29:53 UTC
And indeed, I have a bunch of properties in my X resources with invalid color names:

~]$ xrdb -query
*Box.background:        BACKGROUND
*Box.foreground:        FOREGROUND
*Button.activeBackground:       BACKGROUND
*Button.activeForeground:       FOREGROUND
*Button.background:     BACKGROUND
*Button.foreground:     FOREGROUND
*Button.highlightBackground:    BACKGROUND
*Button.highlightColor: FOREGROUND
*Canvas.activeBackground:       WINDOW_BACKGROUND
*Canvas.activeForeground:       WINDOW_FOREGROUND
*Canvas.background:     WINDOW_BACKGROUND
*Canvas.foreground:     WINDOW_FOREGROUND
*Canvas.highlightBackground:    WINDOW_BACKGROUND
*Canvas.highlightColor: WINDOW_FOREGROUND
*Canvas.selectbackground:       SELECT_BACKGROUND
...
...

Comment 4 Jeff Bastian 2013-12-16 23:32:16 UTC
Clearing out the X resources fixes the problem:

~]$ xrdb -load /dev/null
~]$ xrdb -query
~]$ wish
%

Comment 5 Jeff Bastian 2013-12-17 17:54:15 UTC
A workaround is to go to
  KDE System Settings -> Application Appearance -> Colors -> Options
and disable the checkbox for
  Apply colors to non-KDE4 applications
and logout and login again.

Non-KDE apps may not look as pretty, but at least they'll run.

Comment 6 Than Ngo 2014-02-14 10:00:14 UTC
*** Bug 1053891 has been marked as a duplicate of this bug. ***

Comment 7 RHEL Program Management 2014-03-22 06:22:05 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 19 errata-xmlrpc 2014-09-22 13:17:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1274.html

Comment 20 Tomas Popela 2020-01-06 14:23:53 UTC
*** Bug 1070246 has been marked as a duplicate of this bug. ***