diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2021-06-23 03:20:40 +0400 |
---|---|---|
committer | John Preston <johnprestonmail@gmail.com> | 2021-07-02 00:59:36 +0300 |
commit | 551ea7d8791e666d3e268ad43aa5ae142bfc2cb6 (patch) | |
tree | 7b767637f5a1a1132bdfaaa6043f432bedf2569b /Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp | |
parent | d3c9bb0bc6ea4360e2de875f7039453077c87a13 (diff) |
Move GTK integration out of process with D-Bus
Diffstat (limited to 'Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp')
-rw-r--r-- | Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp index c19149fc28..d49f9ea2c6 100644 --- a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp @@ -10,9 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/platform/linux/base_linux_gtk_integration.h" #include "base/platform/linux/base_linux_gtk_integration_p.h" #include "platform/linux/linux_gtk_integration_p.h" -#include "platform/linux/linux_wayland_integration.h" - -#include <QtGui/QWindow> #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION extern "C" { @@ -98,21 +95,17 @@ void GdkHelperLoad(QLibrary &lib) { } } -void GdkSetTransientFor(GdkWindow *window, QWindow *parent) { +void GdkSetTransientFor(GdkWindow *window, const QString &parent) { #ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION if (gdk_wayland_window_get_type != nullptr && gdk_wayland_window_set_transient_for_exported != nullptr - && GDK_IS_WAYLAND_WINDOW(window)) { - if (const auto integration = WaylandIntegration::Instance()) { - if (const auto handle = integration->nativeHandle(parent) - ; !handle.isEmpty()) { - auto handleUtf8 = handle.toUtf8(); - gdk_wayland_window_set_transient_for_exported( - window, - handleUtf8.data()); - return; - } - } + && GDK_IS_WAYLAND_WINDOW(window) + && parent.startsWith("wayland:")) { + auto handle = parent.mid(8).toUtf8(); + gdk_wayland_window_set_transient_for_exported( + window, + handle.data()); + return; } #endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION @@ -121,23 +114,33 @@ void GdkSetTransientFor(GdkWindow *window, QWindow *parent) { && gdk_x11_display_get_xdisplay != nullptr && gdk_x11_window_get_xid != nullptr && gdk_window_get_display != nullptr - && GDK_IS_X11_WINDOW(window)) { - XSetTransientForHint( - gdk_x11_display_get_xdisplay(gdk_window_get_display(window)), - gdk_x11_window_get_xid(window), - parent->winId()); - return; + && GDK_IS_X11_WINDOW(window) + && parent.startsWith("x11:")) { + auto ok = false; + const auto winId = parent.mid(4).toInt(&ok, 16); + if (ok) { + XSetTransientForHint( + gdk_x11_display_get_xdisplay(gdk_window_get_display(window)), + gdk_x11_window_get_xid(window), + winId); + return; + } } #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION if (gdk_x11_drawable_get_xdisplay != nullptr - && gdk_x11_drawable_get_xid != nullptr) { - XSetTransientForHint( - gdk_x11_drawable_get_xdisplay(window), - gdk_x11_drawable_get_xid(window), - parent->winId()); - return; + && gdk_x11_drawable_get_xid != nullptr + && parent.startsWith("x11:")) { + auto ok = false; + const auto winId = parent.mid(4).toInt(&ok, 16); + if (ok) { + XSetTransientForHint( + gdk_x11_drawable_get_xdisplay(window), + gdk_x11_drawable_get_xid(window), + winId); + return; + } } #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION } |