Don't update tray icon after tray_exit() was called
This commit is contained in:
committed by
ReenigneArcher
parent
22736c4ce9
commit
c43dd2489f
@@ -31,6 +31,7 @@
|
|||||||
- (Linux) Fix udev rules for uinput access not working until after reboot
|
- (Linux) Fix udev rules for uinput access not working until after reboot
|
||||||
- (Linux) Fix wrong path in desktop files
|
- (Linux) Fix wrong path in desktop files
|
||||||
- (Tray) Cache icons to avoid possible DRM issues
|
- (Tray) Cache icons to avoid possible DRM issues
|
||||||
|
- (Tray) Fix attempt to update tray icon after it was destroyed
|
||||||
- (Linux) Migrate old config files to new location if env SUNSHINE_MIGRATE_CONFIG=1 is set (automatically set for Flatpak)
|
- (Linux) Migrate old config files to new location if env SUNSHINE_MIGRATE_CONFIG=1 is set (automatically set for Flatpak)
|
||||||
- (Linux/Fedora) Re-enable CUDA support and bump to 12.4.0
|
- (Linux/Fedora) Re-enable CUDA support and bump to 12.4.0
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ using namespace std::literals;
|
|||||||
|
|
||||||
// system_tray namespace
|
// system_tray namespace
|
||||||
namespace system_tray {
|
namespace system_tray {
|
||||||
|
static std::atomic<bool> tray_initialized = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Callback for opening the UI from the system tray.
|
* @brief Callback for opening the UI from the system tray.
|
||||||
* @param item The tray menu item.
|
* @param item The tray menu item.
|
||||||
@@ -239,6 +241,7 @@ namespace system_tray {
|
|||||||
BOOST_LOG(info) << "System tray created"sv;
|
BOOST_LOG(info) << "System tray created"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tray_initialized = true;
|
||||||
while (tray_loop(1) == 0) {
|
while (tray_loop(1) == 0) {
|
||||||
BOOST_LOG(debug) << "System tray loop"sv;
|
BOOST_LOG(debug) << "System tray loop"sv;
|
||||||
}
|
}
|
||||||
@@ -275,6 +278,7 @@ namespace system_tray {
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
end_tray() {
|
end_tray() {
|
||||||
|
tray_initialized = false;
|
||||||
tray_exit();
|
tray_exit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -285,6 +289,10 @@ namespace system_tray {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
update_tray_playing(std::string app_name) {
|
update_tray_playing(std::string app_name) {
|
||||||
|
if (!tray_initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tray.notification_title = NULL;
|
tray.notification_title = NULL;
|
||||||
tray.notification_text = NULL;
|
tray.notification_text = NULL;
|
||||||
tray.notification_cb = NULL;
|
tray.notification_cb = NULL;
|
||||||
@@ -307,6 +315,10 @@ namespace system_tray {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
update_tray_pausing(std::string app_name) {
|
update_tray_pausing(std::string app_name) {
|
||||||
|
if (!tray_initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tray.notification_title = NULL;
|
tray.notification_title = NULL;
|
||||||
tray.notification_text = NULL;
|
tray.notification_text = NULL;
|
||||||
tray.notification_cb = NULL;
|
tray.notification_cb = NULL;
|
||||||
@@ -329,6 +341,10 @@ namespace system_tray {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
update_tray_stopped(std::string app_name) {
|
update_tray_stopped(std::string app_name) {
|
||||||
|
if (!tray_initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tray.notification_title = NULL;
|
tray.notification_title = NULL;
|
||||||
tray.notification_text = NULL;
|
tray.notification_text = NULL;
|
||||||
tray.notification_cb = NULL;
|
tray.notification_cb = NULL;
|
||||||
@@ -350,6 +366,10 @@ namespace system_tray {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
update_tray_require_pin() {
|
update_tray_require_pin() {
|
||||||
|
if (!tray_initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tray.notification_title = NULL;
|
tray.notification_title = NULL;
|
||||||
tray.notification_text = NULL;
|
tray.notification_text = NULL;
|
||||||
tray.notification_cb = NULL;
|
tray.notification_cb = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user