diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 580cffe8..e807c43f 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -189,7 +189,7 @@ namespace { // is applied once for blocks list in a history and once for items list in the found block template int binarySearchBlocksOrItems(const T &list, int edge) { - auto start = 0, end = list.size(); + size_t start = 0, end = list.size(); while (end - start > 1) { auto middle = (start + end) / 2; auto top = list[middle]->y; diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp index 5b502039..45ad10cf 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 1ecae702..80b7e4f4 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/SourceFiles/stdafx.cpp b/Telegram/SourceFiles/stdafx.cpp index 3cc98b84..781ad18f 100644 --- a/Telegram/SourceFiles/stdafx.cpp +++ b/Telegram/SourceFiles/stdafx.cpp @@ -34,6 +34,7 @@ Q_IMPORT_PLUGIN(QGenericEnginePlugin) #elif defined Q_OS_LINUX // Q_OS_LINUX Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) Q_IMPORT_PLUGIN(QConnmanEnginePlugin) Q_IMPORT_PLUGIN(QGenericEnginePlugin) Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp index 2503f1e1..b0a61eb9 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp @@ -79,21 +79,18 @@ ], '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)', + ' /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)', + ' /dev/null --libs wayland-client wayland-cursor)', + 'proxy', + 'GL', ], 'include_dirs': [ '<(qt_loc)/mkspecs/linux-g++', ], 'ldflags': [ - '-static-libstdc++', '-pthread', '-g', '-rdynamic', diff --git a/Telegram/gyp/telegram_linux.gypi b/Telegram/gyp/telegram_linux.gypi index b42e7443..a2597725 100644 --- a/Telegram/gyp/telegram_linux.gypi +++ b/Telegram/gyp/telegram_linux.gypi @@ -21,11 +21,20 @@ 'conditions': [[ 'build_linux', { 'variables': { 'pkgconfig_libs': [ -# In order to work libxkbcommon must be linked statically, -# PKGCONFIG links it like "-L/usr/local/lib -lxkbcommon" -# which makes a dynamic link which leads to segfault in -# QApplication() -> createPlatformIntegration -> QXcbIntegrationPlugin::create - #'xkbcommon', + 'liblzma', + 'openal', + 'libavformat', + 'libavcodec', + 'libswresample', + 'libswscale', + 'libavutil', + 'opus', + 'libva-x11', + 'libva-drm', + 'libva', + 'vdpau', + 'libdrm', + 'zlib', ], 'linux_path_ffmpeg%': '/usr/local', 'linux_path_openal%': '/usr/local', @@ -35,46 +44,24 @@ '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_vdpau)/lib', - '<(linux_path_breakpad)/lib', + '/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', - 'libvdpau.a', - 'libdrm.a', - 'libz.a', -# ' /dev/null --libs <@(pkgconfig_libs))', + ' /dev/null --libs <@(pkgconfig_libs))', ], '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': {