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.
This attempts to get input methods working for packaged apps using GTK3 and GTK4.
First of all,
appdirtool.go
didn't even handle GTK4 (it was hard-coded to 2 and 3), so GTK's loadable modules weren't even being deployed. The first commit fixes this by adding support for version 4. This resulted in an error in the step "Bundling Default theme for Gtk", since there is no default theme for GTK4, so this step was restricted to versions <= 3. Along the way I noticed "Gtk .ui files found." was running multiple times (once for each GTK version), so this was fixed too.The above still didn't get input methods working in GTK4 apps, since GTK was looking in the wrong place for its loadable modules, as checked with
GTK_DEBUG=modules
. This was related to theGTK_EXE_PREFIX
variable being set wrong. I couldn't find any value of this variable that would work, so I deleted it and setGTK_PATH
instead (third commit).GTK3 also requires
immodules.cache
to be bundled and patched (unlike GTK4, which has no such file). So code was added to do this on versions <= 3 (second commit).I have tested the above changes with Inkscape (GTK4) and confirmed that it works. Although I have tested the GTK3-specific code too, I haven't tested it with a real GTK3 app (GIMP), so could do with some help with that (@brunvonlope).
This PR is supposed to fix #282. In that issue, there were two suggestions: bundle and patch
immodules.cache
, and setGTK_IM_MODULE_FILE
. The first suggestion is done here, while the second is not sinceGTK_IM_MODULE_FILE
no longer exists in GTK4 (doc), and we want a solution that works for all GTK versions if possible. It might be that it does need to be set though, in which case doing it for GTK <= 3 would be harmless, since it is ignored by GTK4.