mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Create tray / mediaview queued on macOS.
This removes some strange redundant entries like "Item-0" from the Dock menu.
This commit is contained in:
parent
671b3bc94e
commit
0bdd0689c0
2 changed files with 34 additions and 3 deletions
|
@ -347,9 +347,7 @@ void Application::run() {
|
||||||
|
|
||||||
_lastActivePrimaryWindow->widget()->show();
|
_lastActivePrimaryWindow->widget()->show();
|
||||||
|
|
||||||
const auto current = _lastActivePrimaryWindow->widget()->geometry();
|
startMediaView();
|
||||||
_mediaView = std::make_unique<Media::View::OverlayWidget>();
|
|
||||||
_lastActivePrimaryWindow->widget()->Ui::RpWidget::setGeometry(current);
|
|
||||||
|
|
||||||
DEBUG_LOG(("Application Info: showing."));
|
DEBUG_LOG(("Application Info: showing."));
|
||||||
_lastActivePrimaryWindow->finishFirstShow();
|
_lastActivePrimaryWindow->finishFirstShow();
|
||||||
|
@ -492,7 +490,38 @@ void Application::processCreatedWindow(
|
||||||
) | rpl::start_to_stream(_openInMediaViewRequests, window->lifetime());
|
) | rpl::start_to_stream(_openInMediaViewRequests, window->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::startMediaView() {
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// On macOS we create some windows async, otherwise they're
|
||||||
|
// added to the Dock Menu as a visible window and are removed
|
||||||
|
// only after first show and then hide.
|
||||||
|
InvokeQueued(this, [=] {
|
||||||
|
_mediaView = std::make_unique<Media::View::OverlayWidget>();
|
||||||
|
});
|
||||||
|
#else // Q_OS_MAC
|
||||||
|
// On Windows we needed such hack for the main window, otherwise
|
||||||
|
// somewhere inside the media viewer creating code its geometry
|
||||||
|
// was broken / lost to some invalid values.
|
||||||
|
const auto current = _lastActivePrimaryWindow->widget()->geometry();
|
||||||
|
_mediaView = std::make_unique<Media::View::OverlayWidget>();
|
||||||
|
_lastActivePrimaryWindow->widget()->Ui::RpWidget::setGeometry(current);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
}
|
||||||
|
|
||||||
void Application::startTray() {
|
void Application::startTray() {
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// On macOS we create some windows async, otherwise they're
|
||||||
|
// added to the Dock Menu as a visible window and are removed
|
||||||
|
// only after first show and then hide, tray icon being "Item-0".
|
||||||
|
InvokeQueued(this, [=] {
|
||||||
|
createTray();
|
||||||
|
});
|
||||||
|
#else // Q_OS_MAC
|
||||||
|
createTray();
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::createTray() {
|
||||||
using WindowRaw = not_null<Window::Controller*>;
|
using WindowRaw = not_null<Window::Controller*>;
|
||||||
_tray->create();
|
_tray->create();
|
||||||
_tray->aboutToShowRequests(
|
_tray->aboutToShowRequests(
|
||||||
|
|
|
@ -333,8 +333,10 @@ private:
|
||||||
void startDomain();
|
void startDomain();
|
||||||
void startEmojiImageLoader();
|
void startEmojiImageLoader();
|
||||||
void startSystemDarkModeViewer();
|
void startSystemDarkModeViewer();
|
||||||
|
void startMediaView();
|
||||||
void startTray();
|
void startTray();
|
||||||
|
|
||||||
|
void createTray();
|
||||||
void updateWindowTitles();
|
void updateWindowTitles();
|
||||||
void setLastActiveWindow(Window::Controller *window);
|
void setLastActiveWindow(Window::Controller *window);
|
||||||
void showAccount(not_null<Main::Account*> account);
|
void showAccount(not_null<Main::Account*> account);
|
||||||
|
|
Loading…
Add table
Reference in a new issue