Bug 114770

Summary: Gtk theme handling when running in KDE is broken
Product: [openSUSE] SUSE Linux 10.1 Reporter: Jason Kasper <vR>
Component: KDEAssignee: Stephan Binner <stbinner>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: jjramsey
Version: Final   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Broken Gimp startup under KDE
Working Gimp startup under WindowMaker

Description Jason Kasper 2005-09-01 16:24:34 UTC
I use KDE as my environment, and there are several oddities that I've observed 
with Gtk+ themes that I have not seen with Mandriva or other distributions.  

First, it looks like Gtk+ themes in OpenSUSE 10.0 watch for changes in ~/.kde/
share/config/gtkrc and ~/.kde/share/config/gtkrc-2.0, and not the normal ~/.
gtkrc and ~/.gtkrc-2.0.

Second, if I have "apply colors to non-KDE applications" checked in KDE's 
control panel | Appearance & Themes | Colors section, then KDE will overwrite 
whatever I put in ~/.kde/share/config/gtkrc and ~/.kde/share/config/gtkrc-2.0, 
and not ~/.gtkrc and ~/.gtkrc-2.0.  And, if I do NOT have it checked, then as 
part of startkde somewhere, if those files are there, then they are removed.

The net effect of all of this is that for me to use Gtk+ themes in SuSE 10.0, I 
have to:

- start a Gtk+ application (Gaim, for example) and note that no theme is being 
used (it is ugly and grey, etc.)

