IBus: Use portal in snap

Snap supports the IBus portal for two years, but Qt applications
don't take its advantage in snap without setting IBUS_USE_PORTAL

Change-Id: I26a044d657c4b7040a21a8510116c0c7af7aaa52
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ilya Fedin 2022-11-22 04:16:25 +04:00
parent 479072791b
commit 58f885bb3c

View File

@ -573,15 +573,16 @@ void QIBusPlatformInputContext::connectToContextSignals()
}
}
static inline bool checkRunningUnderFlatpak()
static inline bool checkNeedPortalSupport()
{
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty();
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty()
|| qEnvironmentVariableIsSet("SNAP");
}
static bool shouldConnectIbusPortal()
{
// honor the same env as ibus-gtk
return (checkRunningUnderFlatpak() || !qgetenv("IBUS_USE_PORTAL").isNull());
return (checkNeedPortalSupport() || qEnvironmentVariableIsSet("IBUS_USE_PORTAL"));
}
QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate()