Fix build on Linux.

This commit is contained in:
John Preston 2020-05-18 18:24:20 +04:00
parent 71040464c5
commit b703f4e555
5 changed files with 46 additions and 32 deletions

View file

@ -102,17 +102,17 @@ endif()
target_link_libraries(Telegram target_link_libraries(Telegram
PRIVATE PRIVATE
tdesktop::lib_tgvoip
tdesktop::lib_mtproto tdesktop::lib_mtproto
tdesktop::lib_scheme tdesktop::lib_scheme
tdesktop::lib_export tdesktop::lib_export
tdesktop::lib_tgvoip desktop-app::lib_webrtc
desktop-app::lib_base desktop-app::lib_base
desktop-app::lib_crl desktop-app::lib_crl
desktop-app::lib_ui desktop-app::lib_ui
desktop-app::lib_tl desktop-app::lib_tl
desktop-app::lib_storage desktop-app::lib_storage
desktop-app::lib_lottie desktop-app::lib_lottie
desktop-app::lib_webrtc
desktop-app::lib_qr desktop-app::lib_qr
desktop-app::lib_ffmpeg desktop-app::lib_ffmpeg
desktop-app::external_lz4 desktop-app::external_lz4
@ -1226,6 +1226,18 @@ elseif (APPLE)
) )
endif() endif()
endif() endif()
elseif (LINUX)
if (NOT TDESKTOP_DISABLE_GTK_INTEGRATION)
find_package(PkgConfig REQUIRED)
pkg_search_module(GTK REQUIRED gtk+-2.0 gtk+-3.0)
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
if (DESKTOP_APP_USE_PACKAGED)
find_library(X11_LIBRARY X11)
target_link_libraries(Telegram PRIVATE ${X11_LIBRARY})
endif()
endif()
endif() endif()
if (build_macstore) if (build_macstore)

View file

@ -66,6 +66,7 @@ public:
void sendPaths(); void sendPaths();
QImage iconWithCounter(int size, int count, style::color bg, style::color fg, bool smallIcon) override; QImage iconWithCounter(int size, int count, style::color bg, style::color fg, bool smallIcon) override;
void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) override;
bool contentOverlapped(const QRect &globalRect); bool contentOverlapped(const QRect &globalRect);
bool contentOverlapped(QWidget *w, QPaintEvent *e) { bool contentOverlapped(QWidget *w, QPaintEvent *e) {
@ -139,7 +140,6 @@ private:
QPixmap grabInner(); QPixmap grabInner();
void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) override;
QImage icon16, icon32, icon64, iconbig16, iconbig32, iconbig64; QImage icon16, icon32, icon64, iconbig16, iconbig32, iconbig64;
crl::time _lastTrayClickTime = 0; crl::time _lastTrayClickTime = 0;

View file

@ -197,34 +197,34 @@ QIcon TrayIconGen(int counter, bool muted) {
if (!qEnvironmentVariableIsSet(kDisableTrayCounter.utf8()) if (!qEnvironmentVariableIsSet(kDisableTrayCounter.utf8())
&& counter > 0) { && counter > 0) {
QPainter p(&iconImage); const auto &bg = muted
int32 layerSize = -16;
if (iconSize >= 48) {
layerSize = -32;
} else if (iconSize >= 36) {
layerSize = -24;
} else if (iconSize >= 32) {
layerSize = -20;
}
auto &bg = muted
? st::trayCounterBgMute ? st::trayCounterBgMute
: st::trayCounterBg; : st::trayCounterBg;
const auto &fg = st::trayCounterFg;
if (iconSize >= 22) {
auto layerSize = -16;
if (iconSize >= 48) {
layerSize = -32;
} else if (iconSize >= 36) {
layerSize = -24;
} else if (iconSize >= 32) {
layerSize = -20;
}
const auto layer = App::wnd()->iconWithCounter(
layerSize,
counter,
bg,
fg,
false);
auto &fg = st::trayCounterFg; QPainter p(&iconImage);
p.drawImage(
auto layer = App::wnd()->iconWithCounter( iconImage.width() - layer.width() - 1,
layerSize, iconImage.height() - layer.height() - 1,
counter, layer);
bg, } else {
fg, App::wnd()->placeSmallCounter(iconImage, 16, counter, bg, QPoint(), fg);
false); }
p.drawImage(
iconImage.width() - layer.width() - 1,
iconImage.height() - layer.height() - 1,
layer);
} }
result.addPixmap(App::pixmapFromImageInPlace( result.addPixmap(App::pixmapFromImageInPlace(

View file

@ -176,9 +176,8 @@ else()
target_link_libraries(lib_tgvoip target_link_libraries(lib_tgvoip
PRIVATE PRIVATE
desktop-app::external_openssl
desktop-app::external_opus
desktop-app::external_webrtc desktop-app::external_webrtc
desktop-app::external_opus
) )
if (LINUX) if (LINUX)

View file

@ -68,14 +68,14 @@ Go to ***BuildPath*** and run
git clone https://github.com/01org/libva.git git clone https://github.com/01org/libva.git
cd libva cd libva
./autogen.sh --enable-static CFLAGS=-fPIC CPPFLAGS=-fPIC LDFLAGS=-fPIC ./autogen.sh --enable-static
make $MAKE_THREADS_CNT make $MAKE_THREADS_CNT
sudo make install sudo make install
cd .. cd ..
git clone https://gitlab.freedesktop.org/vdpau/libvdpau.git --depth=1 -b libvdpau-1.2 git clone https://gitlab.freedesktop.org/vdpau/libvdpau.git --depth=1 -b libvdpau-1.2
cd libvdpau cd libvdpau
./autogen.sh --enable-static CFLAGS=-fPIC CPPFLAGS=-fPIC LDFLAGS=-fPIC ./autogen.sh --enable-static
make $MAKE_THREADS_CNT make $MAKE_THREADS_CNT
sudo make install sudo make install
cd .. cd ..
@ -85,6 +85,9 @@ Go to ***BuildPath*** and run
git checkout release/3.4 git checkout release/3.4
./configure \ ./configure \
--extra-cflags="-fPIC" \
--extra-cxxflags="-fPIC" \
--extra-ldflags="-fPIC" \
--disable-programs \ --disable-programs \
--disable-doc \ --disable-doc \
--disable-network \ --disable-network \