This commit is contained in:
John Preston 2015-01-16 18:50:41 +03:00
commit b3e01fb94f
3 changed files with 18 additions and 19 deletions

View File

@ -13,7 +13,6 @@ sed -i 's/\-lz/\/usr\/lib\/x86_64\-linux\-gnu\/libz\.a/g' Makefile
sed -i 's/\-lssl/\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a/g' Makefile sed -i 's/\-lssl/\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a/g' Makefile
sed -i 's/\-lcrypto/\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a/g' Makefile sed -i 's/\-lcrypto/\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a/g' Makefile
sed -i 's/\-lexif/\/usr\/lib\/x86_64\-linux\-gnu\/libexif\.a/g' Makefile sed -i 's/\-lexif/\/usr\/lib\/x86_64\-linux\-gnu\/libexif\.a/g' Makefile
sed -i 's/\-lglib\-2\.0/\/usr\/lib\/x86_64\-linux\-gnu\/libglib\-2\.0\.a/g' Makefile
sed -i 's/\-lopusfile/\/usr\/local\/lib\/libopusfile\.a/g' Makefile sed -i 's/\-lopusfile/\/usr\/local\/lib\/libopusfile\.a/g' Makefile
sed -i 's/\-lopus/\/usr\/local\/lib\/libopus\.a/g' Makefile sed -i 's/\-lopus/\/usr\/local\/lib\/libopus\.a/g' Makefile
sed -i 's/\-lopenal/\/usr\/local\/lib\/libopenal\.a/g' Makefile sed -i 's/\-lopenal/\/usr\/local\/lib\/libopenal\.a/g' Makefile

View File

@ -13,7 +13,6 @@ sed -i 's/\-lz/\/usr\/lib\/i386\-linux\-gnu\/libz\.a/g' Makefile
sed -i 's/\-lssl/\/usr\/lib\/i386\-linux\-gnu\/libssl\.a/g' Makefile sed -i 's/\-lssl/\/usr\/lib\/i386\-linux\-gnu\/libssl\.a/g' Makefile
sed -i 's/\-lcrypto/\/usr\/lib\/i386\-linux\-gnu\/libcrypto\.a/g' Makefile sed -i 's/\-lcrypto/\/usr\/lib\/i386\-linux\-gnu\/libcrypto\.a/g' Makefile
sed -i 's/\-lexif/\/usr\/lib\/i386\-linux\-gnu\/libexif\.a/g' Makefile sed -i 's/\-lexif/\/usr\/lib\/i386\-linux\-gnu\/libexif\.a/g' Makefile
sed -i 's/\-lglib\-2\.0/\/usr\/lib\/i386\-linux\-gnu\/libglib\-2\.0\.a/g' Makefile
sed -i 's/\-lopusfile/\/usr\/local\/lib\/libopusfile\.a/g' Makefile sed -i 's/\-lopusfile/\/usr\/local\/lib\/libopusfile\.a/g' Makefile
sed -i 's/\-lopus/\/usr\/local\/lib\/libopus\.a/g' Makefile sed -i 's/\-lopus/\/usr\/local\/lib\/libopus\.a/g' Makefile
sed -i 's/\-lopenal/\/usr\/local\/lib\/libopenal\.a/g' Makefile sed -i 's/\-lopenal/\/usr\/local\/lib\/libopenal\.a/g' Makefile

View File

