diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp index a9731ce..2bb4468 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp @@ -45,6 +45,7 @@ bool loadLibrary(QLibrary &lib, const char *name, int version) { } bool setupGtkBase(QLibrary &lib_gtk) { + load(lib_gtk, "gdk_set_allowed_backends", gdk_set_allowed_backends); if (!load(lib_gtk, "gtk_init_check", gtk_init_check)) return false; if (!load(lib_gtk, "gtk_menu_new", gtk_menu_new)) return false; if (!load(lib_gtk, "gtk_menu_get_type", gtk_menu_get_type)) return false; @@ -106,6 +107,10 @@ bool setupGtkBase(QLibrary &lib_gtk) { if (!load(lib_gtk, "g_slist_free", g_slist_free)) return false; DEBUG_LOG(("Library gtk functions loaded!")); + if (gdk_set_allowed_backends != nullptr) { + gdk_set_allowed_backends("x11"); + } + if (!gtk_init_check(0, 0)) { gtk_init_check = nullptr; DEBUG_LOG(("Failed to gtk_init_check(0, 0)!")); @@ -128,6 +133,7 @@ bool setupAppIndicator(QLibrary &lib_indicator) { } // namespace +f_gdk_set_allowed_backends gdk_set_allowed_backends = nullptr; f_gtk_init_check gtk_init_check = nullptr; f_gtk_menu_new gtk_menu_new = nullptr; f_gtk_menu_get_type gtk_menu_get_type = nullptr; diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h index bc3dce6..07c5042 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.h +++ b/Telegram/SourceFiles/platform/linux/linux_libs.h @@ -52,6 +52,9 @@ bool load(QLibrary &lib, const char *name, Function &func) { return false; } +typedef void (*f_gdk_set_allowed_backends)(const gchar *backends); +extern f_gdk_set_allowed_backends gdk_set_allowed_backends; + typedef gboolean (*f_gtk_init_check)(int *argc, char ***argv); extern f_gtk_init_check gtk_init_check; diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp index f6609c1..76cd33b 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp @@ -78,19 +78,17 @@ ], 'defines': [ - 'AL_LIBTYPE_STATIC', ' /dev/null --libs xkbcommon xkbcommon-x11)', + ' /dev/null --libs harfbuzz)', + ' /dev/null --libs libpcre16)', + ' /dev/null --libs zlib)', + ' /dev/null --libs libpng16)', + 'jpeg', + ' /dev/null --libs libwebp)', + ' /dev/null --libs xcb-shm xcb-xfixes xcb-render xcb-renderutil xcb-sync xcb-randr xcb-xinerama xcb-xkb xcb-icccm xcb-image xcb-shape xcb-keysyms xcb-util)', + 'proxy', + 'GL', ], 'include_dirs': [ '<(qt_loc)/mkspecs/linux-g++', ], 'ldflags': [ - '-static-libstdc++', '-pthread', '-g', '-rdynamic', diff --git a/Telegram/gyp/qt.gypi.orig b/Telegram/gyp/qt.gypi.orig new file mode 100644 index 0000000..bb9b56b --- /dev/null +++ b/Telegram/gyp/qt.gypi.orig @@ -0,0 +1,261 @@ +# This file is part of Telegram Desktop, +# the official desktop version of Telegram messaging app, see https://telegram.org +# +# Telegram Desktop is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# It is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# In addition, as a special exception, the copyright holders give permission +# to link the code of portions of this program with the OpenSSL library. +# +# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +# Copyright (c) 2014 John Preston, https://desktop.telegram.org + +{ + 'variables': { + 'variables': { + 'variables': { + 'variables': { + 'variables': { + 'conditions': [ + [ 'build_macold', { + 'qt_version%': '5.3.2', + }, { + 'qt_version%': '5.6.2', + }] + ], + }, + 'qt_libs': [ + 'qwebp', + 'Qt5PrintSupport', + 'Qt5PlatformSupport', + 'Qt5Network', + 'Qt5Widgets', + 'Qt5Gui', + ], + 'qt_version%': '<(qt_version)', + 'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)', + }, + 'qt_version%': '<(qt_version)', + 'qt_loc_unix': '<(linux_path_qt)', + 'conditions': [ + [ 'build_win', { + 'qt_lib_prefix': '<(ld_lib_prefix)', + 'qt_lib_debug_postfix': 'd<(ld_lib_postfix)', + 'qt_lib_release_postfix': '<(ld_lib_postfix)', + 'qt_libs': [ + '<@(qt_libs)', + 'Qt5Core', + 'qtmain', + 'qwindows', + 'qtfreetype', + 'qtpcre', + ], + }], + [ 'build_mac', { + 'qt_lib_prefix': '<(ld_lib_prefix)', + 'qt_lib_debug_postfix': '_debug<(ld_lib_postfix)', + 'qt_lib_release_postfix': '<(ld_lib_postfix)', + 'qt_libs': [ + '<@(qt_libs)', + 'Qt5Core', + 'qgenericbearer', + 'qcocoa', + ], + }], + [ 'build_mac and not build_macold', { + 'qt_libs': [ + '<@(qt_libs)', + 'Qt5Core', + 'qtfreetype', + 'qtpcre', + ], + }], + [ 'build_linux', { + 'qt_lib_prefix': 'lib', + 'qt_lib_debug_postfix': '.a', + 'qt_lib_release_postfix': '.a', + 'qt_libs': [ + 'qxcb', + 'Qt5XcbQpa', + 'qconnmanbearer', + 'qgenericbearer', + 'qnmbearer', + '<@(qt_libs)', + 'Qt5DBus', + 'Qt5Core', + ], + }], + ], + }, + 'qt_version%': '<(qt_version)', + 'qt_loc_unix': '<(qt_loc_unix)', + 'qt_version_loc': ' /dev/null --libs xkbcommon xkbcommon-x11)', + ' /dev/null --libs harfbuzz)', + ' /dev/null --libs libpcre16)', + ' /dev/null --libs zlib)', + ' /dev/null --libs libpng16)', + ' /dev/null --libs libjpeg)', + ' /dev/null --libs libwebp)', + ' /dev/null --libs xcb-shm xcb-xfixes xcb-render xcb-renderutil xcb-sync xcb-randr xcb-xinerama xcb-xkb xcb-icccm xcb-image xcb-shape xcb-keysyms xcb-util)', + 'proxy', + 'GL', + ], + 'include_dirs': [ + '<(qt_loc)/mkspecs/linux-g++', + ], + 'ldflags': [ + '-pthread', + '-g', + '-rdynamic', + ], + }], + ], + + 'rules': [{ + 'rule_name': 'qt_moc', + 'extension': 'h', + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp', + ], + 'action': [ + '<(qt_loc)/bin/moc<(exe_ext)', + + # Silence "Note: No relevant classes found. No output generated." + '--no-notes', + + ' createPlatformIntegration -> QXcbIntegrationPlugin::create - #'xkbcommon', + 'liblzma', + 'openal', + 'libavformat', + 'libavcodec', + 'libswresample', + 'libswscale', + 'libavutil', + 'opus', + 'libva-x11', + 'libva-drm', + 'libva', + 'libdrm', + 'zlib', + 'glib-2.0', ], 'linux_path_ffmpeg%': '/usr/local', 'linux_path_openal%': '/usr/local', @@ -34,44 +43,26 @@ 'linux_path_breakpad%': '<(libs_loc)/breakpad', }, 'include_dirs': [ - '/usr/local/include', - '<(linux_path_ffmpeg)/include', - '<(linux_path_openal)/include', '<(linux_path_breakpad)/include/breakpad', + '/usr/include', ], 'library_dirs': [ - '/usr/local/lib', - '<(linux_path_ffmpeg)/lib', - '<(linux_path_openal)/lib', - '<(linux_path_libexif_lib)', - '<(linux_path_va)/lib', - '<(linux_path_breakpad)/lib', + '<(linux_path_breakpad)/src/client/linux', + '/usr/lib', ], 'libraries': [ - 'breakpad_client', 'composeplatforminputcontextplugin', 'ibusplatforminputcontextplugin', 'fcitxplatforminputcontextplugin', - 'liblzma.a', - 'libopenal.a', - 'libavformat.a', - 'libavcodec.a', - 'libswresample.a', - 'libswscale.a', - 'libavutil.a', - 'libopus.a', - 'libva-x11.a', - 'libva-drm.a', - 'libva.a', - 'libdrm.a', - 'libz.a', -# ' /dev/null --libs <@(pkgconfig_libs))', + ' /dev/null --libs <@(pkgconfig_libs))', + 'libbreakpad_client.a', ], 'cflags_cc': [ ' /dev/null --cflags appindicator-0.1)', ' /dev/null --cflags gtk+-2.0)', ' /dev/null --cflags glib-2.0)', ' /dev/null --cflags dee-1.0)', + ' /dev/null --cflags <@(pkgconfig_libs))', ], 'configurations': { 'Release': {