Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-dev] Linux: handle problematic GTK3 themes

On 1/7/19 10:29 AM, Thomas Singer wrote:
Hi Eric,
On 07/01/2019 16:21, Eric Williams wrote:
Hi Thomas,

On 1/7/19 4:30 AM, Thomas Singer wrote:
Hello,

It looks like some GTK themes cause more problems on Linux than others, e.g. we have a couple of problems with Mint-X on Linux Mate 17.1.

According to <https://developer.gnome.org/gtk3/3.20/gtk-running.html> it should be possible to change the theme of a certain application by setting the environment variable GTK_THEME before launching the application (ours usually is launched from a .sh script so adding the "export GTK_THEME=..." line would be no problem). Unfortunately, this does not work - it simply uses the default Mint-X theme.

We have support in SWT to read the GTK_THEME environment variable, so this should work. How are you using it? IIRC the theme has to be installed on the system in order for GTK_THEME to work.

In my Linux Mint installation I can select, e.g. "Clearlooks" in the GUI for the controls. Adding

export GTK_THEME=Clearlooks

before launching SmartGit has no effect - it still uses the system setting of Mint-X.

This should be working, does it work with native applications? Maybe Linux Mint forces the system theme somehow.


How do you actually manage the problems of different themes in combination with SWT? Do you suggest the users to switch their system theme? Do you abort the application with an error if a known buggy theme is detected?

SWT only officially supports the default GTK theme (Adwaita). A lot of themes follow the Adwaita style of declaring colors and other such things so it's usually not an issue, however there are exceptions. In these cases we do not try to fix issues in broken themes as there are no manpower/resources to do so. It's not really SWT's responsibility to fix broken GTK themes anyways.

From the user perspective it looks like the SWT-based applications are broken, because native applications simply work. Usually, users also don't want to change the system theme because it looks good for them and they might have selected it because they like it.

That said, if your theme is "difficult" and causes issues in SWT, you can feed some GTK CSS to SWT via the org.eclipse.swt.internal.gtk.cssFile property. SWT will load the CSS in this file at startup. I believe bug 527729 had some discussion on this matter.

Thanks you.

Quite related: why some controls, e.g. buttons, in native GTK applications look so different than the ones in a SWT application?

GTK has a concept of "minimum size", i.e. if you try to resize an app below a certain size it will just deny the resize all together. SWT has API for absolute sizes regardless of minimum size, which can cause some conflict in GTK.

Some themes really exacerbate this disparity by having large padding around widgets like buttons, text entries, etc. They look good in native GTK because they never get shrunk small enough, but in SWT they do and then you see the ugliness.


Eric


Back to the top