@ -114,8 +114,8 @@ namespace {
typedef void (*f_app_indicator_set_menu)(AppIndicator *self, GtkMenu *menu); typedef void (*f_app_indicator_set_menu)(AppIndicator *self, GtkMenu *menu);
f_app_indicator_set_menu ps_app_indicator_set_menu = 0; f_app_indicator_set_menu ps_app_indicator_set_menu = 0;
typedef void (*f_app_indicator_set_icon)(AppIndicator *self, const gchar *icon_name); typedef void (*f_app_indicator_set_icon_full)(AppIndicator *self, const gchar *icon_name, const gchar *icon_desc);
f_app_indicator_set_icon ps_app_indicator_set_icon = 0; f_app_indicator_set_icon_full ps_app_indicator_set_icon_full = 0;
typedef gboolean (*f_gdk_init_check)(gint *argc, gchar ***argv); typedef gboolean (*f_gdk_init_check)(gint *argc, gchar ***argv);
f_gdk_init_check ps_gdk_init_check = 0; f_gdk_init_check ps_gdk_init_check = 0;
@ -192,10 +192,9 @@ namespace {
} }
gboolean _trayIconResized(GtkStatusIcon *status_icon, gint size, gpointer popup_menu) { gboolean _trayIconResized(GtkStatusIcon *status_icon, gint size, gpointer popup_menu) {
std::cerr << "New tray icon size: " << size << "\n"; _trayIconSize = size;
_trayIconSize = size - 2;
if (App::wnd()) App::wnd()->psUpdateCounter(); if (App::wnd()) App::wnd()->psUpdateCounter();
return TRUE; return FALSE;
} }
#if Q_BYTE_ORDER == Q_BIG_ENDIAN #if Q_BYTE_ORDER == Q_BIG_ENDIAN
@ -249,7 +248,7 @@ namespace {
layerSize = -20; layerSize = -20;
} }
QImage layer = App::wnd()->iconWithCounter(layerSize, counter, (muted ? st::counterMuteBG : st::counterBG), false); QImage layer = App::wnd()->iconWithCounter(layerSize, counter, (muted ? st::counterMuteBG : st::counterBG), false);
p.drawImage(_trayIconImage.width() - layer.width(), _trayIconImage.height() - layer.height(), layer); p.drawImage(_trayIconImage.width() - layer.width() - 1, _trayIconImage.height() - layer.height() - 1, layer);
} }
} }
return _trayIconImage; return _trayIconImage;
@ -365,7 +364,7 @@ namespace {
if (!loadFunction(lib_indicator, "app_indicator_new", ps_app_indicator_new)) return; if (!loadFunction(lib_indicator, "app_indicator_new", ps_app_indicator_new)) return;
if (!loadFunction(lib_indicator, "app_indicator_set_status", ps_app_indicator_set_status)) return; if (!loadFunction(lib_indicator, "app_indicator_set_status", ps_app_indicator_set_status)) return;
if (!loadFunction(lib_indicator, "app_indicator_set_menu", ps_app_indicator_set_menu)) return; if (!loadFunction(lib_indicator, "app_indicator_set_menu", ps_app_indicator_set_menu)) return;
if (!loadFunction(lib_indicator, "app_indicator_set_icon", ps_app_indicator_set_icon)) return; if (!loadFunction(lib_indicator, "app_indicator_set_icon_full", ps_app_indicator_set_icon_full)) return;
useAppIndicator = true; useAppIndicator = true;
} }
void setupUnity() { void setupUnity() {
@ -528,9 +527,13 @@ void PsMainWindow::psUpdateWorkmode() {
void PsMainWindow::psUpdateIndicator() { void PsMainWindow::psUpdateIndicator() {
_psUpdateIndicatorTimer.stop(); _psUpdateIndicatorTimer.stop();
_psLastIndicatorUpdate = getms(); _psLastIndicatorUpdate = getms();
QByteArray f = _trayIconImageFile().toUtf8(); QFileInfo f(_trayIconImageFile());
if (!f.isEmpty()) { if (f.exists()) {
ps_app_indicator_set_icon(_trayIndicator, f.constData()); QByteArray path = f.absoluteFilePath().toUtf8(), name = f.fileName().toUtf8();
name = name.mid(0, name.size() - 4);
ps_app_indicator_set_icon_full(_trayIndicator, path.constData(), name);
} else {
useAppIndicator = false;
} }
} }
@ -659,9 +662,6 @@ void PsMainWindow::psUpdatedPosition() {
void PsMainWindow::psStateChanged(Qt::WindowState state) { void PsMainWindow::psStateChanged(Qt::WindowState state) {
psUpdateSysMenu(state); psUpdateSysMenu(state);
psUpdateMargins(); psUpdateMargins();
// if (state == Qt::WindowMinimized && GetWindowLong(ps_hWnd, GWL_HWNDPARENT)) {
// App::wnd()->minimizeToTray();
// }
psSavePosition(state); psSavePosition(state);
} }
@ -670,11 +670,12 @@ void PsMainWindow::psCreateTrayIcon() {
if (ps_gtk_init_check(0, 0)) { if (ps_gtk_init_check(0, 0)) {
_trayMenu = ps_gtk_menu_new(); _trayMenu = ps_gtk_menu_new();
if (_trayMenu) { if (_trayMenu) {
QByteArray f = _trayIconImageFile().toUtf8(); QFileInfo f(_trayIconImageFile());
if (f.isEmpty()) { if (f.exists()) {
useAppIndicator = false; QByteArray path = f.absoluteFilePath().toUtf8();
_trayIndicator = ps_app_indicator_new("Telegram Desktop", path.constData(), APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
} else { } else {
_trayIndicator = ps_app_indicator_new("Telegram Desktop", f.constData(), APP_INDICATOR_CATEGORY_COMMUNICATIONS); useAppIndicator = false;
} }
} }
} }