Getting GTK XWayland applications to use the system's GTK theme

Rune Kjær Svendsen runesvend at gmail.com
Mon Mar 4 12:46:53 PST 2013


On Sun, Mar 3, 2013 at 5:39 PM, Bill Spitzak <spitzak at gmail.com> wrote:

> On 03/03/2013 12:04 AM, Scott Moreau wrote:
>
>> Hi Rune,
>>
>>  I believe he is complaining about the different client-drawn items.
> Compare the "All Settings" button in System Settings to the buttons in the
> "Synaptic Package Manager". It seems that some Ubuntu programs are drawing
> with the correct theme (the System Settings) and some are not.
>
> The fact is the toytoolkit window borders look just fine with the ubuntu
> theme. Chrome is the only program drawing it's own window borders, and this
> is identical to how it works under X, so he is not complaining about this.
>
> "How to find the theme" is infuriatingly complex in GTK and Gnome, and I
> think the fact that some environment variables are set different is causing
> the problem. This has nothing to do with xwayland, all the relevant code is
> in the X clients. It looks like some find it, but others don't and fall
> back to the default (the gray one with thicker 3D borders). Also Chrome
> attempts to figure out what the GTK theme is and copy it, and it looks like
> it is also failing to find it.
>

Hi Bill

Yes, this is the issue I'm trying to figure out. Would you happen to know
which environment variables we're talking about? I find it odd that it
works for some programs, while not for others. But perhaps this is because
of the complexity you're talking about.

I've tried running synaptic under Weston (as an XWayland application) and
then run it under normal Ubuntu (Compiz/Unity) using "strace -eopen" to see
what the difference is between the files they load. Here's a compact output
of a diff between the two log files (strace -eopen synaptic). So every line
that starts with a "+" is what synaptic run under Compiz does that the
Synaptic run under XWayland doesn't, and every line that starts with a "-"
is what the XWayland app does that the Synaptic run under Compiz doesn't
do. Lines with nothing prepended are done by both:

    open("/usr/share/locale/en/LC_MESSAGES/gtk20-properties.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)

open("/usr/share/locale-langpack/en_US/LC_MESSAGES/gtk20-properties.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/usr/share/locale-langpack/en/LC_MESSAGES/gtk20-properties.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)

 +open("/usr/lib/x86_64-linux-gnu/gtk-2.0/modules/liboverlay-scrollbar.so",
O_RDONLY|O_CLOEXEC) = 3
    open("/home/rune/.Xauthority", O_RDONLY) = 4
   -open("/usr/share/themes/Raleigh/gtk-2.0/gtkrc", O_RDONLY) = 5

   -open("/home/rune/.Xdefaults", O_RDONLY) = -1 ENOENT (No such file or
directory)
   -open("/home/rune/.Xdefaults-rune-desktop", O_RDONLY) = -1 ENOENT (No
such file or directory)

   [repeat the opening of first "/home/rune/.Xdefaults" then
"/home/rune/.Xdefaults-rune-desktop", as above, 10 times]

   -open("/home/rune/.Xdefaults", O_RDONLY) = -1 ENOENT (No such file or
directory)
   +open("/usr/share/themes/Ambiance/gtk-2.0/gtkrc", O_RDONLY) = 5
   +open("/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/engines/libmurrine.so",
O_RDONLY|O_CLOEXEC) = 6
   +open("/usr/share/themes/Ambiance/gtk-2.0/apps/chromium.rc", O_RDONLY) =
6
   +open("/usr/share/themes/Ambiance/gtk-2.0/apps/ff.rc", O_RDONLY) = 6
   +open("/usr/share/themes/Ambiance/gtk-2.0/apps/gnome-terminal.rc",
O_RDONLY) = 6

So it seems that after trying to load some language pack files,
Compiz-Synaptic opens up the Ubuntu-specific scrollbar library (this isn't
done by XWayland-Synaptic). Then they both successfully open ~/.Xauthority.
Then XWayland-Synaptic continues to open the Raleigh theme (the "gray one
with thicker 3D borders") followed by it trying to read ~/.Xdefaults and
~/.Xdefaults-rune-desktop.

Could it be related to the .Xauthority file somehow?


I think synaptic run as root, and the theme ain't the same for that profile.


Hi Solerman

In this example Synaptic isn't run as root. Also, smuxi and google-chrome
aren't run as root, so I don't think this is what is causing them to not
find the correct theme.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130304/cd31a294/attachment.html>


More information about the wayland-devel mailing list