compose-multiplatform
compose-multiplatform copied to clipboard
AwtWindow does not render on KDE Plasma Desktop with freetype2 2.11.0-4
I tried to run the Notepad example application on my desktop and everything works, except when I try to open the "Open..." or the "Save" window from the menu bar, I only get a transparent window with visual artifacts. In the terminal I get the following error messages:
` (java:38970): Gtk-WARNING **: 22:03:10.434: drawing failure for widget 'GtkFileChooserDialog': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.595: drawing failure for widget 'GtkLabel': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.595: drawing failure for widget 'GtkGrid': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.595: drawing failure for widget 'GtkBox': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.595: drawing failure for widget 'GtkFileChooserWidget': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.595: drawing failure for widget 'GtkBox': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.595: drawing failure for widget 'GtkFileChooserDialog': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.605: drawing failure for widget 'GtkLabel': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.605: drawing failure for widget 'GtkBox': error occurred in libfreetype
(java:38970): Gtk-WARNING **: 22:06:47.605: drawing failure for widget 'GtkEventBox': error occurred in libfreetype ... ` My system: Operating System: Manjaro Linux KDE Plasma Version: 5.22.5 KDE Frameworks Version: 5.87.0 Qt Version: 5.15.2 Kernel Version: 5.10.70-1-MANJARO (64-bit) Graphics Platform: X11 Graphics Processor: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2
FreeType version: freetype2 2.11.0-4
Here is the crash inf
o
@igordmn does it look like a Compose issue?
Not sure. It can be a local system issue, a distro issue, or a JDK issue. In the last case, we can bypass it, providing our own implementation of FileChooser
, calling the native API directly.
@maximilianproell, do you know, where you can find another File save dialog in the other apps? To check if it works.
@igordmn I din't find any other usage of AwtWindow in the other examples, everything else which only uses default Compose functions seems to work fine. The FileDialog created in the AwtWindow Composable causes the issue. I only found one similar issue, where someone gets the same errors, but I don't know if it's related: https://www.mail-archive.com/[email protected]/msg1827418.html
Either way, the problem also seems to be caused by the freeType version. I also tried setting gsettings set org.gnome.desktop.interface font-antialiasing grayscale
which didn't help.
I din't find any other usage of AwtWindow in the other examples
I wanted to check if there is the other application (not related to Compose, better some preinstalled application) which able to open the default system file chooser.
which able to open the default system file chooser.
Ah, yes. For example, all chromium based browsers use the system default file chooser (Brave in my example) and that's just working perfectly fine.
I have a draft of another implementation of file chooser (using lwjgl):
https://github.com/JetBrains/compose-jb/tree/components_nativedialogs
It would be great, if you can check it:
git checkout components_nativedialogs
cd components
./gradlew nativedialogs:demo:run
It would be great, if you can check it:
I just tried that implementation out, but I get exactly the same errors and the file chooser is a blank window with visual artifacts which are influenced by the mouse movement:
The errors are again:
`(java:4800): Gtk-WARNING **: 13:53:02.139: drawing failure for widget 'GtkFileChooserDialog': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkLabel': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkBox': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkEventBox': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkRevealer': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkSidebarRow': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkListBox': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkViewport': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkPlacesSidebar': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkPaned': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkBox': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkFileChooserWidget': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkBox': error occurred in libfreetype
(java:4800): Gtk-WARNING **: 13:53:02.156: drawing failure for widget 'GtkFileChooserDialog': error occurred in libfreetype ... `
Thanks!
I am out of options now.
NativeDialogs uses GTK directly.
Either other applications (Brave) use another API, or they pass some specific options, or java
somehow interferes.
But my main guess - everything is fine with NativeDialogs/Compose/JDK, it is something broken in the system or in the latest version of some library.
Try to downgrade freetype to 2.10.4+dfsg-1
, as this issue says, there is no crash on this version
Brave
As far as I know, Chromium based browser use their own bundled freetype
, so it seems everything work because the version is different.
Ok I did some further research: I tried the notepad example app on another Manjaro KDE system: The same error happens there (same freetype version is installed, so the problem can be boiled down to the freetype version).
But GTK file choosers work without a problem on all my KDE systems (Thunderbird, Firefox and Gimp use them for example). I also created a minimal JavaFX Application and open the FileChooser like that and it opens just fine:
NativeDialogs uses GTK directly.
Native Dialogs use QT on KDE and they look different, as it can be seen here: https://askubuntu.com/questions/1150404/kubuntu-18-10-how-do-i-change-this-file-picker I also forced Firefox to use the native KDE file picker as described in that post and it works fine. So both GTK and the KDE native QT based file pickers work. So I guess the problem is in the old Java Swing library, as JavaFX works?
No, Swing doesn't use NativeDialogs library (by "NativeDialogs" I mean the name of the library, not real native dialogs :) ), it probably also uses GTK (#include <gtk/gtk.h>) to open GTK file chooser. NativeDialogs is just a wrapper around GTK/WinApi/AppKit.
I don't know what is used by JavaFX, but my guess it uses JavaFX based file chooser, written from scratch, not the native one.
I also forced Firefox to use the native KDE
Firefox probably also uses a bundled freetype, not the system one.
So we have 2 issues:
- GTK file chooser probably doesn't work with freetype2 2.11.0-4
- Swing/NativeDialogs uses GTK file chooser on KDE instead of QT one
What is the current status regarding this issue?
The problem still persists with Compose version 1.0.1 and freetype2 2.11.1-1. This is a major deal breaker as this also prevents any other AWT component to be correctly rendered (like the Menubar for example) and I can't expect my Linux users to downgrade their freetype2 version. I, for example, can't even do that because of my distribution repository only having the latest version.
Any updates?
If anyone needs a file picker on linux and has the same issues, I ended up using bonsai. At least it works and has consistent design.
Have the same issues on Arch (Cinnamon), tried various JDKs. The problem only occurs with Compose apps (tried both AWT and Swing solutions), all other applications work fine, even Java Swing apps (e.g. Intellij Idea, JMeter).
JMeter is open-source, I think that's what they use for file dialog. But it still fails to render with ComposeWindow
.
Also tried compose-multiplatform-file-picker, same issues :disappointed:
Same issue using https://github.com/WonderzGmbH/nativefiledialog-java
Wayland (amd) Gnome 44.2 freetype2-2.13.0-1
Current version of compose-multiplatform-file-picker fixed all my issues.
From what I understand, the problem occurs when using the GTK file picker (from <gtk/gtk.h>
) in conjunction with Compose. But when using zenity it works fine (maybe because it's an external process?). When using any of these tools by themselves (without Compose, but from Kotlin code), everything works fine.
Currently, compose-multiplatform-file-picker
uses tinyfd by default. On Linux, tinyfd
will first try to use zenity
if available. That's why compose-multiplatform-file-picker
works. Any other solution ends up using bindings to native functions (using JNA) that call <gtk/gtk.h>
.
My guess is that Skia or Compose is interfering with GTK or something.
I'll try to add test files soon.
On my Fedora 39/Fedora 45/JDK 17, this fixed the issue for me:
gsettings set org.gnome.desktop.interface font-antialiasing grayscale
This issue still occurs with lwjgl nfd module, the libfreetype version is 2.13.2-1
This issue still occurs with lwjgl nfd module, the libfreetype version is 2.13.2-1
If it's an option, you can try to use lwjgl tinyfd.
Example:
https://github.com/AzimMuradov/stardew-valley-designer/tree/master/common/cmp-libs/file-dialogs-ui/src/jvmMain/kotlin/io/stardewvalleydesigner/cmplib/filedialogs
Before, I used compose-multiplatform-file-picker
, but I ended up creating my own custom solution.