Last active
October 2, 2017 09:21
-
-
Save a-andreyev/8327e3d2c85054b23983e1167bbd0855 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8bfe4076109f3f6b31cacb5262dd5c282cccb639 Mon Sep 17 00:00:00 2001 | |
From: eegorov <[email protected]> | |
Date: Mon, 7 Aug 2017 17:57:34 +0600 | |
Subject: [PATCH] New build option: without GTK and appindicator Signed-off-by: | |
Egor Y. Egorov <[email protected]> (github: eegorov) | |
--- | |
.travis.yml | 1 + | |
.travis/build.sh | 4 +++ | |
.../platform/linux/file_utilities_linux.cpp | 10 ++++++ | |
.../platform/linux/file_utilities_linux.h | 4 +++ | |
.../platform/linux/linux_gdk_helper.cpp | 2 ++ | |
.../SourceFiles/platform/linux/linux_gdk_helper.h | 2 ++ | |
.../SourceFiles/platform/linux/linux_libnotify.cpp | 2 ++ | |
.../SourceFiles/platform/linux/linux_libnotify.h | 2 ++ | |
Telegram/SourceFiles/platform/linux/linux_libs.cpp | 6 ++++ | |
Telegram/SourceFiles/platform/linux/linux_libs.h | 4 +++ | |
.../platform/linux/main_window_linux.cpp | 42 +++++++++++++++++++--- | |
.../platform/linux/notifications_manager_linux.cpp | 14 ++++++++ | |
Telegram/gyp/telegram_linux.gypi | 15 ++++---- | |
13 files changed, 98 insertions(+), 11 deletions(-) | |
diff --git a/.travis.yml b/.travis.yml | |
index a7148c314..03710c3da 100644 | |
--- a/.travis.yml | |
+++ b/.travis.yml | |
@@ -16,6 +16,7 @@ env: | |
- BUILD_VERSION="disable_network_proxy" | |
- BUILD_VERSION="disable_desktop_file_generation" | |
- BUILD_VERSION="disable_unity_integration" | |
+ - BUILD_VERSION="disable_gtk_integration" | |
matrix: | |
fast_finish: true | |
diff --git a/.travis/build.sh b/.travis/build.sh | |
index 749c4e12f..506f8d4bb 100755 | |
--- a/.travis/build.sh | |
+++ b/.travis/build.sh | |
@@ -118,6 +118,10 @@ build() { | |
GYP_DEFINES+=",TDESKTOP_DISABLE_UNITY_INTEGRATION" | |
fi | |
+ if [[ $BUILD_VERSION == *"disable_gtk_integration"* ]]; then | |
+ GYP_DEFINES+=",TDESKTOP_DISABLE_GTK_INTEGRATION" | |
+ fi | |
+ | |
info_msg "Build defines: ${GYP_DEFINES}" | |
buildTelegram | |
diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp | |
index 99f32dc66..f847f3141 100644 | |
--- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp | |
+++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp | |
@@ -95,6 +95,7 @@ void UnsafeShowInFolder(const QString &filepath) { | |
namespace FileDialog { | |
namespace { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
// GTK file chooser image preview: thanks to Chromium | |
@@ -105,9 +106,11 @@ namespace { | |
// be preserved. | |
constexpr auto kPreviewWidth = 256; | |
constexpr auto kPreviewHeight = 512; | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
using Type = ::FileDialog::internal::Type; | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
bool NativeSupported() { | |
return Platform::internal::GdkHelperLoaded() | |
&& (Libs::gtk_widget_hide_on_delete != nullptr) | |
@@ -191,16 +194,20 @@ bool GetNative(QStringList &files, QByteArray &remoteContent, const QString &cap | |
remoteContent = QByteArray(); | |
return false; | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace | |
bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, Type type, QString startFile) { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (NativeSupported()) { | |
return GetNative(files, remoteContent, caption, filter, type, startFile); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
return ::FileDialog::internal::GetDefault(files, remoteContent, caption, filter, type, startFile); | |
} | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
namespace internal { | |
QGtkDialog::QGtkDialog(GtkWidget *gtkWidget) : gtkWidget(gtkWidget) { | |
@@ -302,6 +309,7 @@ void QGtkDialog::onParentWindowDestroyed() { | |
// The Gtk*DialogHelper classes own this object. Make sure the parent doesn't delete it. | |
setParent(nullptr); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
namespace { | |
@@ -321,6 +329,7 @@ QStringList cleanFilterList(const QString &filter) { | |
} // namespace | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
GtkFileDialog::GtkFileDialog(QWidget *parent, const QString &caption, const QString &directory, const QString &filter) : QDialog(parent) | |
, _windowTitle(caption) | |
, _initialDirectory(directory) { | |
@@ -624,5 +633,6 @@ void GtkFileDialog::setNameFilters(const QStringList &filters) { | |
} | |
} // namespace internal | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace FileDialog | |
} // namespace Platform | |
diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.h b/Telegram/SourceFiles/platform/linux/file_utilities_linux.h | |
index 422c40cb9..16ca45a3e 100644 | |
--- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.h | |
+++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.h | |
@@ -24,8 +24,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org | |
extern "C" { | |
#undef signals | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
#include <gtk/gtk.h> | |
#include <gdk/gdk.h> | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
#define signals public | |
} // extern "C" | |
@@ -69,6 +71,7 @@ inline void InitLastPath() { | |
} | |
namespace internal { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
// This is a patched copy of qgtk2 theme plugin. | |
// We need to use our own gtk file dialog instead of | |
@@ -173,6 +176,7 @@ private slots: | |
QHash<GtkFileFilter*, QString> _filterNames; | |
QScopedPointer<QGtkDialog> d; | |
}; | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace internal | |
} // namespace FileDialog | |
diff --git a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp | |
index 596764439..82232fb76 100644 | |
--- a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp | |
+++ b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp | |
@@ -18,6 +18,7 @@ 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-2017 John Preston, https://desktop.telegram.org | |
*/ | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
#include "platform/linux/linux_gdk_helper.h" | |
#include "platform/linux/linux_libs.h" | |
@@ -111,3 +112,4 @@ void XSetTransientForHint(GdkWindow *window, quintptr winId) { | |
} // namespace internal | |
} // namespace Platform | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
diff --git a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.h b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.h | |
index d7ad478d6..3fcb72940 100644 | |
--- a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.h | |
+++ b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.h | |
@@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org | |
#include <QtCore/QObject> | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
extern "C" { | |
#undef signals | |
#include <gtk/gtk.h> | |
@@ -38,3 +39,4 @@ void XSetTransientForHint(GdkWindow *window, quintptr winId); | |
} // namespace internal | |
} // namespace Platform | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
diff --git a/Telegram/SourceFiles/platform/linux/linux_libnotify.cpp b/Telegram/SourceFiles/platform/linux/linux_libnotify.cpp | |
index 7d884d1e2..4f969d918 100644 | |
--- a/Telegram/SourceFiles/platform/linux/linux_libnotify.cpp | |
+++ b/Telegram/SourceFiles/platform/linux/linux_libnotify.cpp | |
@@ -44,6 +44,7 @@ bool loadLibrary(QLibrary &lib, const char *name, int version) { | |
} // namespace | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
f_notify_init notify_init = nullptr; | |
f_notify_uninit notify_uninit = nullptr; | |
f_notify_is_initted notify_is_initted = nullptr; | |
@@ -116,6 +117,7 @@ void startLibNotify() { | |
load(lib_notify, "notify_notification_close", notify_notification_close); | |
load(lib_notify, "notify_notification_get_closed_reason", notify_notification_get_closed_reason); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace Libs | |
} // namespace Platform | |
diff --git a/Telegram/SourceFiles/platform/linux/linux_libnotify.h b/Telegram/SourceFiles/platform/linux/linux_libnotify.h | |
index 1d4253612..c23f32432 100644 | |
--- a/Telegram/SourceFiles/platform/linux/linux_libnotify.h | |
+++ b/Telegram/SourceFiles/platform/linux/linux_libnotify.h | |
@@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org | |
*/ | |
#pragma once | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
extern "C" { | |
#undef signals | |
#include <gtk/gtk.h> | |
@@ -129,3 +130,4 @@ extern f_notify_notification_get_closed_reason notify_notification_get_closed_re | |
} // namespace Libs | |
} // namespace Platform | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp | |
index b6d18ae90..ae4b16376 100644 | |
--- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp | |
+++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp | |
@@ -44,6 +44,7 @@ bool loadLibrary(QLibrary &lib, const char *name, int version) { | |
return false; | |
} | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
bool setupGtkBase(QLibrary &lib_gtk) { | |
if (!load(lib_gtk, "gtk_init_check", gtk_init_check)) return false; | |
if (!load(lib_gtk, "gtk_menu_new", gtk_menu_new)) return false; | |
@@ -142,9 +143,11 @@ bool setupAppIndicator(QLibrary &lib_indicator) { | |
DEBUG_LOG(("Library appindicator functions loaded!")); | |
return true; | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
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; | |
@@ -235,9 +238,11 @@ f_unity_launcher_entry_set_count unity_launcher_entry_set_count = nullptr; | |
f_unity_launcher_entry_set_count_visible unity_launcher_entry_set_count_visible = nullptr; | |
f_unity_launcher_entry_get_for_desktop_id unity_launcher_entry_get_for_desktop_id = nullptr; | |
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
void start() { | |
DEBUG_LOG(("Loading libraries")); | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
bool gtkLoaded = false; | |
bool indicatorLoaded = false; | |
@@ -310,6 +315,7 @@ void start() { | |
if (gtkLoaded) { | |
startLibNotify(); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
} // namespace Libs | |
diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h | |
index a8bf969cd..e9e349be9 100644 | |
--- a/Telegram/SourceFiles/platform/linux/linux_libs.h | |
+++ b/Telegram/SourceFiles/platform/linux/linux_libs.h | |
@@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org | |
*/ | |
#pragma once | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
extern "C" { | |
#undef signals | |
#include <libappindicator/app-indicator.h> | |
@@ -31,6 +32,7 @@ extern "C" { | |
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION | |
#include <unity/unity/unity.h> | |
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
namespace Platform { | |
namespace Libs { | |
@@ -52,6 +54,7 @@ bool load(QLibrary &lib, const char *name, Function &func) { | |
return false; | |
} | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
typedef gboolean (*f_gtk_init_check)(int *argc, char ***argv); | |
extern f_gtk_init_check gtk_init_check; | |
@@ -381,6 +384,7 @@ extern f_unity_launcher_entry_set_count_visible unity_launcher_entry_set_count_v | |
typedef UnityLauncherEntry* (*f_unity_launcher_entry_get_for_desktop_id)(const gchar* desktop_id); | |
extern f_unity_launcher_entry_get_for_desktop_id unity_launcher_entry_get_for_desktop_id; | |
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace Libs | |
} // namespace Platform | |
diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp | |
index d3e3816f1..e7c40a699 100644 | |
--- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp | |
+++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp | |
@@ -36,18 +36,21 @@ namespace { | |
bool noQtTrayIcon = false, tryAppIndicator = false; | |
bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false; | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
AppIndicator *_trayIndicator = 0; | |
GtkStatusIcon *_trayIcon = 0; | |
GtkWidget *_trayMenu = 0; | |
GdkPixbuf *_trayPixbuf = 0; | |
QByteArray _trayPixbufData; | |
QList<QPair<GtkWidget*, QObject*> > _trayItems; | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
int32 _trayIconSize = 22; | |
bool _trayIconMuted = true; | |
int32 _trayIconCount = 0; | |
QImage _trayIconImageBack, _trayIconImage; | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
void _trayIconPopup(GtkStatusIcon *status_icon, guint button, guint32 activate_time, gpointer popup_menu) { | |
Libs::gtk_menu_popup(Libs::gtk_menu_cast(popup_menu), NULL, NULL, Libs::gtk_status_icon_position_menu, status_icon, button, activate_time); | |
} | |
@@ -65,16 +68,19 @@ gboolean _trayIconResized(GtkStatusIcon *status_icon, gint size, gpointer popup_ | |
if (Global::started()) Notify::unreadCounterUpdated(); | |
return FALSE; | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
#define QT_RED 0 | |
#define QT_GREEN 1 | |
#define QT_BLUE 2 | |
#define QT_ALPHA 3 | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
#define GTK_RED 2 | |
#define GTK_GREEN 1 | |
#define GTK_BLUE 0 | |
#define GTK_ALPHA 3 | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
QImage _trayIconImageGen() { | |
int32 counter = App::histories().unreadBadge(), counterSlice = (counter >= 1000) ? (1000 + (counter % 100)) : counter; | |
@@ -133,6 +139,7 @@ QString _trayIconImageFile() { | |
return QString(); | |
} | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
void loadPixbuf(QImage image) { | |
int w = image.width(), h = image.height(), perline = image.bytesPerLine(), s = image.byteCount(); | |
@@ -180,6 +187,7 @@ static gboolean _trayIconCheck(gpointer/* pIn*/) { | |
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION | |
UnityLauncherEntry *_psUnityLauncherEntry = nullptr; | |
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace | |
@@ -192,11 +200,17 @@ MainWindow::MainWindow() { | |
} | |
bool MainWindow::hasTrayIcon() const { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
return trayIcon || ((useAppIndicator || (useStatusIcon && trayIconChecked)) && (Global::WorkMode().value() != dbiwmWindowOnly)); | |
+#else | |
+ return trayIcon; | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
void MainWindow::psStatusIconCheck() { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
_trayIconCheck(0); | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (cSupportTray() || !--_psCheckStatusIconLeft) { | |
_psCheckStatusIconTimer.stop(); | |
return; | |
@@ -207,6 +221,7 @@ void MainWindow::psShowTrayMenu() { | |
} | |
void MainWindow::psTrayMenuUpdated() { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (noQtTrayIcon && (useAppIndicator || useStatusIcon)) { | |
const QList<QAction*> &actions = trayIconMenu->actions(); | |
if (_trayItems.isEmpty()) { | |
@@ -230,6 +245,7 @@ void MainWindow::psTrayMenuUpdated() { | |
} | |
} | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
void MainWindow::psSetupTrayIcon() { | |
@@ -273,11 +289,13 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) { | |
if (mode == dbiwmWindowOnly) { | |
if (noQtTrayIcon) { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (useAppIndicator) { | |
Libs::app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_PASSIVE); | |
} else if (useStatusIcon) { | |
Libs::gtk_status_icon_set_visible(_trayIcon, false); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} else { | |
if (trayIcon) { | |
trayIcon->setContextMenu(0); | |
@@ -287,11 +305,13 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) { | |
} | |
} else { | |
if (noQtTrayIcon) { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (useAppIndicator) { | |
Libs::app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE); | |
} else if (useStatusIcon) { | |
Libs::gtk_status_icon_set_visible(_trayIcon, true); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} else { | |
psSetupTrayIcon(); | |
} | |
@@ -299,6 +319,7 @@ void MainWindow::workmodeUpdated(DBIWorkMode mode) { | |
} | |
void MainWindow::psUpdateIndicator() { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
_psUpdateIndicatorTimer.stop(); | |
_psLastIndicatorUpdate = getms(); | |
QFileInfo iconFile(_trayIconImageFile()); | |
@@ -309,6 +330,7 @@ void MainWindow::psUpdateIndicator() { | |
} else { | |
useAppIndicator = false; | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
void MainWindow::unreadCounterChangedHook() { | |
@@ -321,7 +343,7 @@ void MainWindow::updateIconCounters() { | |
auto counter = App::histories().unreadBadge(); | |
-#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#if !defined(TDESKTOP_DISABLE_GTK_INTEGRATION) && !defined(TDESKTOP_DISABLE_UNITY_INTEGRATION) | |
if (_psUnityLauncherEntry) { | |
if (counter > 0) { | |
Libs::unity_launcher_entry_set_count(_psUnityLauncherEntry, (counter > 9999) ? 9999 : counter); | |
@@ -330,9 +352,10 @@ void MainWindow::updateIconCounters() { | |
Libs::unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, FALSE); | |
} | |
} | |
-#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION && !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
if (noQtTrayIcon) { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (useAppIndicator) { | |
if (getms() > _psLastIndicatorUpdate + 1000) { | |
psUpdateIndicator(); | |
@@ -349,6 +372,7 @@ void MainWindow::updateIconCounters() { | |
Libs::gtk_status_icon_set_from_pixbuf(_trayIcon, _trayPixbuf); | |
} | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} else if (trayIcon) { | |
QIcon icon; | |
QFileInfo iconFile(_trayIconImageFile()); | |
@@ -370,12 +394,15 @@ void MainWindow::updateIconCounters() { | |
void MainWindow::LibsLoaded() { | |
noQtTrayIcon = !DesktopEnvironment::TryQtTrayIcon(); | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
tryAppIndicator = DesktopEnvironment::PreferAppIndicatorTrayIcon(); | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
LOG(("Tray Icon: Try Qt = %1, Prefer appindicator = %2").arg(Logs::b(!noQtTrayIcon)).arg(Logs::b(tryAppIndicator))); | |
if (noQtTrayIcon) cSetSupportTray(false); | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
useGtkBase = (Libs::gtk_init_check != nullptr) | |
&& (Libs::gtk_menu_new != nullptr) | |
&& (Libs::gtk_menu_get_type != nullptr) | |
@@ -430,6 +457,7 @@ void MainWindow::LibsLoaded() { | |
DEBUG_LOG(("Unity count api loaded!")); | |
} | |
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
void MainWindow::psCreateTrayIcon() { | |
@@ -439,6 +467,7 @@ void MainWindow::psCreateTrayIcon() { | |
return; | |
} | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (useAppIndicator) { | |
DEBUG_LOG(("Trying to create AppIndicator")); | |
_trayMenu = Libs::gtk_menu_new(); | |
@@ -516,12 +545,13 @@ void MainWindow::psCreateTrayIcon() { | |
} else { | |
workmodeUpdated(Global::WorkMode().value()); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
void MainWindow::psFirstShow() { | |
psCreateTrayIcon(); | |
-#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#if !defined(TDESKTOP_DISABLE_GTK_INTEGRATION) && !defined(TDESKTOP_DISABLE_UNITY_INTEGRATION) | |
if (useUnityCount) { | |
_psUnityLauncherEntry = Libs::unity_launcher_entry_get_for_desktop_id("telegramdesktop.desktop"); | |
if (_psUnityLauncherEntry) { | |
@@ -537,7 +567,7 @@ void MainWindow::psFirstShow() { | |
} else { | |
LOG(("Not using Unity Launcher count.")); | |
} | |
-#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION && !TDESKTOP_DISABLE_GTK_INTEGRATION | |
psUpdateMargins(); | |
@@ -572,6 +602,7 @@ void MainWindow::psUpdateMargins() { | |
} | |
MainWindow::~MainWindow() { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (_trayIcon) { | |
Libs::g_object_unref(_trayIcon); | |
_trayIcon = nullptr; | |
@@ -594,7 +625,8 @@ MainWindow::~MainWindow() { | |
Libs::g_object_unref(_psUnityLauncherEntry); | |
_psUnityLauncherEntry = nullptr; | |
} | |
-#endif | |
+#endif // ! TDESKTOP_DISABLE_UNITY_INTEGRATION | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
} // namespace Platform | |
diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp | |
index 8c6af06b3..1bc0a146c 100644 | |
--- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp | |
+++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp | |
@@ -28,6 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org | |
namespace Platform { | |
namespace Notifications { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
namespace { | |
bool LibNotifyLoaded() { | |
@@ -269,8 +270,10 @@ QString GetServerName() { | |
auto LibNotifyServerName = QString(); | |
} // namespace | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
bool Supported() { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
static auto Checked = false; | |
if (!Checked) { | |
Checked = true; | |
@@ -278,23 +281,31 @@ bool Supported() { | |
} | |
return !LibNotifyServerName.isEmpty(); | |
+#else | |
+ return false; | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::System *system) { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (Global::NativeNotifications() && Supported()) { | |
return std::make_unique<Manager>(system); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
return nullptr; | |
} | |
void Finish() { | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
if (Libs::notify_is_initted && Libs::notify_uninit) { | |
if (Libs::notify_is_initted()) { | |
Libs::notify_uninit(); | |
} | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
class Manager::Private { | |
public: | |
using Type = Window::Notifications::CachedUserpics::Type; | |
@@ -347,7 +358,9 @@ class Manager::Private { | |
std::shared_ptr<Manager*> _guarded; | |
}; | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
+#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION | |
void Manager::Private::init(Manager *manager) { | |
_guarded = std::make_shared<Manager*>(manager); | |
@@ -543,6 +556,7 @@ void Manager::doClearAllFast() { | |
void Manager::doClearFromHistory(History *history) { | |
_private->clearFromHistory(history); | |
} | |
+#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION | |
} // namespace Notifications | |
} // namespace Platform | |
diff --git a/Telegram/gyp/telegram_linux.gypi b/Telegram/gyp/telegram_linux.gypi | |
index 2c464928f..721d4f6cd 100644 | |
--- a/Telegram/gyp/telegram_linux.gypi | |
+++ b/Telegram/gyp/telegram_linux.gypi | |
@@ -20,6 +20,7 @@ | |
{ | |
'conditions': [[ 'build_linux', { | |
'variables': { | |
+ 'not_need_gtk%': '<!(python -c "print(\'TDESKTOP_DISABLE_GTK_INTEGRATION\' in \'<(build_defines)\')")', | |
'pkgconfig_libs': [ | |
# In order to work libxkbcommon must be linked statically, | |
# PKGCONFIG links it like "-L/usr/local/lib -lxkbcommon" | |
@@ -73,12 +73,9 @@ | |
'libz.a', | |
# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))', | |
], | |
- 'cflags_cc': [ | |
- '<!(pkg-config 2> /dev/null --cflags appindicator-0.1)', | |
- '<!(pkg-config 2> /dev/null --cflags gtk+-2.0)', | |
- '<!(pkg-config 2> /dev/null --cflags glib-2.0)', | |
- '<!(pkg-config 2> /dev/null --cflags dee-1.0)', | |
- ], | |
+ 'cflags_cc': [ | |
+ '<!(pkg-config 2> /dev/null --cflags dee-1.0)', | |
+ ], | |
'configurations': { | |
'Release': { | |
'cflags': [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp | |
index 6cd942ec..d8ce29b9 100644 | |
--- a/Telegram/SourceFiles/main.cpp | |
+++ b/Telegram/SourceFiles/main.cpp | |
@@ -23,9 +23,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org | |
#include "storage/localstorage.h" | |
int main(int argc, char *argv[]) { | |
-#ifndef Q_OS_MAC // Retina display support is working fine, others are not. | |
+#if !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) | |
+ // Retina display support is working fine, others are not. | |
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true); | |
-#endif // Q_OS_MAC | |
+#endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0 | |
QCoreApplication::setApplicationName(qsl("TelegramDesktop")); | |
settingsParseArgs(argc, argv); | |
@@ -39,6 +40,11 @@ int main(int argc, char *argv[]) { | |
Logs::start(); // must be started before Platform is started | |
Platform::start(); // must be started before QApplication is created | |
+ // I don't know why path is not in QT_PLUGIN_PATH by default | |
+ QCoreApplication::addLibraryPath("/usr/lib/qt/plugins"); | |
+ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors | |
+ setenv("QT_STYLE_OVERRIDE", "qwerty", false); | |
+ | |
int result = 0; | |
{ | |
Application app(argc, argv); | |
diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h | |
index a8bf969c..75593540 100644 | |
--- a/Telegram/SourceFiles/platform/linux/linux_libs.h | |
+++ b/Telegram/SourceFiles/platform/linux/linux_libs.h | |
@@ -29,7 +29,7 @@ extern "C" { | |
} // extern "C" | |
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION | |
-#include <unity/unity/unity.h> | |
+typedef void UnityLauncherEntry; | |
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION | |
namespace Platform { | |
diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp | |
new file mode 100644 | |
index 00000000..4a722b8d | |
--- /dev/null | |
+++ b/Telegram/SourceFiles/qt_functions.cpp | |
@@ -0,0 +1,94 @@ | |
+/**************************************************************************** | |
+** | |
+** Copyright (C) 2015 The Qt Company Ltd. | |
+** Contact: http://www.qt.io/licensing/ | |
+** | |
+** This file contains some parts of the Qt Toolkit. | |
+** | |
+** $QT_BEGIN_LICENSE:LGPL21$ | |
+** Commercial License Usage | |
+** Licensees holding valid commercial Qt licenses may use this file in | |
+** accordance with the commercial license agreement provided with the | |
+** Software or, alternatively, in accordance with the terms contained in | |
+** a written agreement between you and The Qt Company. For licensing terms | |
+** and conditions see http://www.qt.io/terms-conditions. For further | |
+** information use the contact form at http://www.qt.io/contact-us. | |
+** | |
+** GNU Lesser General Public License Usage | |
+** Alternatively, this file may be used under the terms of the GNU Lesser | |
+** General Public License version 2.1 or version 3 as published by the Free | |
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and | |
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the | |
+** following information to ensure the GNU Lesser General Public License | |
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | |
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | |
+** | |
+** As a special exception, The Qt Company gives you certain additional | |
+** rights. These rights are described in The Qt Company LGPL Exception | |
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | |
+** | |
+** $QT_END_LICENSE$ | |
+** | |
+****************************************************************************/ | |
+ | |
+/* TODO: find a dynamic library with these symbols. */ | |
+ | |
+/* Debian maintainer: this function is taken from qfiledialog.cpp */ | |
+/* | |
+ Makes a list of filters from ;;-separated text. | |
+ Used by the mac and windows implementations | |
+*/ | |
+QStringList qt_make_filter_list(const QString &filter) | |
+{ | |
+ QString f(filter); | |
+ | |
+ if (f.isEmpty()) | |
+ return QStringList(); | |
+ | |
+ QString sep(QLatin1String(";;")); | |
+ int i = f.indexOf(sep, 0); | |
+ if (i == -1) { | |
+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) { | |
+ sep = QLatin1Char('\n'); | |
+ i = f.indexOf(sep, 0); | |
+ } | |
+ } | |
+ | |
+ return f.split(sep); | |
+} | |
+ | |
+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */ | |
+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) | |
+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), | |
+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) | |
+{ | |
+} | |
+ | |
+/* Debian maintainer: this method is also taken from qtextengine.cpp */ | |
+// Fix up flags and underlineStyle with given info | |
+void QTextItemInt::initWithScriptItem(const QScriptItem &si) | |
+{ | |
+ // explicitly initialize flags so that initFontAttributes can be called | |
+ // multiple times on the same TextItem | |
+ flags = 0; | |
+ if (si.analysis.bidiLevel %2) | |
+ flags |= QTextItem::RightToLeft; | |
+ ascent = si.ascent; | |
+ descent = si.descent; | |
+ | |
+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) { | |
+ underlineStyle = charFormat.underlineStyle(); | |
+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline) | |
+ || f->d->underline) { | |
+ underlineStyle = QTextCharFormat::SingleUnderline; | |
+ } | |
+ | |
+ // compat | |
+ if (underlineStyle == QTextCharFormat::SingleUnderline) | |
+ flags |= QTextItem::Underline; | |
+ | |
+ if (f->d->overline || charFormat.fontOverline()) | |
+ flags |= QTextItem::Overline; | |
+ if (f->d->strikeOut || charFormat.fontStrikeOut()) | |
+ flags |= QTextItem::StrikeOut; | |
+} | |
diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp | |
index b975c7a8..f2f876b3 100644 | |
--- a/Telegram/SourceFiles/qt_static_plugins.cpp | |
+++ b/Telegram/SourceFiles/qt_static_plugins.cpp | |
@@ -28,13 +28,4 @@ Q_IMPORT_PLUGIN(QWebpPlugin) | |
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) | |
Q_IMPORT_PLUGIN(QGenericEnginePlugin) | |
#elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC | |
-Q_IMPORT_PLUGIN(QWebpPlugin) | |
-Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) | |
-Q_IMPORT_PLUGIN(QConnmanEnginePlugin) | |
-Q_IMPORT_PLUGIN(QGenericEnginePlugin) | |
-Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) | |
-Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) | |
-Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) | |
-Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) | |
-Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) | |
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX | |
diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp | |
index d18a8ea5..2c58287e 100644 | |
--- a/Telegram/SourceFiles/ui/text/text.cpp | |
+++ b/Telegram/SourceFiles/ui/text/text.cpp | |
@@ -1689,11 +1689,11 @@ private: | |
if (item == -1) | |
return; | |
-#ifdef OS_MAC_OLD | |
+#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0) | |
auto end = _e->findItem(line.from + line.length - 1); | |
-#else // OS_MAC_OLD | |
+#else | |
auto end = _e->findItem(line.from + line.length - 1, item); | |
-#endif // OS_MAC_OLD | |
+#endif | |
auto blockIndex = _lineStartBlock; | |
auto currentBlock = _t->_blocks[blockIndex].get(); | |
diff --git a/Telegram/SourceFiles/ui/text/text_block.cpp b/Telegram/SourceFiles/ui/text/text_block.cpp | |
index f89644e1..35230cfc 100644 | |
--- a/Telegram/SourceFiles/ui/text/text_block.cpp | |
+++ b/Telegram/SourceFiles/ui/text/text_block.cpp | |
@@ -330,7 +330,7 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi | |
SignalHandlers::setCrashAnnotationRef("CrashString", &part); | |
QStackTextEngine engine(part, blockFont->f); | |
- QTextLayout layout(&engine); | |
+ QTextLayout layout(part, blockFont->f); | |
layout.beginLayout(); | |
layout.createLine(); | |
diff --git a/Telegram/SourceFiles/ui/twidget.cpp b/Telegram/SourceFiles/ui/twidget.cpp | |
index e9848ef2..dcee47ee 100644 | |
--- a/Telegram/SourceFiles/ui/twidget.cpp | |
+++ b/Telegram/SourceFiles/ui/twidget.cpp | |
@@ -191,9 +191,9 @@ void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton | |
, button | |
, QGuiApplication::mouseButtons() | button | |
, QGuiApplication::keyboardModifiers() | |
-#ifndef OS_MAC_OLD | |
+#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) | |
, Qt::MouseEventSynthesizedByApplication | |
-#endif // OS_MAC_OLD | |
+#endif | |
); | |
ev.setTimestamp(getms()); | |
QGuiApplication::sendEvent(windowHandle, &ev); | |
diff --git a/Telegram/gyp/PrecompiledHeader.cmake b/Telegram/gyp/PrecompiledHeader.cmake | |
index 5d6830e9..c3f08d3f 100644 | |
--- a/Telegram/gyp/PrecompiledHeader.cmake | |
+++ b/Telegram/gyp/PrecompiledHeader.cmake | |
@@ -112,7 +112,7 @@ function(add_precompiled_header _target _input) | |
set(_compiler_FLAGS "@${_pch_c_flags_file}") | |
add_custom_command( | |
OUTPUT "${_output_c}" | |
- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}" | |
+ COMMAND "${CMAKE_C_COMPILER}" "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}" | |
DEPENDS "${_pchfile}" "${_pch_c_flags_file}" | |
IMPLICIT_DEPENDS C "${_pch_header}" | |
COMMENT "Precompiling ${_name} for ${_target} (C)") | |
@@ -123,7 +123,7 @@ function(add_precompiled_header _target _input) | |
set(_compiler_FLAGS "@${_pch_cpp_flags_file}") | |
add_custom_command( | |
OUTPUT "${_output_cxx}" | |
- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}" | |
+ COMMAND "${CMAKE_CXX_COMPILER}" "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}" | |
DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}" | |
IMPLICIT_DEPENDS CXX "${_pch_header}" | |
COMMENT "Precompiling ${_name} for ${_target} (C++)") | |
diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp | |
index 0d1f38aa..06af0021 100644 | |
--- a/Telegram/gyp/Telegram.gyp | |
+++ b/Telegram/gyp/Telegram.gyp | |
@@ -80,12 +80,10 @@ | |
'codegen.gyp:codegen_numbers', | |
'codegen.gyp:codegen_style', | |
'tests/tests.gyp:tests', | |
- 'utils.gyp:Updater', | |
'../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip', | |
], | |
'defines': [ | |
- 'AL_LIBTYPE_STATIC', | |
'AL_ALEXT_PROTOTYPES', | |
'TGVOIP_USE_CXX11_LIB', | |
'<!@(python -c "for s in \'<(build_defines)\'.split(\',\'): print(s)")', | |
@@ -94,14 +92,7 @@ | |
'include_dirs': [ | |
'<(src_loc)', | |
'<(SHARED_INTERMEDIATE_DIR)', | |
- '<(libs_loc)/breakpad/src', | |
- '<(libs_loc)/lzma/C', | |
- '<(libs_loc)/libexif-0.6.20', | |
- '<(libs_loc)/zlib-1.2.8', | |
- '<(libs_loc)/ffmpeg', | |
- '<(libs_loc)/openal-soft/include', | |
- '<(libs_loc)/opus/include', | |
- '<(minizip_loc)', | |
+ '/usr/include/minizip', | |
'<(sp_media_key_tap_loc)', | |
'<(emoji_suggestions_loc)', | |
'<(submodules_loc)/GSL/include', | |
diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi | |
index 6032d066..fe92d853 100644 | |
--- a/Telegram/gyp/qt.gypi | |
+++ b/Telegram/gyp/qt.gypi | |
@@ -27,25 +27,21 @@ | |
[ 'build_macold', { | |
'qt_version%': '5.3.2', | |
}, { | |
- 'qt_version%': '5.6.2', | |
+ 'qt_version%': '5.9.1', | |
}] | |
], | |
}, | |
'qt_libs': [ | |
- 'qwebp', | |
- 'Qt5PrintSupport', | |
- 'Qt5PlatformSupport', | |
'Qt5Network', | |
'Qt5Widgets', | |
'Qt5Gui', | |
- 'qtharfbuzzng', | |
], | |
'qt_version%': '<(qt_version)', | |
'conditions': [ | |
[ 'build_macold', { | |
'linux_path_qt%': '/usr/local/macold/Qt-<(qt_version)', | |
}, { | |
- 'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)', | |
+ 'linux_path_qt%': '/usr/lib/qt', | |
}] | |
] | |
}, | |
@@ -85,32 +81,12 @@ | |
], | |
}], | |
[ 'build_linux', { | |
- 'qt_lib_prefix': 'lib', | |
- 'qt_lib_debug_postfix': '.a', | |
- 'qt_lib_release_postfix': '.a', | |
+ 'qt_lib_prefix': '', | |
+ 'qt_lib_debug_postfix': '', | |
+ 'qt_lib_release_postfix': '', | |
'qt_libs': [ | |
- 'qxcb', | |
- 'Qt5XcbQpa', | |
- 'qconnmanbearer', | |
- 'qgenericbearer', | |
- 'qnmbearer', | |
'<@(qt_libs)', | |
- 'Qt5DBus', | |
'Qt5Core', | |
- 'qtpcre', | |
- 'Xi', | |
- 'Xext', | |
- 'Xfixes', | |
- 'SM', | |
- 'ICE', | |
- 'fontconfig', | |
- 'expat', | |
- 'freetype', | |
- 'z', | |
- 'xcb-shm', | |
- 'xcb-xfixes', | |
- 'xcb-render', | |
- 'xcb-static', | |
], | |
}], | |
], | |
@@ -140,11 +116,6 @@ | |
# '<!@(python <(DEPTH)/list_sources.py [sources] <(qt_moc_list_sources_arg))' | |
# where [sources] contains all your source files | |
'qt_moc_list_sources_arg': '--moc-prefix SHARED_INTERMEDIATE_DIR/<(_target_name)/moc/moc_', | |
- | |
- 'linux_path_xkbcommon%': '/usr/local', | |
- 'linux_lib_ssl%': '/usr/local/ssl/lib/libssl.a', | |
- 'linux_lib_crypto%': '/usr/local/ssl/lib/libcrypto.a', | |
- 'linux_lib_icu%': '/usr/lib/libicutu.a /usr/lib/libicui18n.a /usr/lib/libicuuc.a /usr/lib/libicudata.a', | |
}, | |
'configurations': { | |
@@ -193,13 +164,13 @@ | |
}, | |
'include_dirs': [ | |
- '<(qt_loc)/include', | |
- '<(qt_loc)/include/QtCore', | |
- '<(qt_loc)/include/QtGui', | |
- '<(qt_loc)/include/QtCore/<(qt_version)', | |
- '<(qt_loc)/include/QtGui/<(qt_version)', | |
- '<(qt_loc)/include/QtCore/<(qt_version)/QtCore', | |
- '<(qt_loc)/include/QtGui/<(qt_version)/QtGui', | |
+ '/usr/include/qt', | |
+ '/usr/include/qt/QtCore', | |
+ '/usr/include/qt/QtGui', | |
+ '/usr/include/qt/QtCore/<(qt_version)', | |
+ '/usr/include/qt/QtGui/<(qt_version)', | |
+ '/usr/include/qt/QtCore/<(qt_version)/QtCore', | |
+ '/usr/include/qt/QtGui/<(qt_version)/QtGui', | |
], | |
'library_dirs': [ | |
'<(qt_loc)/lib', | |
@@ -220,11 +191,8 @@ | |
'<(qt_loc)/plugins/platforminputcontexts', | |
], | |
'libraries': [ | |
- '<(linux_path_xkbcommon)/lib/libxkbcommon.a', | |
'<@(qt_libs_release)', | |
- '<(linux_lib_ssl)', | |
- '<(linux_lib_crypto)', | |
- '<!@(python -c "for s in \'<(linux_lib_icu)\'.split(\' \'): print(s)")', | |
+ '-lcrypto', | |
'-lxcb', | |
'-lX11', | |
'-lX11-xcb', | |
@@ -238,7 +206,6 @@ | |
'<(qt_loc)/mkspecs/linux-g++', | |
], | |
'ldflags': [ | |
- '-static-libstdc++', | |
'-pthread', | |
'-g', | |
'-rdynamic', | |
@@ -260,7 +227,7 @@ | |
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp', | |
], | |
'action': [ | |
- '<(qt_loc)/bin/moc<(exe_ext)', | |
+ '/usr/bin/moc', | |
# Silence "Note: No relevant classes found. No output generated." | |
'--no-notes', | |
diff --git a/Telegram/gyp/qt_rcc.gypi b/Telegram/gyp/qt_rcc.gypi | |
index eebc6967..19a346fe 100644 | |
--- a/Telegram/gyp/qt_rcc.gypi | |
+++ b/Telegram/gyp/qt_rcc.gypi | |
@@ -28,7 +28,7 @@ | |
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp', | |
], | |
'action': [ | |
- '<(qt_loc)/bin/rcc<(exe_ext)', | |
+ '/usr/bin/rcc', | |
'-name', '<(RULE_INPUT_ROOT)', | |
'-no-compress', | |
'<(RULE_INPUT_PATH)', | |
diff --git a/Telegram/gyp/settings_linux.gypi b/Telegram/gyp/settings_linux.gypi | |
index fde88dcd..ca149b85 100644 | |
--- a/Telegram/gyp/settings_linux.gypi | |
+++ b/Telegram/gyp/settings_linux.gypi | |
@@ -25,7 +25,6 @@ | |
'-pipe', | |
'-g', | |
'-Wall', | |
- '-Werror', | |
'-W', | |
'-fPIC', | |
'-Wno-unused-variable', | |
@@ -61,7 +60,6 @@ | |
], | |
'defines': [ | |
'_REENTRANT', | |
- 'QT_STATICPLUGIN', | |
'QT_PLUGIN', | |
], | |
'cflags_c': [ | |
diff --git a/Telegram/gyp/telegram_linux.gypi b/Telegram/gyp/telegram_linux.gypi | |
index 2c464928..b505a67d 100644 | |
--- a/Telegram/gyp/telegram_linux.gypi | |
+++ b/Telegram/gyp/telegram_linux.gypi | |
@@ -33,9 +33,10 @@ | |
'linux_path_va%': '/usr/local', | |
'linux_path_vdpau%': '/usr/local', | |
'linux_path_breakpad%': '<(libs_loc)/breakpad', | |
- 'linux_path_opus_include%': '<(libs_loc)/opus/include', | |
+ 'linux_path_opus_include%': '/usr/include/opus', | |
}, | |
'include_dirs': [ | |
+ '/usr/include/openssl-1.0', | |
'/usr/local/include', | |
'<(linux_path_ffmpeg)/include', | |
'<(linux_path_openal)/include', | |
@@ -43,6 +44,7 @@ | |
'<(linux_path_opus_include)', | |
], | |
'library_dirs': [ | |
+ '/usr/lib/openssl-1.0', | |
'/usr/local/lib', | |
'<(linux_path_ffmpeg)/lib', | |
'<(linux_path_openal)/lib', | |
@@ -52,23 +52,13 @@ | |
'<(linux_path_breakpad)/lib', | |
], | |
'libraries': [ | |
- 'breakpad_client', | |
- 'composeplatforminputcontextplugin', | |
- 'ibusplatforminputcontextplugin', | |
- 'fcitxplatforminputcontextplugin', | |
- 'himeplatforminputcontextplugin', | |
- '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', | |
+ 'openal', | |
+ 'avformat', | |
+ 'avcodec', | |
+ 'swresample', | |
+ 'swscale', | |
+ 'avutil', | |
+ 'minizip', | |
+ 'opus', | |
+ 'z', | |
# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))', | |
diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt | |
index ef66965f..81852d10 100644 | |
--- a/Telegram/gyp/telegram_sources.txt | |
+++ b/Telegram/gyp/telegram_sources.txt | |
@@ -598,14 +598,7 @@ | |
<(emoji_suggestions_loc)/emoji_suggestions.cpp | |
<(emoji_suggestions_loc)/emoji_suggestions.h | |
-platforms: !win | |
-<(minizip_loc)/crypt.h | |
-<(minizip_loc)/ioapi.c | |
-<(minizip_loc)/ioapi.h | |
-<(minizip_loc)/zip.c | |
-<(minizip_loc)/zip.h | |
-<(minizip_loc)/unzip.c | |
-<(minizip_loc)/unzip.h | |
+<(src_loc)/qt_functions.cpp | |
platforms: mac | |
<(sp_media_key_tap_loc)/SPMediaKeyTap.m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment