mirror of
https://github.com/danog/patches.git
synced 2024-11-26 11:54:51 +01:00
2b9afa7592
Backport support for opening directories with xdg desktop portals Backport fix for ibus on wayland
52 lines
1.8 KiB
Diff
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;
|
|
|