mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-05-11 10:23:56 +02:00
Get rid of XEmbed mentions
The code goes through Qt abstractions which not necessarily go through XEmbed
This commit is contained in:
parent
0fb67c78a9
commit
57f10040e1
2 changed files with 13 additions and 13 deletions
|
@ -279,10 +279,10 @@ void Tray::createIcon() {
|
||||||
_iconGraphic = std::make_unique<IconGraphic>();
|
_iconGraphic = std::make_unique<IconGraphic>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto showXEmbed = [=] {
|
const auto showCustom = [=] {
|
||||||
_aboutToShowRequests.fire({});
|
_aboutToShowRequests.fire({});
|
||||||
InvokeQueued(_menuXEmbed.get(), [=] {
|
InvokeQueued(_menuCustom.get(), [=] {
|
||||||
_menuXEmbed->popup(QCursor::pos());
|
_menuCustom->popup(QCursor::pos());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ void Tray::createIcon() {
|
||||||
&QSystemTrayIcon::activated
|
&QSystemTrayIcon::activated
|
||||||
) | rpl::start_with_next([=](Reason reason) {
|
) | rpl::start_with_next([=](Reason reason) {
|
||||||
if (reason == QSystemTrayIcon::Context) {
|
if (reason == QSystemTrayIcon::Context) {
|
||||||
showXEmbed();
|
showCustom();
|
||||||
} else {
|
} else {
|
||||||
_iconClicks.fire({});
|
_iconClicks.fire({});
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ void Tray::createIcon() {
|
||||||
QCoreApplication::instance());
|
QCoreApplication::instance());
|
||||||
_eventFilter->contextMenuFilters(
|
_eventFilter->contextMenuFilters(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
showXEmbed();
|
showCustom();
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,14 +337,14 @@ void Tray::createMenu() {
|
||||||
if (!_menu) {
|
if (!_menu) {
|
||||||
_menu = base::make_unique_q<QMenu>(nullptr);
|
_menu = base::make_unique_q<QMenu>(nullptr);
|
||||||
}
|
}
|
||||||
if (!_menuXEmbed) {
|
if (!_menuCustom) {
|
||||||
_menuXEmbed = base::make_unique_q<Ui::PopupMenu>(nullptr);
|
_menuCustom = base::make_unique_q<Ui::PopupMenu>(nullptr);
|
||||||
_menuXEmbed->deleteOnHide(false);
|
_menuCustom->deleteOnHide(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tray::destroyMenu() {
|
void Tray::destroyMenu() {
|
||||||
_menuXEmbed = nullptr;
|
_menuCustom = nullptr;
|
||||||
if (_menu) {
|
if (_menu) {
|
||||||
_menu->clear();
|
_menu->clear();
|
||||||
}
|
}
|
||||||
|
@ -352,12 +352,12 @@ void Tray::destroyMenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tray::addAction(rpl::producer<QString> text, Fn<void()> &&callback) {
|
void Tray::addAction(rpl::producer<QString> text, Fn<void()> &&callback) {
|
||||||
if (_menuXEmbed) {
|
if (_menuCustom) {
|
||||||
const auto XEAction = _menuXEmbed->addAction(QString(), callback);
|
const auto action = _menuCustom->addAction(QString(), callback);
|
||||||
rpl::duplicate(
|
rpl::duplicate(
|
||||||
text
|
text
|
||||||
) | rpl::start_with_next([=](const QString &text) {
|
) | rpl::start_with_next([=](const QString &text) {
|
||||||
XEAction->setText(text);
|
action->setText(text);
|
||||||
}, _actionsLifetime);
|
}, _actionsLifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
|
|
||||||
base::unique_qptr<QSystemTrayIcon> _icon;
|
base::unique_qptr<QSystemTrayIcon> _icon;
|
||||||
base::unique_qptr<QMenu> _menu;
|
base::unique_qptr<QMenu> _menu;
|
||||||
base::unique_qptr<Ui::PopupMenu> _menuXEmbed;
|
base::unique_qptr<Ui::PopupMenu> _menuCustom;
|
||||||
|
|
||||||
base::unique_qptr<TrayEventFilter> _eventFilter;
|
base::unique_qptr<TrayEventFilter> _eventFilter;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue