1
0
mirror of https://github.com/danog/patches.git synced 2024-11-30 04:19:34 +01:00
patches/qtbase_5_12_8/0025-fix-ibus-on-wayland.patch
Ilya Fedin 2b9afa7592 Separate patches
Backport support for opening directories with xdg desktop portals

Backport fix for ibus on wayland
2020-06-02 22:21:04 +04:00

52 lines
1.8 KiB
Diff

diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index ca315840e2..1c050d8c5d 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -708,19 +708,35 @@ void QIBusPlatformInputContextPrivate::createBusProxy()
QString QIBusPlatformInputContextPrivate::getSocketPath()
{
- QByteArray display(qgetenv("DISPLAY"));
- QByteArray host = "unix";
+ QByteArray display;
QByteArray displayNumber = "0";
+ bool isWayland = false;
+
+ if (qEnvironmentVariableIsSet("IBUS_ADDRESS_FILE")) {
+ QByteArray path = qgetenv("IBUS_ADDRESS_FILE");
+ return QString::fromLocal8Bit(path);
+ } else if (qEnvironmentVariableIsSet("WAYLAND_DISPLAY")) {
+ display = qgetenv("WAYLAND_DISPLAY");
+ isWayland = true;
+ } else {
+ display = qgetenv("DISPLAY");
+ }
+ QByteArray host = "unix";
+
+ if (isWayland) {
+ displayNumber = display;
+ } else {
+ int pos = display.indexOf(':');
+ if (pos > 0)
+ host = display.left(pos);
+ ++pos;
+ int pos2 = display.indexOf('.', pos);
+ if (pos2 > 0)
+ displayNumber = display.mid(pos, pos2 - pos);
+ else
+ displayNumber = display.mid(pos);
+ }
- int pos = display.indexOf(':');
- if (pos > 0)
- host = display.left(pos);
- ++pos;
- int pos2 = display.indexOf('.', pos);
- if (pos2 > 0)
- displayNumber = display.mid(pos, pos2 - pos);
- else
- displayNumber = display.mid(pos);
if (debug)
qDebug() << "host=" << host << "displayNumber" << displayNumber;