fix: File dialogs on Linux causing a crash on systems where GTK uses Wayland but GLFW uses X11 #1834
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There has been reports of the file dialog crashing ImHex on Linux, including this and this. I think this occurs on systems where Wayland is the default compositor but the GLFW used in ImHex only supports X11.
The default Ubuntu 22.04 and Ubuntu 24.04 builds of ImHex use the GLFW from Ubuntu's default package repository, which supports only X11 but not Wayland. GLFW is only built with Wayland support from Ubuntu 24.10 onwards. This can be seen from the CI log https://github.com/WerWolv/ImHex/actions/runs/10167117281, which contain something like the lines below in the CMake configure step (they are added by #1833).
These tests detect if the GLFW package that ImHex is being built against supports X11 or Wayland (or both).
Using a build of ImHex like those above means that ImHex must use an X11 window, even when Wayland is available (e.g. with Sway). However, the system GTK may support Wayland, and even default to Wayland with depending on the system configuration. As the Ubuntu builds of ImHex use NFDe with the GTK backend and use the system GTK package, GTK may open a Wayland window. An X11 window cannot be made the parent of a Wayland window, thereby causing the crash.
NFDe has been updated to force GTK to use the same compositor as the parent window, and this PR fixes ImHex by updating NFDe.