@@ -290,21 +290,18 @@ void tray_update(struct tray *tray) {
290290 MultiByteToWideChar (CP_UTF8 , 0 , tray -> tooltip , -1 , nid .szTip , sizeof (nid .szTip ) / sizeof (wchar_t ));
291291 nid .uFlags |= NIF_TIP ;
292292 }
293- QUERY_USER_NOTIFICATION_STATE notification_state ;
294- HRESULT ns = SHQueryUserNotificationState (& notification_state );
295- int can_show_notifications = ns == S_OK && notification_state == QUNS_ACCEPTS_NOTIFICATIONS ;
296- if (can_show_notifications == 1 && tray -> notification_title != 0 && strlen (tray -> notification_title ) > 0 ) {
293+ if (tray -> notification_title != 0 && strlen (tray -> notification_title ) > 0 ) {
297294 MultiByteToWideChar (CP_UTF8 , 0 , tray -> notification_title , -1 , nid .szInfoTitle , sizeof (nid .szInfoTitle ) / sizeof (wchar_t ));
298295 nid .uFlags |= NIF_INFO ;
299296 } else if ((nid .uFlags & NIF_INFO ) == NIF_INFO ) {
300297 nid .szInfoTitle [0 ] = L'\0' ;
301298 }
302- if (can_show_notifications == 1 && tray -> notification_text != 0 && strlen (tray -> notification_text ) > 0 ) {
299+ if (tray -> notification_text != 0 && strlen (tray -> notification_text ) > 0 ) {
303300 MultiByteToWideChar (CP_UTF8 , 0 , tray -> notification_text , -1 , nid .szInfo , sizeof (nid .szInfo ) / sizeof (wchar_t ));
304301 } else if ((nid .uFlags & NIF_INFO ) == NIF_INFO ) {
305302 nid .szInfo [0 ] = L'\0' ;
306303 }
307- if (can_show_notifications == 1 && tray -> notification_cb != NULL ) {
304+ if (tray -> notification_cb != NULL ) {
308305 notification_cb = tray -> notification_cb ;
309306 }
310307
@@ -330,6 +327,10 @@ void tray_exit(void) {
330327 UnregisterClass (WC_TRAY_CLASS_NAME , GetModuleHandle (NULL ));
331328}
332329
330+ /**
331+ * @brief Get the window handle of the tray.
332+ * @return Window handle.
333+ */
333334HWND tray_get_hwnd (void ) {
334335 return hwnd ;
335336}
0 commit comments