Skip to content

Add low battery notifications, improve device detection fallback by name, and fix tray icon rendering#22

Open
elazarit wants to merge 1 commit intoauto94:mainfrom
elazarit:main
Open

Add low battery notifications, improve device detection fallback by name, and fix tray icon rendering#22
elazarit wants to merge 1 commit intoauto94:mainfrom
elazarit:main

Conversation

@elazarit
Copy link
Copy Markdown
Contributor

@elazarit elazarit commented Apr 10, 2026

Motivation

  1. Provide an optional low-battery balloon notification so users can be alerted when headset battery is low.
  2. Expose configuration for enabling the popup and setting the threshold from the existing Settings UI and persisted settings file.
  3. Improve device detection reliability by adding a fallback mechanism to identify supported headsets by product name when Product IDs change due to firmware updates.
  4. Fix an intermittent issue where the system tray icon could appear blank on some systems due to icon handle lifetime management.

Description

  1. Added a lowBatteryPopupShown flag and logic in MainForm to show a single balloon tip when the battery level is non-zero and at-or-below the configured threshold, and reset the flag when appropriate in disconnected/no-device states.
  2. Added UI controls to SettingsForm (cbLowBatteryPopup and numLowBatteryPopup) and wired them to load/save settings via SettingsHelper so users can enable the popup and set the percentage threshold.
  3. Extended SettingsHelper (SettingsHelper.h / SettingsHelper.cpp) with:
  • getLowBatteryPopupEnabled
  • setLowBatteryPopupEnabled
  • getLowBatteryPopupLevel
  • setLowBatteryPopupLevel
    to persist the new settings.
  1. Added default values for the new settings to settings.xml and cleaned up object lifetime management where SettingsHelper instances are created and deleted.
  2. Improved headset detection robustness by adding a fallback detection path in getHeadsetDevicePath() that:
    -Enumerates all HID devices
    -Identifies supported headsets by vendor ID and product name
  • Re-enumerates using the detected VID/PID
    -This ensures compatibility with devices where firmware updates change Product IDs while keeping the product name consistent.
  1. Extended special-case detection logic for Cloud III Wireless and Cloud III S Wireless to also validate the product string in addition to Product ID, improving resilience against firmware revisions.
  2. Fixed a system tray icon rendering issue by improving icon lifetime management:
    -Generated tray icons are now cloned into managed Icon instances before destroying the underlying unmanaged HICON
  • Added tracking and disposal of previously generated tray icons to prevent managed/GDI resource leaks
  • Preserved the existing fix for unmanaged handle leaks while ensuring the tray icon remains valid for asynchronous shell rendering

… fix tray icon rendering

Motivation

    Provide an optional low-battery balloon notification so users can be alerted when headset battery is low.
    Expose configuration for enabling the popup and setting the threshold from the existing Settings UI and persisted settings file.
    Improve device detection reliability by adding a fallback mechanism to identify supported headsets by product name when Product IDs change due to firmware updates.
    Fix an intermittent issue where the system tray icon could appear blank on some systems due to icon handle lifetime management.

Description

    Added a lowBatteryPopupShown flag and logic in MainForm to show a single balloon tip when the battery level is non-zero and at-or-below the configured threshold, and reset the flag when appropriate in disconnected/no-device states.
    Added UI controls to SettingsForm (cbLowBatteryPopup and numLowBatteryPopup) and wired them to load/save settings via SettingsHelper so users can enable the popup and set the percentage threshold.
    Extended SettingsHelper (SettingsHelper.h / SettingsHelper.cpp) with:

    getLowBatteryPopupEnabled
    setLowBatteryPopupEnabled
    getLowBatteryPopupLevel
    setLowBatteryPopupLevel

to persist the new settings.

    Added default values for the new settings to settings.xml and cleaned up object lifetime management where SettingsHelper instances are created and deleted.
    Improved headset detection robustness by adding a fallback detection path in getHeadsetDevicePath() that:

    Enumerates all HID devices
    Identifies supported headsets by vendor ID and product name
    Re-enumerates using the detected VID/PID
    This ensures compatibility with devices where firmware updates change Product IDs while keeping the product name consistent.

    Extended special-case detection logic for Cloud III Wireless and Cloud III S Wireless to also validate the product string in addition to Product ID, improving resilience against firmware revisions.
    Fixed a system tray icon rendering issue by improving icon lifetime management:

    Generated tray icons are now cloned into managed Icon instances before destroying the underlying unmanaged HICON
    Added tracking and disposal of previously generated tray icons to prevent managed/GDI resource leaks
    Preserved the existing fix for unmanaged handle leaks while ensuring the tray icon remains valid for asynchronous shell rendering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant