Updated TDesktop sources to 2.8.11+b2c762e

This commit is contained in:
Eric Kotato 2021-07-20 06:59:26 +03:00
commit 2a88c662d8
63 changed files with 141 additions and 721 deletions

View file

@ -101,7 +101,10 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
if [ "${{ matrix.defines }}" == "DESKTOP_APP_DISABLE_DBUS_INTEGRATION" ]; then
DEFINE="$DEFINE -D DESKTOP_APP_DISABLE_GTK_INTEGRATION=ON"
DEFINE="$DEFINE -D DESKTOP_APP_DISABLE_GTK_INTEGRATION=ON -D DESKTOP_APP_DISABLE_WEBKITGTK=ON"
fi
if [ "${{ matrix.defines }}" == "DESKTOP_APP_DISABLE_GTK_INTEGRATION" ]; then
DEFINE="$DEFINE -D DESKTOP_APP_DISABLE_WEBKITGTK=ON"
fi
echo Define from matrix: $DEFINE
echo "ARTIFACT_NAME=Kotatogram_${{ matrix.defines }}" >> $GITHUB_ENV

View file

@ -113,25 +113,16 @@ if (LINUX)
endif()
if (NOT DESKTOP_APP_DISABLE_GTK_INTEGRATION)
target_link_libraries(Telegram PRIVATE rt)
find_package(PkgConfig REQUIRED)
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
target_link_libraries(Telegram PRIVATE PkgConfig::GTK3)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
target_include_directories(Telegram SYSTEM PRIVATE ${GTK_INCLUDE_DIRS})
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11)
target_link_libraries(Telegram PRIVATE PkgConfig::X11)
endif()
else()
pkg_check_modules(GTK REQUIRED gtk+-3.0)
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
target_link_libraries(Telegram PRIVATE X11)
endif()
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
target_link_libraries(Telegram PRIVATE X11)
endif()
target_link_libraries(Telegram PRIVATE rt)
endif()
endif()
@ -909,16 +900,12 @@ PRIVATE
platform/linux/linux_desktop_environment.h
platform/linux/linux_gdk_helper.cpp
platform/linux/linux_gdk_helper.h
platform/linux/linux_gsd_media_keys.cpp
platform/linux/linux_gsd_media_keys.h
platform/linux/linux_gtk_integration_dummy.cpp
platform/linux/linux_gtk_integration_p.h
platform/linux/linux_gtk_integration.cpp
platform/linux/linux_gtk_integration.h
platform/linux/linux_gtk_open_with_dialog.cpp
platform/linux/linux_gtk_open_with_dialog.h
platform/linux/linux_notification_service_watcher.cpp
platform/linux/linux_notification_service_watcher.h
platform/linux/linux_wayland_integration_dummy.cpp
platform/linux/linux_wayland_integration.cpp
platform/linux/linux_wayland_integration.h
@ -1214,12 +1201,6 @@ endif()
if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
remove_target_sources(Telegram ${src_loc}
platform/linux/linux_gsd_media_keys.cpp
platform/linux/linux_gsd_media_keys.h
platform/linux/linux_mpris_support.cpp
platform/linux/linux_mpris_support.h
platform/linux/linux_notification_service_watcher.cpp
platform/linux/linux_notification_service_watcher.h
platform/linux/linux_xdp_file_dialog.cpp
platform/linux/linux_xdp_file_dialog.h
platform/linux/linux_xdp_open_with_dialog.cpp

View file

@ -115,12 +115,12 @@ private:
const Rows::Row &rowBySelection(Selection selected) const;
std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
Selection selected);
const std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
[[maybe_unused]] const std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
Selection selected) const;
std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
not_null<Row*> row,
Selection selected);
const std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
[[maybe_unused]] const std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
not_null<const Row*> row,
Selection selected) const;
void addRipple(Selection selected, QPoint position);

View file

