Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GTK input methods work #295

Merged
merged 3 commits into from
Jul 8, 2024
Merged

Conversation

pbs3141
Copy link
Contributor

@pbs3141 pbs3141 commented Jul 7, 2024

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 the GTK_EXE_PREFIX variable being set wrong. I couldn't find any value of this variable that would work, so I deleted it and set GTK_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 set GTK_IM_MODULE_FILE. The first suggestion is done here, while the second is not since GTK_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.

* Bundle GTK4 if detected, not just GTK2 and GTK3.
* Fix GTK4 bundling to not require the presence of a default theme.
* Scan ui files only once, rather than per GTK version.
This is required for GTK to find its loadable modules.
@probonopd probonopd merged commit 8507c2f into probonopd:master Jul 8, 2024
1 check passed
@probonopd
Copy link
Owner

Thank you very much @pbs3141.

@brunvonlope
Copy link

Sorry, @pbs3141, I wasn't able to test in time

@pbs3141 pbs3141 deleted the immodules branch July 9, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

appimagetool don't bundle immodules.cache neither set GTK_IM_MODULE_FILE
3 participants