From d91b3f8dd9261ed9f912e4dd33202f20494942ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Tue, 28 Jul 2020 02:23:31 +0200 Subject: [PATCH] Utils(GetTrayIcon): refactor with frontend API function --- src/Utils.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index ab301606..da0b7fe6 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -485,11 +485,8 @@ QString Utils::OBSVersionString() { } QSystemTrayIcon* Utils::GetTrayIcon() { - QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window(); - if (!main) return nullptr; - - QList trays = main->findChildren(); - return trays.isEmpty() ? nullptr : trays.first(); + void* systemTray = obs_frontend_get_system_tray(); + return reinterpret_cast(systemTray); } void Utils::SysTrayNotify(QString text,