Make gdk backend limit more permissive

This commit is contained in:
Ilya Fedin 2020-07-22 06:15:59 +04:00 committed by John Preston
parent 841908fe31
commit ab95751a66

View file

@ -7,10 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/linux/linux_libs.h"
#include "base/platform/base_platform_info.h"
#include "platform/linux/linux_xlib_helper.h"
#include "platform/linux/linux_gdk_helper.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/specific_linux.h"
#include "core/sandbox.h"
#include "core/core_settings.h"
@ -112,17 +110,12 @@ bool setupGtkBase(QLibrary &lib_gtk) {
if (!LOAD_SYMBOL(lib_gtk, "gdk_atom_intern", gdk_atom_intern)) return false;
if (LOAD_SYMBOL(lib_gtk, "gdk_set_allowed_backends", gdk_set_allowed_backends)) {
// We work only with X11 GDK backend.
// We work only with Wayland and X11 GDK backends.
// Otherwise we get segfault in Ubuntu 17.04 in gtk_init_check() call.
// See https://github.com/telegramdesktop/tdesktop/issues/3176
// See https://github.com/telegramdesktop/tdesktop/issues/3162
if(Platform::IsWayland() && !lib_gtk.fileName().contains("gtk-x11-2.0")) {
DEBUG_LOG(("Limit allowed GDK backends to wayland"));
gdk_set_allowed_backends("wayland");
} else {
DEBUG_LOG(("Limit allowed GDK backends to x11"));
gdk_set_allowed_backends("x11");
}
DEBUG_LOG(("Limit allowed GDK backends to wayland and x11"));
gdk_set_allowed_backends("wayland,x11");
}
// gtk_init will reset the Xlib error handler, and that causes