Also, to help explain scope, all Java applications that use the Gtk theme
are affected with the removal of this environment variable.  I'm not
issuing blame, it's been deprecated for a very long time now, but when
OpenJDK patches this they'll need a new way of detecting that Gnome is
running:

- Fedora 27: Java apps that request system's theme look fine, properly use
Gtk3 theme.
- Fedora 32: Java apps that request system's theme don't look fine,
fallback to the Java Swing theme.

The issue is larger than Fedora of course.  I had similar issues on other
Desktops, which I've outlined in detail here:
<https://github.com/AdoptOpenJDK/openjdk-support/issues/94#issuecomment-621346178>
https://github.com/AdoptOpenJDK/openjdk-support/issues/94#issuecomment-621346178

Downstream, any Java developer is going to look to OpenJDK to patch this,
but I'm asking here first, since the next step is reporting directly to
OpenJDK's upstream tracker and if I have a solution from the Gnome team,
it'll be resolved much quicker.

- tres.finocchi...@gmail.com


On Wed, Apr 29, 2020 at 3:09 PM Tres Finocchiaro <tres.finocchi...@gmail.com>
wrote:

> Just to confirm, OpenJDK is currently leveraging "gtk-theme-name" as
> you've indicated:
>
> https://github.com/AdoptOpenJDK/openjdk-jdk/blob/858ec1c5fad02242b7452099f3d5789e55a79057/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c#L725
>
> I believe question is less about which theme and more about how to know
> the desktop is running to begin with.  Any insight is greatly appreciated.
>
>
> - tres.finocchi...@gmail.com
>
>
> On Wed, Apr 29, 2020 at 3:03 PM Tres Finocchiaro <
> tres.finocchi...@gmail.com> wrote:
>
>> Matthias,
>>
>> Thanks for the detailed response.  Please accept my lack of knowledge on
>> the subject as I'm neither an OpenJDK developer nor a C developer, (I
>> develop using Java, so information is to benefit the bug report against
>> OpenJDK).  That said...
>>
>> It appears the environment variable is a preflight which is leveraged to
>> avoid loading the libraries unintentionally.
>>
>> I think what OpenJDK is trying to avoid is blindly loading a library
>> that's on the system without knowing if it's actually in-use.  This
>> variable -- albeit deprecated -- was a reliable way to know that.
>>
>> Here it checks to see if Gnome is running:
>>
>> https://github.com/AdoptOpenJDK/openjdk-jdk/blob/634c676e6c145c936b460debaa95d0b6cfa61ae2/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java#L100
>>
>> Here, it configures the look and feel:
>>
>> https://github.com/AdoptOpenJDK/openjdk-jdk/blob/634c676e6c145c936b460debaa95d0b6cfa61ae2/src/java.desktop/share/classes/javax/swing/UIManager.java#L665
>>
>> And deeper into the native calls, it interacts with Gtk libraries:
>>
>> https://github.com/AdoptOpenJDK/openjdk-jdk/blob/634c676e6c145c936b460debaa95d0b6cfa61ae2/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c#L53
>>
>> So although I can't answer the specific theming questions, I can confirm
>> the theme seems to apply correctly on systems which utilize it.  It's less
>> of a matter of how to detect the theme and more of a matter of how to
>> detect that the desktop environment offers a Gtk theme to begin with.
>>
>> Albeit deprecated and clunky, GNOME_DESKTOP_SESSION_ID seemed to have
>> been the way Java's known this historically and removal of it requires a
>> replacement of which I'm hoping to gain knowledge of.
>>
>> - tres.finocchi...@gmail.com
>>
>>
>> On Wed, Apr 29, 2020 at 1:37 PM Matthias Clasen <
>> matthias.cla...@gmail.com> wrote:
>>
>>>
>>> Hey Tres,
>>>
>>> in my opinion, environment variables are about the worst possible option
>>> for this sort of thing.
>>>
>>> If you are linking against GTK, the easiest way is to just ask GTK
>>> itself if you need to know
>>> the theme name:
>>>
>>> g_object_get (gtk_settings_get_defautt (), "gtk-theme-name", &theme,
>>> NULL);
>>>
>>> But I am not sure that the theme name is really needed. What information
>>> are you looking for
>>> exactly ? And what decision are you going to make based on it ?
>>>
>>>
_______________________________________________
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list

Reply via email to