@ -129,9 +129,6 @@ private:
const QString &text,
rpl::producer<QString> about);
bool inviteLinkShown();
QString inviteLinkText();
not_null<PeerData*> _peer;
bool _linkOnly = false;
@ -308,15 +305,6 @@ QString Controller::getUsernameInput() {
return _controls.usernameInput->getLastText().trimmed();
}
QString Controller::inviteLinkText() {
if (const auto channel = _peer->asChannel()) {
return channel->inviteLink();
} else if (const auto chat = _peer->asChat()) {
return chat->inviteLink();
}
return QString();
}
object_ptr<Ui::RpWidget> Controller::createUsernameEdit() {
Expects(_wrap != nullptr);
@ -583,11 +571,6 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkBlock() {
return result;
}
bool Controller::inviteLinkShown() {
return !_controls.privacy
|| (_controls.privacy->value() == Privacy::NoUsername);
}
} // namespace
EditPeerTypeBox::EditPeerTypeBox(

View file

@ -830,7 +830,6 @@ void StickerSetBox::Inner::visibleTopBottomUpdated(
void StickerSetBox::Inner::setupLottie(int index) {
auto &element = _elements[index];
const auto document = element.document;
element.animated = ChatHelpers::LottieAnimationFromDocument(
getLottiePlayer(),

View file

@ -116,9 +116,7 @@ void Panel::replaceCall(not_null<Call*> call) {
void Panel::initWindow() {
window()->setAttribute(Qt::WA_OpaquePaintEvent);
window()->setAttribute(Qt::WA_NoSystemBackground);
window()->setWindowIcon(
QIcon(QPixmap::fromImage(Image::Empty()->original(), Qt::ColorOnly)));
window()->setTitle(u" "_q);
window()->setTitle(_user->name);
window()->setTitleStyle(st::callTitle);
window()->events(

View file

@ -335,7 +335,6 @@ void ChooseJoinAsProcess::start(
}, _request->lifetime);
const auto finish = [=](JoinInfo info) {
const auto peer = _request->peer;
const auto done = std::move(_request->done);
const auto box = _request->box;
_request = nullptr;

View file

@ -1171,21 +1171,6 @@ int Members::Controller::rowPaintStatusIcon(
: state.raisedHand
? st::groupCallMemberInactiveStatus->c
: iconColor;
const auto color = (state.speaking == 1. && !state.mutedByMe)
? st::groupCallMemberActiveStatus->c
: (state.speaking == 0.
? (state.active == 1.
? st::groupCallMemberNotJoinedStatus->c
: (state.active == 0.
? (state.muted == 1.
? (state.raisedHand
? st::groupCallMemberInactiveStatus->c
: st::groupCallMemberNotJoinedStatus->c)
: (state.muted == 0.
? st::groupCallMemberNotJoinedStatus->c
: other))
: other))
: other);
if (camera) {
st::groupCallNarrowCameraIcon.paint(p, x, y, outerWidth, other);
x += st::groupCallNarrowCameraIcon.width();

View file

@ -289,8 +289,6 @@ void Panel::chooseSourceStop() {
void Panel::initWindow() {
window()->setAttribute(Qt::WA_OpaquePaintEvent);
window()->setAttribute(Qt::WA_NoSystemBackground);
window()->setWindowIcon(
QIcon(QPixmap::fromImage(Image::Empty()->original(), Qt::ColorOnly)));
window()->setTitleStyle(st::groupCallTitle);
subscribeToPeerChanges();

View file

@ -1033,7 +1033,6 @@ void GifsListWidget::updateSelected() {
int row = -1, col = -1, sel = -1;
ClickHandlerPtr lnk;
ClickHandlerHost *lnkhost = nullptr;
HistoryView::CursorState cursor = HistoryView::CursorState::None;
if (sy >= 0) {
row = 0;
for (int rows = _rows.size(); row < rows; ++row) {
@ -1062,7 +1061,6 @@ void GifsListWidget::updateSelected() {
QPoint(sx, sy),
HistoryView::StateRequest());
lnk = result.link;
cursor = result.cursor;
lnkhost = inlineItems[col];
} else {
row = col = -1;

View file

@ -1884,7 +1884,6 @@ void StickersListWidget::ensureLottiePlayer(Set &set) {
void StickersListWidget::setupLottie(Set &set, int section, int index) {
auto &sticker = set.stickers[index];
const auto document = sticker.document;
ensureLottiePlayer(set);
// Document should be loaded already for the animation to be set up.

View file

@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/ui_integration.h"
#include "chat_helpers/emoji_keywords.h"
#include "chat_helpers/stickers_emoji_image_loader.h"
#include "base/platform/base_platform_url_scheme.h"
#include "base/platform/base_platform_last_input.h"
#include "base/platform/base_platform_info.h"
#include "platform/platform_specific.h"
@ -222,6 +223,7 @@ void Application::run() {
}
if (Local::oldSettingsVersion() < AppVersion) {
RegisterUrlScheme();
psNewVersion();
}
@ -1155,6 +1157,19 @@ void Application::startShortcuts() {
}, _lifetime);
}
void Application::RegisterUrlScheme() {
base::Platform::RegisterUrlScheme(base::Platform::UrlSchemeDescriptor{
.executable = cExeDir() + cExeName(),
.arguments = qsl("-workdir \"%1\"").arg(cWorkingDir()),
.protocol = qsl("tg"),
.protocolName = qsl("Telegram Link"),
.shortAppName = qsl("tdesktop"),
.longAppName = QCoreApplication::applicationName(),
.displayAppName = AppName.utf16(),
.displayAppDescription = AppName.utf16(),
});
}
bool IsAppLaunched() {
return (Application::Instance != nullptr);
}

View file

@ -293,6 +293,8 @@ public:
void setScreenIsLocked(bool locked);
bool screenIsLocked() const;
static void RegisterUrlScheme();
protected:
bool eventFilter(QObject *object, QEvent *event) override;

View file

@ -598,7 +598,6 @@ bool HandleEvent(not_null<QShortcutEvent*> event) {
void ToggleMediaShortcuts(bool toggled) {
Data.toggleMedia(toggled);
Platform::SetWatchingMediaKeys(toggled);
}
void ToggleSupportShortcuts(bool toggled) {

View file

@ -66,7 +66,7 @@ enum class Command {
JumpToDate,
};
constexpr auto kShowFolder = {
[[maybe_unused]] constexpr auto kShowFolder = {
Command::ShowAllChats,
Command::ShowFolder1,
Command::ShowFolder2,

View file

@ -98,25 +98,27 @@ QString FileExtension(const QString &filepath) {
return QString(last.base(), last - reversed.begin());
}
// bool IsValidMediaFile(const QString &filepath) {
// static const auto kExtensions = [] {
// const auto list = qsl("\
// 16svx 2sf 3g2 3gp 8svx aac aaf aif aifc aiff amr amv ape asf ast au aup \
// avchd avi brstm bwf cam cdda cust dat divx drc dsh dsf dts dtshd dtsma \
// dvr-ms dwd evo f4a f4b f4p f4v fla flac flr flv gif gifv gsf gsm gym iff \
// ifo it jam la ly m1v m2p m2ts m2v m4a m4p m4v mcf mid mk3d mka mks mkv mng \
// mov mp1 mp2 mp3 mp4 minipsf mod mpc mpe mpeg mpg mpv mscz mt2 mus mxf mxl \
// niff nsf nsv off ofr ofs ogg ogv opus ots pac ps psf psf2 psflib ptb qsf \
// qt ra raw rka rm rmj rmvb roq s3m shn sib sid smi smp sol spc spx ssf svi \
// swa swf tak ts tta txm usf vgm vob voc vox vqf wav webm wma wmv wrap wtv \
// wv xm xml ym yuv").split(' ');
// return base::flat_set<QString>(list.begin(), list.end());
// }();
#if 0
bool IsValidMediaFile(const QString &filepath) {
static const auto kExtensions = [] {
const auto list = qsl("\
16svx 2sf 3g2 3gp 8svx aac aaf aif aifc aiff amr amv ape asf ast au aup \
avchd avi brstm bwf cam cdda cust dat divx drc dsh dsf dts dtshd dtsma \
dvr-ms dwd evo f4a f4b f4p f4v fla flac flr flv gif gifv gsf gsm gym iff \
ifo it jam la ly m1v m2p m2ts m2v m4a m4p m4v mcf mid mk3d mka mks mkv mng \
mov mp1 mp2 mp3 mp4 minipsf mod mpc mpe mpeg mpg mpv mscz mt2 mus mxf mxl \
niff nsf nsv off ofr ofs ogg ogv opus ots pac ps psf psf2 psflib ptb qsf \
qt ra raw rka rm rmj rmvb roq s3m shn sib sid smi smp sol spc spx ssf svi \
swa swf tak ts tta txm usf vgm vob voc vox vqf wav webm wma wmv wrap wtv \
wv xm xml ym yuv").split(' ');
return base::flat_set<QString>(list.begin(), list.end());
}();
// return ranges::binary_search(
// kExtensions,
// FileExtension(filepath).toLower());
// }
return ranges::binary_search(
kExtensions,
FileExtension(filepath).toLower());
}
#endif
bool IsExecutableName(const QString &filepath) {
static const auto kExtensions = [] {

View file

@ -1279,14 +1279,12 @@ bool InnerWidget::pinnedShiftAnimationCallback(crl::time now) {
now += st::stickersRowDuration;
}
auto wasAnimating = false;
auto animating = false;
auto updateMin = -1;
auto updateMax = 0;
for (auto i = 0, l = static_cast<int>(_pinnedRows.size()); i != l; ++i) {
auto start = _pinnedRows[i].animStartTime;
if (start) {
wasAnimating = true;
if (updateMin < 0) updateMin = i;
updateMax = i;
if (start + st::stickersRowDuration > now && now >= start) {

View file

@ -32,7 +32,6 @@ public:
return _check->checked();
}
rpl::producer<bool> checkedChanges() const;
rpl::producer<bool> checkedValue() const;
enum class NotifyAboutChange {
Notify,
@ -42,8 +41,6 @@ public:
bool checked,
NotifyAboutChange notify = NotifyAboutChange::Notify);
void finishAnimating();
QMargins getMargins() const override {
return _st.margin;
}
@ -90,10 +87,6 @@ rpl::producer<bool> UserCheckbox::checkedChanges() const {
return _checkedChanges.events();
}
rpl::producer<bool> UserCheckbox::checkedValue() const {
return _checkedChanges.events_starting_with(checked());
}
void UserCheckbox::setChecked(bool checked, NotifyAboutChange notify) {
if (_check->checked() != checked) {
_check->setChecked(checked, anim::type::normal);
@ -133,10 +126,6 @@ void UserCheckbox::paintEvent(QPaintEvent *e) {
p.drawTextLeft(statusLeft, statusTop, width(), _statusText);
}
void UserCheckbox::finishAnimating() {
_check->finishAnimating();
}
int UserCheckbox::resizeGetHeight(int newWidth) {
return st::contactsPhotoSize;
}

View file

@ -1688,7 +1688,7 @@ void InnerWidget::updateSelected() {
dragState = view->textState(itemPoint, request);
lnkhost = view;
if (!dragState.link && itemPoint.x() >= st::historyPhotoLeft && itemPoint.x() < st::historyPhotoLeft + st::msgPhotoSize) {
if (auto message = item->toHistoryMessage()) {
if (item->toHistoryMessage()) {
if (view->hasFromPhoto()) {
enumerateUserpics([&](not_null<Element*> view, int userpicTop) {
// stop enumeration if the userpic is below our point

View file

@ -2829,7 +2829,7 @@ void HistoryInner::mouseActionUpdate() {
_dragStateItem = session().data().message(dragState.itemId);
lnkhost = view;
if (!dragState.link && m.x() >= st::historyPhotoLeft && m.x() < st::historyPhotoLeft + st::msgPhotoSize) {
if (auto msg = item->toHistoryMessage()) {
if (item->toHistoryMessage()) {
if (view->hasFromPhoto()) {
enumerateUserpics([&](not_null<Element*> view, int userpicTop) -> bool {
// stop enumeration if the userpic is below our point

View file

@ -89,12 +89,11 @@ void Call::draw(Painter &p, const QRect &r, TextSelection selection, crl::time m
accumulate_min(paintw, maxWidth());
auto nameleft = 0, nametop = 0, nameright = 0, statustop = 0;
auto nameleft = 0, nametop = 0, statustop = 0;
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
nameleft = st::historyCallLeft;
nametop = st::historyCallTop - topMinus;
nameright = st::msgFileLayout.padding.left();
statustop = st::historyCallStatusTop - topMinus;
p.setFont(st::semiboldFont);

View file

@ -126,9 +126,9 @@ void InnerWidget::createTypeButtons() {
addMediaButton(Type::MusicFile, st::infoIconMediaAudio);
addMediaButton(Type::Link, st::infoIconMediaLink);
addMediaButton(Type::RoundVoiceFile, st::infoIconMediaVoice);
if (auto user = _controller->key().peer()->asUser()) {
// if (auto user = _controller->key().peer()->asUser()) {
// addCommonGroupsButton(user, st::infoIconMediaGroup);
}
// }
content->add(object_ptr<Ui::FixedHeightWidget>(
content,

View file

@ -616,7 +616,6 @@ ActionsFiller::ActionsFiller(
void ActionsFiller::addInviteToGroupAction(
not_null<UserData*> user) {
const auto controller = _controller;
AddActionButton(
_wrap,
tr::lng_profile_invite_to_group(),

View file

@ -198,7 +198,7 @@ ClickHandlerPtr ItemBase::getResultPreviewHandler() const {
_result->_content_url,
false);
} else if (const auto document = _result->_document
&& _result->_document->createMediaView()->canBePlayed()) {
; document->createMediaView()->canBePlayed()) {
return std::make_shared<OpenFileClickHandler>();
} else if (_result->_photo) {
return std::make_shared<OpenFileClickHandler>();

View file

@ -677,7 +677,6 @@ void Inner::updateSelected() {
int row = -1, col = -1, sel = -1;
ClickHandlerPtr lnk;
ClickHandlerHost *lnkhost = nullptr;
HistoryView::CursorState cursor = HistoryView::CursorState::None;
if (sy >= 0) {
row = 0;
for (int rows = _rows.size(); row < rows; ++row) {
@ -706,7 +705,6 @@ void Inner::updateSelected() {
QPoint(sx, sy),
HistoryView::StateRequest());
lnk = result.link;
cursor = result.cursor;
lnkhost = inlineItems[col];
} else {
row = col = -1;

View file

@ -478,12 +478,11 @@ void Widget::handleSongUpdate(const TrackState &state) {
}
void Widget::updateTimeText(const TrackState &state) {
qint64 position = 0, length = 0, display = 0;
qint64 display = 0;
const auto frequency = state.frequency;
const auto document = state.id.audio();
if (!IsStoppedOrStopping(state.state)) {
display = position = state.position;
length = state.length;
display = state.position;
} else if (state.length) {
display = state.length;
} else if (const auto song = document->song()) {

View file

@ -2439,7 +2439,7 @@ void OverlayWidget::displayDocument(
_docIconRect = QRect((width() - st::mediaviewFileIconSize) / 2, (height() - st::mediaviewFileIconSize) / 2, st::mediaviewFileIconSize, st::mediaviewFileIconSize);
int32 colorIndex = documentColorIndex(_document, _docExt);
_docIconColor = documentColor(colorIndex);
const style::icon *(thumbs[]) = { &st::mediaviewFileBlue, &st::mediaviewFileGreen, &st::mediaviewFileRed, &st::mediaviewFileYellow };
const style::icon *thumbs[] = { &st::mediaviewFileBlue, &st::mediaviewFileGreen, &st::mediaviewFileRed, &st::mediaviewFileYellow };
_docIcon = thumbs[colorIndex];
int32 extmaxw = (st::mediaviewFileIconSize - st::mediaviewFileExtPadding * 2);
@ -3433,7 +3433,7 @@ void OverlayWidget::paintThemePreviewContent(
width(),
st::themePreviewMargin.top());
}
if (const auto fillTitleRect = (titleRect.y() < 0)) {
if (titleRect.y() < 0) {
titleRect.moveTop(0);
fillOverlay(titleRect);
}
@ -3461,8 +3461,7 @@ void OverlayWidget::paintThemePreviewContent(
outer.y() + outer.height() - st::themePreviewMargin.bottom(),
outer.width(),
st::themePreviewMargin.bottom());
if (const auto fillButtonsRect
= (buttonsRect.y() + buttonsRect.height() > height())) {
if (buttonsRect.y() + buttonsRect.height() > height()) {
buttonsRect.moveTop(height() - buttonsRect.height());
fillOverlay(buttonsRect);
}

View file

@ -109,7 +109,6 @@ DcKeyBindState DcKeyBinder::handleResponse(const mtpBuffer &response) {
auto from = response.begin();
const auto end = from + response.size();
auto error = MTPRpcError();
auto result = MTPBool();
if (response[0] == mtpc_boolTrue) {
return DcKeyBindState::Success;
} else if (response[0] == mtpc_rpc_error && error.read(from, end)) {

View file

@ -314,10 +314,10 @@ auto ConcurrentSender::SpecificRequestBuilder<Request>::done(
Handler,
mtpRequestId,
Result>;
constexpr auto takesResponse = rpl::details::is_callable_plain_v<
[[maybe_unused]] constexpr auto takesResponse = rpl::details::is_callable_plain_v<
Handler,
Result>;
constexpr auto takesNone = rpl::details::is_callable_plain_v<Handler>;
[[maybe_unused]] constexpr auto takesNone = rpl::details::is_callable_plain_v<Handler>;
if constexpr (takesFull) {
setDoneHandler<Result>(std::forward<Handler>(handler));
@ -348,10 +348,10 @@ auto ConcurrentSender::SpecificRequestBuilder<Request>::fail(
Handler,
mtpRequestId,
Error>;
constexpr auto takesError = rpl::details::is_callable_plain_v<
[[maybe_unused]] constexpr auto takesError = rpl::details::is_callable_plain_v<
Handler,
Error>;
constexpr auto takesNone = rpl::details::is_callable_plain_v<Handler>;
[[maybe_unused]] constexpr auto takesNone = rpl::details::is_callable_plain_v<Handler>;
if constexpr (takesFull) {
setFailHandler(std::forward<Handler>(handler));

View file

@ -58,7 +58,7 @@ const BuiltInDc kBuiltInDcsIPv6Test[] = {
{ 3, "2001:0b28:f23d:f003:0000:0000:0000:000e", 443 }
};
const char *(kTestPublicRSAKeys[]) = { "\
const char *kTestPublicRSAKeys[] = { "\
-----BEGIN RSA PUBLIC KEY-----\n\
MIIBCgKCAQEAyMEdY1aR+sCR3ZSJrtztKTKqigvO/vBfqACJLZtS7QMgCGXJ6XIR\n\
yy7mx66W0/sOFa7/1mAZtEoIokDP3ShoqF4fVNb6XeqgQfaUHd8wJpDWHcR2OFwv\n\
@ -68,7 +68,7 @@ aHWfYmlEGepfaYR8Q0YqvvhYtMte3ITnuSJs171+GDqpdKcSwHnd6FudwGO4pcCO\n\
j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB\n\
-----END RSA PUBLIC KEY-----" };
const char *(kPublicRSAKeys[]) = { "\
const char *kPublicRSAKeys[] = { "\
-----BEGIN RSA PUBLIC KEY-----\n\
MIIBCgKCAQEA6LszBcC1LGzyr992NzE0ieY+BSaOW622Aa9Bd4ZHLl+TuFQ4lo4g\n\
5nKaMBwK/BIb9xUfg0Q29/2mgIR6Zr9krM7HjuIcCzFvDtr+L0GQjae9H0pRB2OO\n\

View file

@ -1,157 +0,0 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/linux/linux_gsd_media_keys.h"
#include "core/sandbox.h"
#include "media/player/media_player_instance.h"
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "base/platform/linux/base_linux_dbus_utilities.h"
#include <glibmm.h>
#include <giomm.h>
namespace Platform {
namespace internal {
namespace {
constexpr auto kService = "org.gnome.SettingsDaemon.MediaKeys"_cs;
constexpr auto kOldService = "org.gnome.SettingsDaemon"_cs;
constexpr auto kMATEService = "org.mate.SettingsDaemon"_cs;
constexpr auto kObjectPath = "/org/gnome/SettingsDaemon/MediaKeys"_cs;
constexpr auto kMATEObjectPath = "/org/mate/SettingsDaemon/MediaKeys"_cs;
constexpr auto kInterface = kService;
constexpr auto kMATEInterface = "org.mate.SettingsDaemon.MediaKeys"_cs;
void KeyPressed(
const Glib::RefPtr<Gio::DBus::Connection> &connection,
const Glib::ustring &sender_name,
const Glib::ustring &object_path,
const Glib::ustring &interface_name,
const Glib::ustring &signal_name,
const Glib::VariantContainerBase &parameters) {
try {
auto parametersCopy = parameters;
const auto app = base::Platform::GlibVariantCast<Glib::ustring>(
parametersCopy.get_child(0));
const auto key = base::Platform::GlibVariantCast<Glib::ustring>(
parametersCopy.get_child(1));
if (app != QCoreApplication::applicationName().toStdString()) {
return;
}
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
if (key == "Play") {
Media::Player::instance()->playPause();
} else if (key == "Stop") {
Media::Player::instance()->stop();
} else if (key == "Next") {
Media::Player::instance()->next();
} else if (key == "Previous") {
Media::Player::instance()->previous();
}
});
} catch (...) {
}
}
} // namespace
class GSDMediaKeys::Private {
public:
Glib::RefPtr<Gio::DBus::Connection> dbusConnection;
Glib::ustring service;
Glib::ustring objectPath;
Glib::ustring interface;
uint signalId = 0;
bool grabbed = false;
};
GSDMediaKeys::GSDMediaKeys()
: _private(std::make_unique<Private>()) {
try {
_private->dbusConnection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::BUS_TYPE_SESSION);
if (base::Platform::DBus::NameHasOwner(
_private->dbusConnection,
std::string(kService))) {
_private->service = std::string(kService);
_private->objectPath = std::string(kObjectPath);
_private->interface = std::string(kInterface);
} else if (base::Platform::DBus::NameHasOwner(
_private->dbusConnection,
std::string(kOldService))) {
_private->service = std::string(kOldService);
_private->objectPath = std::string(kObjectPath);
_private->interface = std::string(kInterface);
} else if (base::Platform::DBus::NameHasOwner(
_private->dbusConnection,
std::string(kMATEService))) {
_private->service = std::string(kMATEService);
_private->objectPath = std::string(kMATEObjectPath);
_private->interface = std::string(kMATEInterface);
} else {
return;
}
_private->dbusConnection->call_sync(
_private->objectPath,
_private->interface,
"GrabMediaPlayerKeys",
base::Platform::MakeGlibVariant(std::tuple{
Glib::ustring(
QCoreApplication::applicationName()
.toStdString()),
uint(0),
}),
_private->service);
_private->grabbed = true;
_private->signalId = _private->dbusConnection->signal_subscribe(
sigc::ptr_fun(KeyPressed),
_private->service,
_private->interface,
"MediaPlayerKeyPressed",
_private->objectPath);
} catch (...) {
}
}
GSDMediaKeys::~GSDMediaKeys() {
if (_private->dbusConnection) {
if (_private->signalId != 0) {
_private->dbusConnection->signal_unsubscribe(_private->signalId);
}
if (_private->grabbed) {
try {
_private->dbusConnection->call_sync(
_private->objectPath,
_private->interface,
"ReleaseMediaPlayerKeys",
base::Platform::MakeGlibVariant(std::tuple{
Glib::ustring(
QCoreApplication::applicationName()
.toStdString())
}),
_private->service);
_private->grabbed = false;
} catch (...) {
}
}
}
}
} // namespace internal
} // namespace Platform

View file

@ -1,30 +0,0 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
namespace Platform {
namespace internal {
class GSDMediaKeys {
public:
GSDMediaKeys();
GSDMediaKeys(const GSDMediaKeys &other) = delete;
GSDMediaKeys &operator=(const GSDMediaKeys &other) = delete;
GSDMediaKeys(GSDMediaKeys &&other) = delete;
GSDMediaKeys &operator=(GSDMediaKeys &&other) = delete;
~GSDMediaKeys();
private:
class Private;
const std::unique_ptr<Private> _private;
};
} // namespace internal
} // namespace Platform

View file

@ -16,7 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "base/platform/linux/base_linux_dbus_utilities.h"
#include "base/platform/base_platform_info.h"
#include "webview/platform/linux/webview_linux_webkit2gtk.h"
#include "platform/linux/linux_gtk_integration_p.h"
#include "platform/linux/linux_gdk_helper.h"
#include "platform/linux/linux_gtk_open_with_dialog.h"
@ -24,6 +23,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h"
#include "core/application.h"
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
#include "webview/platform/linux/webview_linux_webkit2gtk.h"
#endif // !DESKTOP_APP_DISABLE_WEBKITGTK
#include <QtCore/QProcess>
#include <private/qguiapplication_p.h>
@ -173,6 +176,7 @@ void GtkIntegration::Private::handleMethodCall(
"Access denied.");
invocation->return_error(error);
return;
}
try {
@ -587,9 +591,11 @@ int GtkIntegration::Exec(
if (const auto integration = BaseGtkIntegration::Instance()) {
return integration->exec(parentDBusName);
}
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
} else if (type == Type::Webview) {
Webview::WebKit2Gtk::SetServiceName(serviceName.toStdString());
return Webview::WebKit2Gtk::Exec(parentDBusName.toStdString());
#endif // !DESKTOP_APP_DISABLE_WEBKITGTK
} else if (type == Type::TDesktop) {
ServiceName = serviceName.toStdString();
if (const auto integration = Instance()) {
@ -614,8 +620,10 @@ void GtkIntegration::Start(Type type) {
if (type == Type::Base) {
BaseGtkIntegration::SetServiceName(kBaseService.utf16().arg(h));
} else if (type == Type::Webview) {
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
Webview::WebKit2Gtk::SetServiceName(
kWebviewService.utf16().arg(h).arg("%1").toStdString());
#endif // !DESKTOP_APP_DISABLE_WEBKITGTK
return;
} else {

View file

@ -1,84 +0,0 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/linux/linux_notification_service_watcher.h"
#include "core/application.h"
#include "main/main_domain.h"
#include "window/notifications_manager.h"
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "base/platform/linux/base_linux_dbus_utilities.h"
#include <glibmm.h>
#include <giomm.h>
namespace Platform {
namespace internal {
namespace {
constexpr auto kService = "org.freedesktop.Notifications"_cs;
auto Activatable() {
static const auto Result = []() -> std::optional<bool> {
try {
const auto connection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::BUS_TYPE_SESSION);
return ranges::contains(
base::Platform::DBus::ListActivatableNames(connection),
Glib::ustring(std::string(kService)));
} catch (...) {
}
return std::nullopt;
}();
return Result;
}
} // namespace
class NotificationServiceWatcher::Private {
public:
Glib::RefPtr<Gio::DBus::Connection> dbusConnection;
uint signalId = 0;
};
NotificationServiceWatcher::NotificationServiceWatcher()
: _private(std::make_unique<Private>()) {
try {
_private->dbusConnection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::BUS_TYPE_SESSION);
_private->signalId = base::Platform::DBus::RegisterServiceWatcher(
_private->dbusConnection,
std::string(kService),
[](
const Glib::ustring &service,
const Glib::ustring &oldOwner,
const Glib::ustring &newOwner) {
if (!Core::App().domain().started()
|| (Activatable().value_or(true) && newOwner.empty())) {
return;
}
crl::on_main([] {
Core::App().notifications().createManager();
});
});
} catch (...) {
}
}
NotificationServiceWatcher::~NotificationServiceWatcher() {
if (_private->dbusConnection && _private->signalId != 0) {
_private->dbusConnection->signal_unsubscribe(_private->signalId);
}
}
} // namespace internal
} // namespace Platform

View file

@ -1,24 +0,0 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
namespace Platform {
namespace internal {
class NotificationServiceWatcher {
public:
NotificationServiceWatcher();
~NotificationServiceWatcher();
private:
class Private;
const std::unique_ptr<Private> _private;
};
} // namespace internal
} // namespace Platform

View file

@ -176,20 +176,14 @@ public:
}
}
bool defaultNameFilterDisables() const;
QUrl directory() const;
void setDirectory(const QUrl &directory);
void selectFile(const QUrl &filename);
QList<QUrl> selectedFiles() const;
void setFilter();
void selectNameFilter(const QString &filter);
QString selectedNameFilter() const;
void selectMimeTypeFilter(const QString &filter);
QString selectedMimeTypeFilter() const;
int exec() override;
bool failedToOpen() {
bool failedToOpen() const {
return _failedToOpen;
}
@ -517,10 +511,6 @@ void XDPFileDialog::openPortal() {
}
}
bool XDPFileDialog::defaultNameFilterDisables() const {
return false;
}
void XDPFileDialog::setDirectory(const QUrl &directory) {
_directory = directory.path().toStdString();
}
@ -544,23 +534,6 @@ QList<QUrl> XDPFileDialog::selectedFiles() const {
return files;
}
void XDPFileDialog::setFilter() {
}
void XDPFileDialog::selectMimeTypeFilter(const QString &filter) {
}
QString XDPFileDialog::selectedMimeTypeFilter() const {
return QString::fromStdString(_selectedMimeTypeFilter);
}
void XDPFileDialog::selectNameFilter(const QString &filter) {
}
QString XDPFileDialog::selectedNameFilter() const {
return QString::fromStdString(_selectedNameFilter);
}
int XDPFileDialog::exec() {
setAttribute(Qt::WA_DeleteOnClose, false);

View file

@ -49,6 +49,43 @@ bool InhibitionSupported = false;
std::optional<ServerInformation> CurrentServerInformation;
QStringList CurrentCapabilities;
std::unique_ptr<base::Platform::DBus::ServiceWatcher> CreateServiceWatcher() {
try {
const auto connection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::BUS_TYPE_SESSION);
const auto activatable = [&] {
try {
return ranges::contains(
base::Platform::DBus::ListActivatableNames(connection),
Glib::ustring(std::string(kService)));
} catch (...) {
// avoid service restart loop in sandboxed environments
return true;
}
}();
return std::make_unique<base::Platform::DBus::ServiceWatcher>(
connection,
std::string(kService),
[=](
const Glib::ustring &service,
const Glib::ustring &oldOwner,
const Glib::ustring &newOwner) {
if (activatable && newOwner.empty()) {
return;
}
crl::on_main([] {
Core::App().notifications().createManager();
});
});
} catch (...) {
}
return nullptr;
}
void StartServiceAsync(Fn<void()> callback) {
try {
const auto connection = Gio::DBus::Connection::get_sync(
@ -632,13 +669,17 @@ void NotificationData::close() {
}
void NotificationData::setImage(const QString &imagePath) {
if (_imageKey.empty()) {
if (imagePath.isEmpty() || _imageKey.empty()) {
return;
}
const auto image = QImage(imagePath)
.convertToFormat(QImage::Format_RGBA8888);
if (image.isNull()) {
return;
}
_hints[_imageKey] = MakeGlibVariant(std::tuple{
image.width(),
image.height(),
@ -712,6 +753,8 @@ bool ByDefault() {
}
void Create(Window::Notifications::System *system) {
static const auto ServiceWatcher = CreateServiceWatcher();
const auto managerSetter = [=] {
using ManagerType = Window::Notifications::ManagerType;
if ((Core::App().settings().nativeNotifications() && Supported())

View file

@ -27,9 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "base/platform/linux/base_linux_dbus_utilities.h"
#include "base/platform/linux/base_linux_xdp_utilities.h"
#include "platform/linux/linux_notification_service_watcher.h"
#include "platform/linux/linux_xdp_file_dialog.h"
#include "platform/linux/linux_gsd_media_keys.h"
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
@ -44,8 +42,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QWindow>
#include <private/qguiapplication_p.h>
#include <glib.h>
#include <gio/gio.h>
#include <glibmm.h>
#include <giomm.h>
#include <jemalloc/jemalloc.h>
@ -72,20 +68,13 @@ namespace {
constexpr auto kDesktopFile = ":/misc/kotatogramdesktop.desktop"_cs;
constexpr auto kIconName = "kotatogram"_cs;
constexpr auto kHandlerTypeName = "x-scheme-handler/tg"_cs;
constexpr auto kDarkColorLimit = 192;
constexpr auto kXDGDesktopPortalService = "org.freedesktop.portal.Desktop"_cs;
constexpr auto kXDGDesktopPortalObjectPath = "/org/freedesktop/portal/desktop"_cs;
constexpr auto kIBusPortalService = "org.freedesktop.portal.IBus"_cs;
constexpr auto kSnapcraftSettingsService = "io.snapcraft.Settings"_cs;
constexpr auto kSnapcraftSettingsObjectPath = "/io/snapcraft/Settings"_cs;
constexpr auto kSnapcraftSettingsInterface = kSnapcraftSettingsService;
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
std::unique_ptr<internal::NotificationServiceWatcher> NSWInstance;
void PortalAutostart(bool start, bool silent) {
if (cExeName().isEmpty()) {
return;
@ -213,67 +202,6 @@ void PortalAutostart(bool start, bool silent) {
}
}
void SnapDefaultHandler(const QString &protocol) {
try {
const auto connection = Gio::DBus::Connection::get_sync(
Gio::DBus::BusType::BUS_TYPE_SESSION);
auto reply = connection->call_sync(
std::string(kSnapcraftSettingsObjectPath),
std::string(kSnapcraftSettingsInterface),
"GetSub",
base::Platform::MakeGlibVariant(std::tuple{
Glib::ustring("default-url-scheme-handler"),
Glib::ustring(protocol.toStdString()),
}),
std::string(kSnapcraftSettingsService));
const auto currentHandler = base::Platform::GlibVariantCast<
Glib::ustring>(reply.get_child(0));
const auto expectedHandler = qEnvironmentVariable("SNAP_NAME")
+ qsl(".desktop");
if (currentHandler == expectedHandler.toStdString()) {
return;
}
const auto context = Glib::MainContext::create();
const auto loop = Glib::MainLoop::create(context);
g_main_context_push_thread_default(context->gobj());
connection->call(
std::string(kSnapcraftSettingsObjectPath),
std::string(kSnapcraftSettingsInterface),
"SetSub",
base::Platform::MakeGlibVariant(std::tuple{
Glib::ustring("default-url-scheme-handler"),
Glib::ustring(protocol.toStdString()),
Glib::ustring(expectedHandler.toStdString()),
}),
[&](const Glib::RefPtr<Gio::AsyncResult> &result) {
try {
connection->call_finish(result);
} catch (const Glib::Error &e) {
LOG(("Snap Default Handler Error: %1").arg(
QString::fromStdString(e.what())));
}
loop->quit();
},
std::string(kSnapcraftSettingsService));
QWindow window;
QGuiApplicationPrivate::showModalWindow(&window);
loop->run();
g_main_context_pop_thread_default(context->gobj());
QGuiApplicationPrivate::hideModalWindow(&window);
} catch (const Glib::Error &e) {
LOG(("Snap Default Handler Error: %1").arg(
QString::fromStdString(e.what())));
}
}
bool IsIBusPortalPresent() {
static const auto Result = [&] {
try {
@ -526,22 +454,6 @@ void SetDarkMode() {
} // namespace
void SetWatchingMediaKeys(bool watching) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
static std::unique_ptr<internal::GSDMediaKeys> GSDInstance;
if (watching) {
if (!GSDInstance) {
GSDInstance = std::make_unique<internal::GSDMediaKeys>();
}
} else {
if (GSDInstance) {
GSDInstance = nullptr;
}
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
}
void SetApplicationIcon(const QIcon &icon) {
QApplication::setWindowIcon(icon);
}
@ -820,76 +732,6 @@ void InstallLauncher(bool force) {
});
}
void RegisterCustomScheme(bool force) {
try {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (InSnap()) {
SnapDefaultHandler(qsl("tg"));
return;
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (cExeName().isEmpty()) {
return;
}
const auto neededCommandlineBuilder = qsl("%1 -workdir %2 --").arg(
QString(EscapeShell(QFile::encodeName(cExeDir() + cExeName()))),
QString(EscapeShell(QFile::encodeName(cWorkingDir()))));
const auto neededCommandline = qsl("%1 %u")
.arg(neededCommandlineBuilder);
const auto currentAppInfo = Gio::AppInfo::get_default_for_type(
std::string(kHandlerTypeName),
true);
if (currentAppInfo) {
const auto currentCommandline = QString::fromStdString(
currentAppInfo->get_commandline());
if (currentCommandline == neededCommandline) {
return;
}
}
auto registeredAppInfoList = g_app_info_get_recommended_for_type(
kHandlerTypeName.utf8().constData());
for (auto l = registeredAppInfoList; l != nullptr; l = l->next) {
const auto currentRegisteredAppInfo = reinterpret_cast<GAppInfo*>(
l->data);
const auto currentAppInfoId = QString(
g_app_info_get_id(currentRegisteredAppInfo));
const auto currentCommandline = QString(
g_app_info_get_commandline(currentRegisteredAppInfo));
if (currentCommandline == neededCommandline
&& currentAppInfoId.startsWith(qsl("userapp-"))) {
g_app_info_delete(currentRegisteredAppInfo);
}
}
if (registeredAppInfoList) {
g_list_free_full(registeredAppInfoList, g_object_unref);
}
const auto newAppInfo = Gio::AppInfo::create_from_commandline(
neededCommandlineBuilder.toStdString(),
std::string(AppName),
Gio::AppInfoCreateFlags::APP_INFO_CREATE_SUPPORTS_URIS);
if (newAppInfo) {
newAppInfo->set_as_default_for_type(
std::string(kHandlerTypeName));
}
} catch (const Glib::Error &e) {
LOG(("App Error: %1").arg(QString::fromStdString(e.what())));
}
}
PermissionStatus GetPermissionStatus(PermissionType type) {
return PermissionStatus::Granted;
}
@ -965,15 +807,11 @@ void start() {
crl::async(SetDarkMode);
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
NSWInstance = std::make_unique<internal::NotificationServiceWatcher>();
FileDialog::XDP::Start();
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
}
void finish() {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
NSWInstance = nullptr;
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
}
} // namespace ThirdParty
@ -984,7 +822,6 @@ void psNewVersion() {
#ifndef __HAIKU__
Platform::InstallLauncher();
#endif // __HAIKU__
Platform::RegisterCustomScheme();
}
void psAutoStart(bool start, bool silent) {

View file

@ -112,11 +112,6 @@ void WriteCrashDumpDetails() {
#endif // DESKTOP_APP_DISABLE_CRASH_REPORTS
}
void RegisterCustomScheme(bool force) {
OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]);
DEBUG_LOG(("App Info: set default handler for 'tg' scheme result: %1").arg(result));
}
// I do check for availability, just not in the exact way clang is content with
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
@ -196,7 +191,6 @@ void IgnoreApplicationActivationRightNow() {
} // namespace Platform
void psNewVersion() {
Platform::RegisterCustomScheme();
}
void psAutoStart(bool start, bool silent) {

View file

@ -243,9 +243,6 @@ ApplicationDelegate *_sharedDelegate = nil;
namespace Platform {
void SetWatchingMediaKeys(bool watching) {
}
void SetApplicationIcon(const QIcon &icon) {
NSImage *image = nil;
if (!icon.isNull()) {

View file

@ -27,10 +27,8 @@ enum class SystemSettingsType {
Audio,
};
void SetWatchingMediaKeys(bool watching);
void SetApplicationIcon(const QIcon &icon);
QString SingleInstanceLocalServerName(const QString &hash);
void RegisterCustomScheme(bool force = false);
PermissionStatus GetPermissionStatus(PermissionType type);
void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback);
void OpenSystemSettingsForPermission(PermissionType type);

View file

@ -372,58 +372,6 @@ namespace {
namespace Platform {
void RegisterCustomScheme(bool force) {
if (cExeName().isEmpty()) {
return;
}
DEBUG_LOG(("App Info: Checking custom scheme 'tg'..."));
HKEY rkey;
QString exe = QDir::toNativeSeparators(cExeDir() + cExeName());
QString possibleParams;
if (!cUseEnvApi()) {
possibleParams += " -no-env-api";
}
if (cApiFromStartParams()) {
possibleParams += " -api-id \"" + QString::number(cApiId()) + "\"";
possibleParams += " -api-hash \"" + cApiHash() + "\"";
}
// Legacy URI scheme registration
if (!_psOpenRegKey(L"Software\\Classes\\tg", &rkey)) return;
if (!_psSetKeyValue(rkey, L"URL Protocol", QString())) return;
if (!_psSetKeyValue(rkey, 0, qsl("URL:Telegram Link"))) return;
if (!_psOpenRegKey(L"Software\\Classes\\tg\\DefaultIcon", &rkey)) return;
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl(",1\""))) return;
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell", &rkey)) return;
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\"") + possibleParams + qsl(" -- \"%1\""))) return;
// URI scheme registration as Default Program - Windows Vista and above
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg", &rkey)) return;
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg\\DefaultIcon", &rkey)) return;
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl(",1\""))) return;
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg\\shell", &rkey)) return;
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg\\shell\\open", &rkey)) return;
if (!_psOpenRegKey(L"Software\\Classes\\ktgdesktop.tg\\shell\\open\\command", &rkey)) return;
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\"") + possibleParams + qsl(" -- \"%1\""))) return;
if (!_psOpenRegKey(L"Software\\KotatogramDesktop", &rkey)) return;
if (!_psOpenRegKey(L"Software\\KotatogramDesktop\\Capabilities", &rkey)) return;
if (!_psSetKeyValue(rkey, L"ApplicationName", qsl("Kotatogram Desktop"))) return;
if (!_psSetKeyValue(rkey, L"ApplicationDescription", qsl("Kotatogram Desktop"))) return;
if (!_psOpenRegKey(L"Software\\KotatogramDesktop\\Capabilities\\UrlAssociations", &rkey)) return;
if (!_psSetKeyValue(rkey, L"tg", qsl("ktgdesktop.tg"))) return;
if (!_psOpenRegKey(L"Software\\RegisteredApplications", &rkey)) return;
if (!_psSetKeyValue(rkey, L"Kotatogram Desktop", qsl("SOFTWARE\\KotatogramDesktop\\Capabilities"))) return;
}
PermissionStatus GetPermissionStatus(PermissionType type) {
if (type==PermissionType::Microphone) {
PermissionStatus result=PermissionStatus::Granted;
@ -476,7 +424,6 @@ bool OpenSystemSettings(SystemSettingsType type) {
} // namespace Platform
void psNewVersion() {
Platform::RegisterCustomScheme();
if (Local::oldSettingsVersion() < 8051) {
AppUserModelId::checkPinned();
}

View file

@ -16,9 +16,6 @@ class LocationPoint;
namespace Platform {
inline void SetWatchingMediaKeys(bool watching) {
}
inline void IgnoreApplicationActivationRightNow() {
}

View file

@ -127,7 +127,7 @@ auto GenerateCodes() {
}
});
codes.emplace(qsl("registertg"), [](SessionController *window) {
Platform::RegisterCustomScheme(true);
Core::Application::RegisterUrlScheme();
Ui::Toast::Show("Forced custom scheme register.");
});

View file

@ -49,7 +49,6 @@ protected:
private:
void updateControlsGeometry(int newWidth);
Ui::RpWidget *pushButton(base::unique_qptr<Ui::RpWidget> button);
void removeButton(not_null<Ui::RpWidget*> button);
const style::InfoTopBar &_st;
std::vector<base::unique_qptr<Ui::RpWidget>> _buttons;
@ -136,12 +135,6 @@ Ui::RpWidget *TopBar::pushButton(base::unique_qptr<Ui::RpWidget> button) {
return weak;
}
void TopBar::removeButton(not_null<Ui::RpWidget*> button) {
_buttons.erase(
std::remove(_buttons.begin(), _buttons.end(), button),
_buttons.end());
}
int TopBar::resizeGetHeight(int newWidth) {
updateControlsGeometry(newWidth);
return _st.height;

View file

@ -126,7 +126,6 @@ private:
void setInnerFocus();
void putNext(const object_ptr<TimePart> &field, QChar ch);
void erasePrevious(const object_ptr<TimePart> &field);
void finishInnerAnimating();
void setErrorShown(bool error);
void setFocused(bool focused);
void startBorderAnimation();
@ -538,14 +537,6 @@ void TimeInput::setFocused(bool focused) {
}
}
void TimeInput::finishInnerAnimating() {
_hour->finishAnimating();
_minute->finishAnimating();
_a_borderOpacity.stop();
_a_borderShown.stop();
_a_error.stop();
}
void TimeInput::startBorderAnimation() {
auto borderVisible = (_error || _focused);
if (_borderVisible != borderVisible) {

View file

@ -593,7 +593,7 @@ void EmptyUserpic::fillString(const QString &name) {
auto ch = name.constData(), end = ch + name.size();
while (ch != end) {
auto emojiLength = 0;
if (auto emoji = Ui::Emoji::Find(ch, end, &emojiLength)) {
if (Ui::Emoji::Find(ch, end, &emojiLength)) {
ch += emojiLength;
} else if (ch->isHighSurrogate()) {
++ch;

View file

@ -520,11 +520,9 @@ void MainWindow::initSize() {
}
const auto primaryScreen = QGuiApplication::primaryScreen();
auto geometryScreen = primaryScreen;
const auto available = primaryScreen
? primaryScreen->availableGeometry()
: QRect(0, 0, st::windowDefaultWidth, st::windowDefaultHeight);
bool maximized = false;
const auto initialWidth = Core::Settings::ThirdColumnByDefault()
? st::windowBigDefaultWidth
: st::windowDefaultWidth;
@ -590,13 +588,11 @@ void MainWindow::initSize() {
position.y + st::windowMinHeight <= screenGeometry.y() + screenGeometry.height()) {
DEBUG_LOG(("Window Pos: Resulting geometry is %1, %2, %3, %4").arg(position.x).arg(position.y).arg(position.w).arg(position.h));
geometry = QRect(position.x, position.y, position.w, position.h);
geometryScreen = screen;
}
}
break;
}
}
maximized = position.maximized;
}
geometry += _padding;
DEBUG_LOG(("Window Pos: Setting first %1, %2, %3, %4").arg(geometry.x()).arg(geometry.y()).arg(geometry.width()).arg(geometry.height()));

View file

@ -320,7 +320,7 @@ bool EditorBlock::selectSkip(int direction) {
if (newSelected < -1 || newSelected > maxSelected) {
newSelected = maxSelected;
}
if (auto changed = (newSelected != _selected)) {
if (newSelected != _selected) {
setSelected(newSelected);
scrollToSelected();
return (newSelected >= 0);

View file

@ -31,7 +31,7 @@ QString fillLetters(const QString &name) {
auto ch = name.constData(), end = ch + name.size();
while (ch != end) {
auto emojiLength = 0;
if (auto emoji = Ui::Emoji::Find(ch, end, &emojiLength)) {
if (Ui::Emoji::Find(ch, end, &emojiLength)) {
ch += emojiLength;
} else if (ch->isHighSurrogate()) {
++ch;
@ -246,10 +246,8 @@ void Generator::addAudioBubble(QVector<int> waveform, int waveactive, QString wa
auto skipBlock = computeSkipBlock(status, date);
auto width = st::msgFileMinWidth;
auto tleft = 0, tright = 0;
const auto &st = st::msgFileLayout;
tleft = st.padding.left() + st.thumbSize + st.padding.right();
tright = st.padding.left();
auto tleft = st.padding.left() + st.thumbSize + st.padding.right();
accumulate_max(width, tleft + st::normalFont->width(wavestatus) + skipBlock.width() + st::msgPadding.right());
if (!AdaptiveBubbles()) {
accumulate_min(width, st::msgMaxWidth);

View file

@ -22,6 +22,7 @@ constexpr auto kMinimalSkip = 7;
constexpr auto kSoonSkip = 30;
constexpr auto kNowSkip = 90;
#ifdef DESKTOP_APP_SPECIAL_TARGET
class Bar : public Ui::RpWidget {
public:
Bar(not_null<QWidget*> parent, QDate date);
@ -96,7 +97,6 @@ void Bar::paintEvent(QPaintEvent *e) {
_soon ? st::outdateSoonBg : st::outdatedBg);
}
#ifdef DESKTOP_APP_SPECIAL_TARGET
QString LastHiddenPath() {
return cWorkingDir() + qsl("tdata/outdated_hidden");
}

View file

@ -33,6 +33,7 @@ RUN git clone $GIT/desktop-app/patches.git
WORKDIR patches
RUN git checkout 87a2e9ee07
WORKDIR ..
FROM builder AS extra-cmake-modules

View file

@ -21,6 +21,7 @@ DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputDir={#ReleasePath}
SetupIconFile={#SourcePath}..\Resources\art\icon256.ico
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\Kotatogram.exe
Compression=lzma
SolidCompression=yes

View file

@ -191,7 +191,7 @@ if (NOT TGVOIP_FOUND)
if (LINUX)
if (NOT LIBTGVOIP_DISABLE_ALSA)
find_package(ALSA REQUIRED)
target_include_directories(lib_tgvoip_bundled PRIVATE ${ALSA_INCLUDE_DIRS})
target_include_directories(lib_tgvoip_bundled SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS})
else()
remove_target_sources(lib_tgvoip_bundled ${tgvoip_loc}
os/linux/AudioInputALSA.cpp
@ -206,7 +206,7 @@ if (NOT TGVOIP_FOUND)
if (NOT LIBTGVOIP_DISABLE_PULSEAUDIO)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PULSE REQUIRED libpulse)
target_include_directories(lib_tgvoip_bundled PRIVATE ${PULSE_INCLUDE_DIRS})
target_include_directories(lib_tgvoip_bundled SYSTEM PRIVATE ${PULSE_INCLUDE_DIRS})
else()
remove_target_sources(lib_tgvoip_bundled ${tgvoip_loc}
os/linux/AudioOutputPulse.cpp

@ -1 +1 @@
Subproject commit 18b6e547c970e8ba2e5f817df18f0d613a7b2d8f
Subproject commit 248614b49cd7d5aff69d75a737f2e35b79fbb119

@ -1 +1 @@
Subproject commit df2331b99693756b52008aa2628554ce1fe2f0d2
Subproject commit 13f02ee5ef3c109f5bb447c14fdde3da9f8e70f7

@ -1 +1 @@
Subproject commit 16150bf71d79382738114b913f137ec1a1a7630c
Subproject commit 3ccf2ed5095442e5874bba8852cb7dc4efeae29f

@ -1 +1 @@
Subproject commit 71fecd909b0d5553153ecb6803f03a91158aeefb
Subproject commit 0770df009db7928df1d0cad0900dc5110106d229

@ -1 +1 @@
Subproject commit 0a0097b9c8b89257b9c78d962f780078f961c88b
Subproject commit 68c9b788958904aea7de79f986a0f82ec8c5b094

@ -1 +1 @@
Subproject commit 2f8789f265c93f2de4745102e9d0f14dbba688a5
Subproject commit f206cb7bbb060e5b19ca85fddb5b6e0223f266d6

@ -1 +1 @@
Subproject commit 1ea86a387b1bc4fb1374c53a098a749bf024f7e6
Subproject commit 4a722c1f267b2491f8e9ef6200ae4ec61b46f397

@ -1 +1 @@
Subproject commit 87a002f9c746e83c14994098eee8e84ba22de2f2
Subproject commit 9ded693d98ba55d18a36dcc3cc4db98b786ae258

2
cmake

@ -1 +1 @@
Subproject commit 5b39ef4b82d6d0d08a71b669233d2c34d585a5ff
Subproject commit cbf0e420290319b6bd086d3403e5f30faabeee09