- create a hard link from ~/.gtkrc and ~/.gtkrc-2.0 to ~/.kde/share/config/gtkrc 
and ~/.kde/share/config/gtkrc-2.0 (for some reason a soft link doesn't work)

- use the "gtk+ change theme" app to pick my theme.

- observe that the theme does indeed change in all my Gtk+ applications

- enjoy said theme until I log out of KDE

- log into KDE (which runs the default startkde script)

- note that now all Gtk+ applications are back to the ugly default non-theme

- note also that ~/.kde/share/config/gtkrc and ~/.kde/share/config/gtkrc-2.0 
have been removed

- start at beginning of cycle again

Please let me know what else I can provide to help get this fixed.

Thank you!
Comment 1 Mike Fabian 2005-09-01 19:48:46 UTC
I have a similar problem, although I am not using KDE but fvwm2.  my
~/.gtkrc-2.0 contains

mfabian@magellan:~$ cat .gtkrc-2.0
gtk-font-name = "sans-serif 12"
gtk-key-theme-name = "Emacs"
mfabian@magellan:~$

and this used to make the fonts (for example in the menus of firefox)
larger and I could use Emacs-like keybindings.

Both stopped working recently (after beta3 or beta2?).

strace shows that gtk2 applications still read ~/.gtkrc-2.0 but it has
no effect.

Could this be related to your bug report or is this something
completely different?

Comment 2 Jason Kasper 2005-09-03 17:49:35 UTC
Hi Mike, 

I would think that this is the same root problem--that gtk in OpenSuSE doesn't 
look for/honor/read/whatever ~/.gtkrc*, from what it looks like.
Comment 3 Jason Kasper 2005-09-04 23:30:41 UTC
Ahh, okay, I found something on the ‘net. If I set this: 

export GTK2_RC_FILES=$HOME/.gtkrc-2.0

before I start a gtk+ application, then it does watch the specified file for 
changes and Gtk+ Change Theme does, in fact, work perfectly as expected (or 
rather, the launched gtk+ application works as expected).  I don't think this is 
exactly the normal-user workaround however.  =:/
Comment 4 JP Rosevear 2005-09-05 01:56:34 UTC
Possibly fixed in gtk+ 2.8.3 as per bug 104365.
Comment 5 Mike Fabian 2005-09-06 09:17:22 UTC
I tried the gtk+ 2.8.3 package from STABLE.

No change. /home/mfabian/.gtkrc-2.0 is read but it has no effect.
I don't get a bigger font in the menus of firefox and the Emacs-like
keybindings still don't work.
Comment 6 Mike Fabian 2005-09-07 09:55:46 UTC
I tried again today and suddenly it works for me. I didn't install
remove any package, I only had to restart my X-server because it had
crashed. After the restart it worked.

I don't understand why this makes a difference, I am using fvwm2 as my
windowmanager and had killed all applications using gtk2 yesterday and
then started firefox again. Why does it make a difference if I restart
the X-server as well? I have no idea.

Anyway, it works for me now. Thank you very much!

Comment 7 JP Rosevear 2005-09-07 12:32:12 UTC
Jason, if 2.8.3 still has the problem for you, please reopen.
Comment 8 Jason Kasper 2005-09-07 14:54:56 UTC
I am loathe to re-open this, but I just upgraded to gtk2-2.8.3-3.i586.rpm (from  
 http://ftp.isr.ist.utl.pt/pub/MIRRORS/ftp.suse.com/suse/i386/supplementary/
GNOME/update_for_9.2/base/gtk2-2.8.3-3.i586.rpm) and I still see this problem.  

I have created a completely new user, with no existing files.  I have logged in 
as him and unchecked the "use kde colors in non-kde applications" setting, 
logged out, logged in again.  When I run gaim, this is what I see:

[pid  7793] lstat64("/etc/opt/gnome/gtk-2.0/gtkrc", 0xbfb3db10) = -1 ENOENT (No 
such file or directory)
[pid  7793] access("/etc/opt/gnome/gtk-2.0/gtkrc.en_US", F_OK) = -1 ENOENT (No 
such file or directory)
[pid  7793] access("/etc/opt/gnome/gtk-2.0/gtkrc.en", F_OK) = -1 ENOENT (No such 
file or directory)
[pid  7793] lstat64("/home/testey/.gtkrc-2.0-qtengine", 0xbfb3db10) = -1 ENOENT 
(No such file or directory)
[pid  7793] access("/home/testey/.gtkrc-2.0-qtengine.en_US", F_OK) = -1 ENOENT 
(No such file or directory)
[pid  7793] access("/home/testey/.gtkrc-2.0-qtengine.en", F_OK) = -1 ENOENT (No 
such file or directory)
[pid  7793] lstat64("/home/testey/.kde/share/config/gtkrc-2.0", 0xbfb3db10) = -1 
ENOENT (No such file or directory)
[pid  7793] access("/home/testey/.kde/share/config/gtkrc-2.0.en_US", F_OK) = -1 
ENOENT (No such file or directory)
[pid  7793] access("/home/testey/.kde/share/config/gtkrc-2.0.en", F_OK) = -1 
ENOENT (No such file or directory)
[pid  7793] access("/home/testey/.themes/Raleigh/gtk-2.0/gtkrc", F_OK) = -1 
ENOENT (No such file or directory)
[pid  7793] access("/opt/gnome/share/themes/Raleigh/gtk-2.0/gtkrc", F_OK) = 0
[pid  7793] lstat64("/opt/gnome/share/themes/Raleigh/gtk-2.0/gtkrc", 
{st_mode=S_IFREG|0644, st_size=69, ...}) = 0
[pid  7793] open("/opt/gnome/share/themes/Raleigh/gtk-2.0/gtkrc", O_RDONLY|
O_LARGEFILE) = 13


Note:  $HOME/.gtkrc-2.0 isn't listed.  

I notice that if I do an $(env | grep -i gtk), I get this:

GTK2_RC_FILES=/etc/opt/gnome/gtk-2.0/gtkrc:/home/testey/.gtkrc-2.0-qtengine:/
home/testey/.kde/share/config/gtkrc-2.0
GTK_RC_FILES=/etc/opt/gnome/gtk/gtkrc:/home/testey/.gtkrc:/home/testey/.kde/
share/config/gtkrc
GTK_PATH=/usr/local/lib/gtk-2.0:/opt/gnome/lib/gtk-2.0:/usr/lib/gtk-2.0

It looks like something in OpenSuSE's KDE startup/environment settings is 
setting this incorrectly maybe?

To complicate things further, if I append "/home/testey/.gtkrc-2.0" to 
${GTK2_RC_FILES}, then my theme changes ARE recognized by the gtk2 application, 
however, some of the mouse cursors are subsequently screwed up (the text mouse 
cursor and hyperlink mouse cursor use the hideous core cursors).

Please let me know what else I can provide to help this.  =:/
Comment 9 Mike Fabian 2005-09-08 13:17:35 UTC
Jason> It looks like something in OpenSuSE's KDE startup/environment
Jason> settings is setting this incorrectly maybe?

Probably.

Reassigning to kde-maintainers@suse.de

Comment 10 Jason Kasper 2005-09-12 15:32:19 UTC
> To complicate things further, if I append "/home/testey/.gtkrc-2.0" to
> ${GTK2_RC_FILES}, then my theme changes ARE recognized by the gtk2
> application, however, some of the mouse cursors are subsequently screwed up
> (the text mouse cursor and hyperlink mouse cursor use the hideous core
> cursors).

Okay, nevermind on this part.  This looks to be the same problem as bug # 
114490.  But the other part remains a bug, IMHO.  Thanks.  =:)
Comment 11 Stephan Binner 2006-03-01 11:16:50 UTC
There have been fixes to kdebase3 packages whose startkde.suse.sh sets GTK2_RC_FILES (#1512344) and gtk-qt-engine who modified .bashrc (#151164) - so what of this bug if still left? You should have to set not additional links / you should remove them.
Comment 12 Mike Fabian 2006-04-21 10:15:03 UTC
I don't know why, but I see the problem again currently on
my main workstation "Magellan":

mfabian@magellan:~$ cat /etc/SuSE-release
SUSE Linux 10.1 (X86-64) Beta8
VERSION = 10.1
mfabian@magellan:~$ cat .gtkrc-2.0
gtk-font-name = "sans-serif 16"
gtk-key-theme-name = "Emacs"
mfabian@magellan:~$ ll .gtkrc-2.0
-rw-r--r-- 1 mfabian suse 61  3? 28 15:51 .gtkrc-2.0
mfabian@magellan:~$ env | grep GTK2
GTK2_RC_FILES=/etc/opt/gnome/gtk-2.0/gtkrc:/home/mfabian/.gtkrc-2.0-qtengine:/home/mf
abian/.gtkrc-2.0:/home/mfabian/.kde/share/config/gtkrc-2.0
mfabian@magellan:~$

It is extremly annoying that the "Emacs" key-bindings don't work in GTK2 programs
and that the fonts are so small.
Comment 13 Mike Fabian 2006-04-24 09:41:55 UTC
Among the files (or directories) listed in 

GTK2_RC_FILES=/etc/opt/gnome/gtk-2.0/gtkrc:/home/mfabian/.gtkrc-2.0-qtengine:/home/mfabian/.gtkrc-2.0:/home/mfabian/.kde/share/config/gtkrc-2.0

the file /home/mfabian/.gtkrc-2.0 is the only one which exists.
Neither /etc/opt/gnome/gtk-2.0/gtkrc, nor /home/mfabian/.gtkrc-2.0-qtengine,
nor /home/mfabian/.kde/share/config/gtkrc-2.0 do exist.

strace shows that /home/mfabian/.gtkrc-2.0 is read:

mfabian@magellan:~$ strace -f -eopen gjiten 2>&1 | grep gtkrc-2.0 
open("/home/mfabian/.gtkrc-2.0", O_RDONLY) = 16
mfabian@magellan:~$

Nevertheless, sometimes the settings in /home/mfabian/.gtkrc-2.0 are
completely ignored.
Comment 14 Mike Fabian 2006-04-24 09:44:46 UTC
Especially weird is, that when this problem occured during the last weeks,
I could usually "fix" it by restarting my KDE session.

I just tried that again and after restarting my KDE session,
the settings in /home/mfabian/.gtkrc-2.0 work again.

I.e. right now I cannot reproduce the problem anymore.

This happened several times during the last weeks. Suddenly
the settings in /home/mfabian/.gtkrc-2.0 stop working although
they did work just fine before (I have no idea why).
If I restart the KDE session when that happens, it works again.
Weird.
Comment 15 Mike Fabian 2006-05-12 14:04:29 UTC
Since I wrote comment #14, I could reproce the problem again several times.

Unfortunately I still don't understand what happens.
Comment 16 Jiri Dluhos 2006-05-12 16:00:01 UTC
There is a small typo in comment #11: startkde.suse.sh was bug #151344.

Could it be that this bug was somehow brought back? The behavior is a bit similar.
Comment 17 James Ramsey 2006-09-03 23:50:48 UTC
Created attachment 97795 [details]
Broken Gimp startup under KDE
Comment 18 James Ramsey 2006-09-03 23:51:32 UTC
Created attachment 97796 [details]
Working Gimp startup under WindowMaker
Comment 19 James Ramsey 2006-09-04 00:02:30 UTC
As the attachments above show, GTK theme handling is *still* broken in SuSE's KDE.  Lines that should outline buttons and tabs are missing, and I've noticed in another app that checkboxes are missing as well. My KDE theme was set to "Redmond" with the color scheme changed to "Redmond XP," but it appears to be a problem with other styles as well.

I'm not sure yet what environment variables the startkde.suse.sh script had set. (I'm not in a position to check the variables at the moment.)
Comment 20 James Ramsey 2006-09-05 17:09:43 UTC
Uninstalling gtk-qt-engine fixed my problems.
Comment 21 Stephan Kulow 2007-01-26 14:38:31 UTC
we dropped gtk-qt-engine and replaced it with qtcurve
Comment 22 Stephan Binner 2007-01-29 08:52:35 UTC
Actually gtk-qt-engine was not dropped (yet).